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