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