]> git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/Makefile.am
Merge pull request #2618 from CameronNemo/lxcmountroot
[mirror_lxc.git] / src / lxc / Makefile.am
1 pkginclude_HEADERS = attach_options.h \
2 lxccontainer.h \
3 version.h
4
5 noinst_HEADERS = api_extensions.h \
6 attach.h \
7 caps.h \
8 cgroups/cgroup.h \
9 cgroups/cgroup_utils.h \
10 compiler.h \
11 conf.h \
12 confile.h \
13 confile_utils.h \
14 criu.h \
15 error.h \
16 file_utils.h \
17 ../include/netns_ifaddrs.h \
18 initutils.h \
19 list.h \
20 log.h \
21 lxc.h \
22 lxclock.h \
23 macro.h \
24 monitor.h \
25 namespace.h \
26 start.h \
27 state.h \
28 storage/btrfs.h \
29 storage/dir.h \
30 storage/loop.h \
31 storage/lvm.h \
32 storage/nbd.h \
33 storage/overlay.h \
34 storage/rbd.h \
35 storage/rsync.h \
36 storage/storage.h \
37 storage/storage_utils.h \
38 storage/zfs.h \
39 string_utils.h \
40 terminal.h \
41 ../tests/lxctest.h \
42 tools/arguments.h \
43 utils.h
44
45 if IS_BIONIC
46 noinst_HEADERS += ../include/lxcmntent.h \
47 ../include/openpty.h
48 endif
49
50 if !HAVE_PRLIMIT
51 if HAVE_PRLIMIT64
52 noinst_HEADERS += ../include/prlimit.h
53 endif
54 endif
55
56 if !HAVE_GETLINE
57 if HAVE_FGETLN
58 noinst_HEADERS += ../include/getline.h
59 endif
60 endif
61
62 if !HAVE_GETSUBOPT
63 noinst_HEADERS += tools/include/getsubopt.h
64 endif
65
66 if !HAVE_GETGRGID_R
67 noinst_HEADERS += ../include/getgrgid_r.h
68 endif
69
70 sodir=$(libdir)
71
72 LSM_SOURCES = lsm/lsm.c \
73 lsm/lsm.h \
74 lsm/nop.c
75
76 if ENABLE_APPARMOR
77 LSM_SOURCES += lsm/apparmor.c
78 endif
79
80 if ENABLE_SELINUX
81 LSM_SOURCES += lsm/selinux.c
82 endif
83
84 lib_LTLIBRARIES = liblxc.la
85 liblxc_la_SOURCES = af_unix.c af_unix.h \
86 api_extensions.h \
87 attach.c attach.h \
88 caps.c caps.h \
89 cgroups/cgfsng.c \
90 cgroups/cgroup.c cgroups/cgroup.h \
91 cgroups/cgroup_utils.c cgroups/cgroup_utils.h \
92 compiler.h \
93 commands.c commands.h \
94 commands_utils.c commands_utils.h \
95 conf.c conf.h \
96 confile.c confile.h \
97 confile_utils.c confile_utils.h \
98 criu.c criu.h \
99 error.c error.h \
100 execute.c \
101 freezer.c \
102 file_utils.c file_utils.h \
103 ../include/netns_ifaddrs.c ../include/netns_ifaddrs.h \
104 initutils.c initutils.h \
105 list.h \
106 log.c log.h \
107 lxc.h \
108 lxccontainer.c lxccontainer.h \
109 lxclock.c lxclock.h \
110 lxcseccomp.h \
111 macro.h \
112 mainloop.c mainloop.h \
113 namespace.c namespace.h \
114 nl.c nl.h \
115 network.c network.h \
116 monitor.c monitor.h \
117 parse.c parse.h \
118 ringbuf.c ringbuf.h \
119 rtnl.c rtnl.h \
120 state.c state.h \
121 start.c start.h \
122 storage/btrfs.c storage/btrfs.h \
123 storage/dir.c storage/dir.h \
124 storage/loop.c storage/loop.h \
125 storage/lvm.c storage/lvm.h \
126 storage/nbd.c storage/nbd.h \
127 storage/overlay.c storage/overlay.h \
128 storage/rbd.c storage/rbd.h \
129 storage/rsync.c storage/rsync.h \
130 storage/storage.c storage/storage.h \
131 storage/storage_utils.c storage/storage_utils.h \
132 storage/zfs.c storage/zfs.h \
133 string_utils.c string_utils.h \
134 sync.c sync.h \
135 terminal.c \
136 utils.c utils.h \
137 version.h \
138 $(LSM_SOURCES)
139
140 if IS_BIONIC
141 liblxc_la_SOURCES += ../include/lxcmntent.c ../include/lxcmntent.h \
142 ../include/openpty.c ../include/openpty.h
143 endif
144
145 if !HAVE_GETGRGID_R
146 liblxc_la_SOURCES += ../include/getgrgid_r.c ../include/getgrgid_r.h
147 endif
148
149 if !HAVE_GETLINE
150 if HAVE_FGETLN
151 liblxc_la_SOURCES += ../include/getline.c ../include/getline.h
152 endif
153 endif
154
155 if !HAVE_PRLIMIT
156 if HAVE_PRLIMIT64
157 liblxc_la_SOURCES += ../include/prlimit.c ../include/prlimit.h
158 endif
159 endif
160
161 if ENABLE_SECCOMP
162 liblxc_la_SOURCES += seccomp.c
163 endif
164
165 if !HAVE_STRLCPY
166 liblxc_la_SOURCES += ../include/strlcpy.c ../include/strlcpy.h
167 endif
168
169 if !HAVE_STRLCAT
170 liblxc_la_SOURCES += ../include/strlcat.c ../include/strlcat.h
171 endif
172
173 AM_CFLAGS = -DLXCROOTFSMOUNT=\"$(LXCROOTFSMOUNT)\" \
174 -DLXCPATH=\"$(LXCPATH)\" \
175 -DLXC_GLOBAL_CONF=\"$(LXC_GLOBAL_CONF)\" \
176 -DLXCINITDIR=\"$(LXCINITDIR)\" \
177 -DLIBEXECDIR=\"$(LIBEXECDIR)\" \
178 -DLXCTEMPLATEDIR=\"$(LXCTEMPLATEDIR)\" \
179 -DLXCTEMPLATECONFIG=\"$(LXCTEMPLATECONFIG)\" \
180 -DLOGPATH=\"$(LOGPATH)\" \
181 -DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\" \
182 -DLXC_USERNIC_DB=\"$(LXC_USERNIC_DB)\" \
183 -DLXC_USERNIC_CONF=\"$(LXC_USERNIC_CONF)\" \
184 -DDEFAULT_CGROUP_PATTERN=\"$(DEFAULT_CGROUP_PATTERN)\" \
185 -DRUNTIME_PATH=\"$(RUNTIME_PATH)\" \
186 -DSBINDIR=\"$(SBINDIR)\" \
187 -DAPPARMOR_CACHE_DIR=\"$(APPARMOR_CACHE_DIR)\" \
188 -I $(top_srcdir)/src \
189 -I $(top_srcdir)/src/lxc \
190 -I $(top_srcdir)/src/lxc/storage \
191 -I $(top_srcdir)/src/lxc/cgroups
192
193 if ENABLE_APPARMOR
194 AM_CFLAGS += -DHAVE_APPARMOR
195 endif
196
197 if ENABLE_GNUTLS
198 AM_CFLAGS += -DHAVE_LIBGNUTLS
199 endif
200
201 if ENABLE_SECCOMP
202 AM_CFLAGS += -DHAVE_SECCOMP \
203 $(SECCOMP_CFLAGS)
204 endif
205
206 if ENABLE_SELINUX
207 AM_CFLAGS += -DHAVE_SELINUX
208 endif
209
210 if ENABLE_DLOG
211 AM_CFLAGS += -DHAVE_DLOG \
212 $(DLOG_CFLAGS)
213 endif
214
215 if USE_CONFIGPATH_LOGS
216 AM_CFLAGS += -DUSE_CONFIGPATH_LOGS
217 endif
218
219 # build the shared library
220 liblxc_la_CFLAGS = -fPIC \
221 -DPIC \
222 $(AM_CFLAGS) \
223 -pthread
224
225 liblxc_la_LDFLAGS = -pthread \
226 -Wl,-no-undefined \
227 -Wl,-soname,liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) \
228 -version-info @LXC_ABI_MAJOR@
229
230 liblxc_la_LIBADD = $(CAP_LIBS) \
231 $(GNUTLS_LIBS) \
232 $(SELINUX_LIBS) \
233 $(SECCOMP_LIBS) \
234 $(DLOG_LIBS)
235
236 bin_SCRIPTS=
237
238 if ENABLE_COMMANDS
239 bin_SCRIPTS += cmd/lxc-checkconfig \
240 cmd/lxc-update-config
241 endif
242
243 if ENABLE_TOOLS
244 bin_PROGRAMS = lxc-attach \
245 lxc-autostart \
246 lxc-cgroup \
247 lxc-checkpoint \
248 lxc-copy \
249 lxc-config \
250 lxc-console \
251 lxc-create \
252 lxc-destroy \
253 lxc-device \
254 lxc-execute \
255 lxc-freeze \
256 lxc-info \
257 lxc-ls \
258 lxc-monitor \
259 lxc-snapshot \
260 lxc-start \
261 lxc-stop \
262 lxc-top \
263 lxc-unfreeze \
264 lxc-unshare \
265 lxc-usernsexec \
266 lxc-wait
267 endif
268
269 if ENABLE_COMMANDS
270 sbin_PROGRAMS = init.lxc
271
272 pkglibexec_PROGRAMS = lxc-monitord \
273 lxc-user-nic
274 endif
275
276 AM_LDFLAGS = -Wl,-E
277
278 if ENABLE_RPATH
279 AM_LDFLAGS += -Wl,-rpath -Wl,$(libdir)
280 endif
281
282 LDADD = liblxc.la \
283 @CAP_LIBS@ \
284 @GNUTLS_LIBS@ \
285 @SECCOMP_LIBS@ \
286 @SELINUX_LIBS@ \
287 @DLOG_LIBS@
288
289 if ENABLE_TOOLS
290 lxc_attach_SOURCES = tools/lxc_attach.c \
291 tools/arguments.c tools/arguments.h
292 lxc_autostart_SOURCES = tools/lxc_autostart.c \
293 tools/arguments.c tools/arguments.h
294 lxc_cgroup_SOURCES = tools/lxc_cgroup.c \
295 tools/arguments.c tools/arguments.h
296 lxc_config_SOURCES = tools/lxc_config.c \
297 tools/arguments.c tools/arguments.h
298 lxc_console_SOURCES = tools/lxc_console.c \
299 tools/arguments.c tools/arguments.h
300 lxc_destroy_SOURCES = tools/lxc_destroy.c \
301 tools/arguments.c tools/arguments.h
302 lxc_device_SOURCES = tools/lxc_device.c \
303 tools/arguments.c tools/arguments.h
304 lxc_execute_SOURCES = tools/lxc_execute.c \
305 tools/arguments.c tools/arguments.h
306 lxc_freeze_SOURCES = tools/lxc_freeze.c \
307 tools/arguments.c tools/arguments.h
308 lxc_info_SOURCES = tools/lxc_info.c \
309 tools/arguments.c tools/arguments.h
310 lxc_monitor_SOURCES = tools/lxc_monitor.c \
311 macro.h \
312 tools/arguments.c tools/arguments.h
313 lxc_ls_SOURCES = tools/lxc_ls.c \
314 tools/arguments.c tools/arguments.h
315 lxc_copy_SOURCES = tools/lxc_copy.c \
316 tools/arguments.c tools/arguments.h
317 lxc_start_SOURCES = tools/lxc_start.c \
318 tools/arguments.c tools/arguments.h
319 lxc_stop_SOURCES = tools/lxc_stop.c \
320 tools/arguments.c tools/arguments.h
321 lxc_top_SOURCES = tools/lxc_top.c \
322 tools/arguments.c tools/arguments.h
323 lxc_unfreeze_SOURCES = tools/lxc_unfreeze.c \
324 tools/arguments.c tools/arguments.h
325 lxc_unshare_SOURCES = tools/lxc_unshare.c \
326 tools/arguments.c tools/arguments.h
327 lxc_wait_SOURCES = tools/lxc_wait.c \
328 tools/arguments.c tools/arguments.h
329 lxc_create_SOURCES = tools/lxc_create.c \
330 tools/arguments.c tools/arguments.h
331 lxc_snapshot_SOURCES = tools/lxc_snapshot.c \
332 tools/arguments.c tools/arguments.h
333 lxc_checkpoint_SOURCES = tools/lxc_checkpoint.c \
334 tools/arguments.c tools/arguments.h
335 endif
336
337 if ENABLE_COMMANDS
338 # Binaries shipping with liblxc
339 init_lxc_SOURCES = cmd/lxc_init.c \
340 initutils.c initutils.h \
341 string_utils.c string_utils.h
342 lxc_monitord_SOURCES = cmd/lxc_monitord.c
343 lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
344 ../include/netns_ifaddrs.c ../include/netns_ifaddrs.h \
345 log.c log.h \
346 namespace.c namespace.h \
347 network.c network.h \
348 parse.c parse.h
349 lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \
350 conf.c conf.h \
351 list.h \
352 log.c log.h \
353 macro.h \
354 namespace.c namespace.h \
355 file_utils.c file_utils.h \
356 string_utils.c string_utils.h \
357 utils.c utils.h
358 endif
359
360
361 if ENABLE_TOOLS
362 if !HAVE_GETSUBOPT
363 lxc_copy_SOURCES += tools/include/getsubopt.c tools/include/getsubopt.h
364 endif
365 endif
366
367 if ENABLE_COMMANDS
368 if HAVE_STATIC_LIBCAP
369 sbin_PROGRAMS += init.lxc.static
370
371 init_lxc_static_SOURCES = cmd/lxc_init.c \
372 caps.c caps.h \
373 error.c error.h \
374 initutils.c initutils.h \
375 file_utils.c file_utils.h \
376 log.c log.h \
377 macro.h \
378 namespace.c namespace.h \
379 string_utils.c string_utils.h
380
381 if !HAVE_GETLINE
382 if HAVE_FGETLN
383 init_lxc_static_SOURCES += ../include/getline.c ../include/getline.h
384 endif
385 endif
386
387 if !HAVE_STRLCPY
388 init_lxc_static_SOURCES += ../include/strlcpy.c ../include/strlcpy.h
389 endif
390
391 if !HAVE_STRLCAT
392 init_lxc_static_SOURCES += ../include/strlcat.c ../include/strlcat.h
393 endif
394
395 init_lxc_static_LDFLAGS = -all-static
396 init_lxc_static_LDADD = @CAP_LIBS@
397 init_lxc_static_CFLAGS = $(AM_CFLAGS) -DNO_LXC_CONF
398 endif
399 endif
400
401 if ENABLE_PAM
402 if HAVE_PAM
403 pam_LTLIBRARIES = pam_cgfs.la
404
405 pam_cgfs_la_SOURCES = pam/pam_cgfs.c \
406 caps.c caps.h \
407 file_utils.c file_utils.h \
408 log.c log.h \
409 macro.h \
410 string_utils.c string_utils.h
411
412 if !HAVE_STRLCAT
413 pam_cgfs_la_SOURCES += ../include/strlcat.c ../include/strlcat.h
414 endif
415
416 if !HAVE_STRLCPY
417 pam_cgfs_la_SOURCES += ../include/strlcpy.c ../include/strlcpy.h
418 endif
419
420 pam_cgfs_la_CFLAGS = $(AM_CFLAGS) -DNO_LXC_CONF
421
422 pam_cgfs_la_LIBADD = $(AM_LIBS) \
423 $(PAM_LIBS) \
424 $(DLOG_LIBS) \
425 -L$(top_srcdir)
426
427 pam_cgfs_la_LDFLAGS = $(AM_LDFLAGS) \
428 -avoid-version \
429 -module \
430 -shared \
431 -Wl,-no-undefined
432 endif
433 endif
434
435 install-exec-local: install-libLTLIBRARIES
436 mkdir -p $(DESTDIR)$(datadir)/lxc
437 install -c -m 644 lxc.functions $(DESTDIR)$(datadir)/lxc
438 mv $(shell readlink -f $(DESTDIR)$(libdir)/liblxc.so) $(DESTDIR)$(libdir)/liblxc.so.@LXC_ABI@
439 rm -f $(DESTDIR)$(libdir)/liblxc.so $(DESTDIR)$(libdir)/liblxc.so.1
440 cd $(DESTDIR)$(libdir); \
441 ln -sf liblxc.so.@LXC_ABI@ liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)); \
442 ln -sf liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) liblxc.so
443
444 install-exec-hook:
445 chmod u+s $(DESTDIR)$(libexecdir)/lxc/lxc-user-nic
446
447 uninstall-local:
448 $(RM) $(DESTDIR)$(libdir)/liblxc.so*
449 $(RM) $(DESTDIR)$(libdir)/liblxc.a
450 if ENABLE_PAM
451 if HAVE_PAM
452 $(RM) $(DESTDIR)$(pamdir)/pam_cgfs.so*
453
454 install-data-hook: install-pamLTLIBRARIES
455 $(RM) "$(DESTDIR)$(pamdir)/pam_cgfs.la"
456 $(RM) "$(DESTDIR)$(pamdir)/pam_cgfs.a"
457 endif
458 endif