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