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