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