]> git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/Makefile.am
Merge pull request #2558 from brauner/2018-08-21/pam_cgfs
[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 IS_BIONIC
136 liblxc_la_SOURCES += ../include/ifaddrs.c ../include/ifaddrs.h \
137 ../include/lxcmntent.c ../include/lxcmntent.h \
138 ../include/openpty.c ../include/openpty.h
139 endif
140
141 if !HAVE_GETGRGID_R
142 liblxc_la_SOURCES += ../include/getgrgid_r.c ../include/getgrgid_r.h
143 endif
144
145 if !HAVE_GETLINE
146 if HAVE_FGETLN
147 liblxc_la_SOURCES += ../include/getline.c ../include/getline.h
148 endif
149 endif
150
151 if !HAVE_PRLIMIT
152 if HAVE_PRLIMIT64
153 liblxc_la_SOURCES += ../include/prlimit.c ../include/prlimit.h
154 endif
155 endif
156
157 if ENABLE_SECCOMP
158 liblxc_la_SOURCES += seccomp.c
159 endif
160
161 if !HAVE_STRLCPY
162 liblxc_la_SOURCES += ../include/strlcpy.c ../include/strlcpy.h
163 endif
164
165 if !HAVE_STRLCAT
166 liblxc_la_SOURCES += ../include/strlcat.c ../include/strlcat.h
167 endif
168
169 AM_CFLAGS = -DLXCROOTFSMOUNT=\"$(LXCROOTFSMOUNT)\" \
170 -DLXCPATH=\"$(LXCPATH)\" \
171 -DLXC_GLOBAL_CONF=\"$(LXC_GLOBAL_CONF)\" \
172 -DLXCINITDIR=\"$(LXCINITDIR)\" \
173 -DLIBEXECDIR=\"$(LIBEXECDIR)\" \
174 -DLXCTEMPLATEDIR=\"$(LXCTEMPLATEDIR)\" \
175 -DLXCTEMPLATECONFIG=\"$(LXCTEMPLATECONFIG)\" \
176 -DLOGPATH=\"$(LOGPATH)\" \
177 -DLXC_DEFAULT_CONFIG=\"$(LXC_DEFAULT_CONFIG)\" \
178 -DLXC_USERNIC_DB=\"$(LXC_USERNIC_DB)\" \
179 -DLXC_USERNIC_CONF=\"$(LXC_USERNIC_CONF)\" \
180 -DDEFAULT_CGROUP_PATTERN=\"$(DEFAULT_CGROUP_PATTERN)\" \
181 -DRUNTIME_PATH=\"$(RUNTIME_PATH)\" \
182 -DSBINDIR=\"$(SBINDIR)\" \
183 -DAPPARMOR_CACHE_DIR=\"$(APPARMOR_CACHE_DIR)\" \
184 -I $(top_srcdir)/src \
185 -I $(top_srcdir)/src/lxc \
186 -I $(top_srcdir)/src/lxc/storage \
187 -I $(top_srcdir)/src/lxc/cgroups
188
189 if ENABLE_APPARMOR
190 AM_CFLAGS += -DHAVE_APPARMOR
191 endif
192
193 if ENABLE_GNUTLS
194 AM_CFLAGS += -DHAVE_LIBGNUTLS
195 endif
196
197 if ENABLE_SECCOMP
198 AM_CFLAGS += -DHAVE_SECCOMP \
199 $(SECCOMP_CFLAGS)
200 endif
201
202 if ENABLE_SELINUX
203 AM_CFLAGS += -DHAVE_SELINUX
204 endif
205
206 if USE_CONFIGPATH_LOGS
207 AM_CFLAGS += -DUSE_CONFIGPATH_LOGS
208 endif
209
210 # build the shared library
211 liblxc_la_CFLAGS = -fPIC \
212 -DPIC \
213 $(AM_CFLAGS) \
214 -pthread
215
216 liblxc_la_LDFLAGS = -pthread \
217 -Wl,-soname,liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) \
218 -version-info @LXC_ABI_MAJOR@
219
220 liblxc_la_LIBADD = $(CAP_LIBS) \
221 $(GNUTLS_LIBS) \
222 $(SELINUX_LIBS) \
223 $(SECCOMP_LIBS)
224
225 bin_SCRIPTS=
226
227 if ENABLE_COMMANDS
228 bin_SCRIPTS += cmd/lxc-checkconfig \
229 cmd/lxc-update-config
230 endif
231
232 if ENABLE_TOOLS
233 bin_PROGRAMS = lxc-attach \
234 lxc-autostart \
235 lxc-cgroup \
236 lxc-checkpoint \
237 lxc-copy \
238 lxc-config \
239 lxc-console \
240 lxc-create \
241 lxc-destroy \
242 lxc-device \
243 lxc-execute \
244 lxc-freeze \
245 lxc-info \
246 lxc-ls \
247 lxc-monitor \
248 lxc-snapshot \
249 lxc-start \
250 lxc-stop \
251 lxc-top \
252 lxc-unfreeze \
253 lxc-unshare \
254 lxc-usernsexec \
255 lxc-wait
256 endif
257
258 if ENABLE_COMMANDS
259 sbin_PROGRAMS = init.lxc
260
261 pkglibexec_PROGRAMS = lxc-monitord \
262 lxc-user-nic
263 endif
264
265 AM_LDFLAGS = -Wl,-E
266
267 if ENABLE_RPATH
268 AM_LDFLAGS += -Wl,-rpath -Wl,$(libdir)
269 endif
270
271 LDADD = liblxc.la \
272 @CAP_LIBS@ \
273 @GNUTLS_LIBS@ \
274 @SECCOMP_LIBS@ \
275 @SELINUX_LIBS@
276
277 if ENABLE_TOOLS
278 lxc_attach_SOURCES = tools/lxc_attach.c \
279 tools/arguments.c tools/arguments.h
280 lxc_autostart_SOURCES = tools/lxc_autostart.c \
281 tools/arguments.c tools/arguments.h
282 lxc_cgroup_SOURCES = tools/lxc_cgroup.c \
283 tools/arguments.c tools/arguments.h
284 lxc_config_SOURCES = tools/lxc_config.c \
285 tools/arguments.c tools/arguments.h
286 lxc_console_SOURCES = tools/lxc_console.c \
287 tools/arguments.c tools/arguments.h
288 lxc_destroy_SOURCES = tools/lxc_destroy.c \
289 tools/arguments.c tools/arguments.h
290 lxc_device_SOURCES = tools/lxc_device.c \
291 tools/arguments.c tools/arguments.h
292 lxc_execute_SOURCES = tools/lxc_execute.c \
293 tools/arguments.c tools/arguments.h
294 lxc_freeze_SOURCES = tools/lxc_freeze.c \
295 tools/arguments.c tools/arguments.h
296 lxc_info_SOURCES = tools/lxc_info.c \
297 tools/arguments.c tools/arguments.h
298 lxc_monitor_SOURCES = tools/lxc_monitor.c \
299 tools/arguments.c tools/arguments.h
300 lxc_ls_SOURCES = tools/lxc_ls.c \
301 tools/arguments.c tools/arguments.h
302 lxc_copy_SOURCES = tools/lxc_copy.c \
303 tools/arguments.c tools/arguments.h
304 lxc_start_SOURCES = tools/lxc_start.c \
305 tools/arguments.c tools/arguments.h
306 lxc_stop_SOURCES = tools/lxc_stop.c \
307 tools/arguments.c tools/arguments.h
308 lxc_top_SOURCES = tools/lxc_top.c \
309 tools/arguments.c tools/arguments.h
310 lxc_unfreeze_SOURCES = tools/lxc_unfreeze.c \
311 tools/arguments.c tools/arguments.h
312 lxc_unshare_SOURCES = tools/lxc_unshare.c \
313 tools/arguments.c tools/arguments.h
314 lxc_wait_SOURCES = tools/lxc_wait.c \
315 tools/arguments.c tools/arguments.h
316 lxc_create_SOURCES = tools/lxc_create.c \
317 tools/arguments.c tools/arguments.h
318 lxc_snapshot_SOURCES = tools/lxc_snapshot.c \
319 tools/arguments.c tools/arguments.h
320 lxc_checkpoint_SOURCES = tools/lxc_checkpoint.c \
321 tools/arguments.c tools/arguments.h
322 endif
323
324 if ENABLE_COMMANDS
325 # Binaries shipping with liblxc
326 init_lxc_SOURCES = cmd/lxc_init.c \
327 string_utils.c string_utils.h
328 lxc_monitord_SOURCES = cmd/lxc_monitord.c
329 lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
330 log.c log.h \
331 namespace.c namespace.h \
332 network.c network.h \
333 parse.c parse.h
334 lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \
335 conf.c conf.h \
336 list.h \
337 log.c log.h \
338 macro.h \
339 namespace.c namespace.h \
340 file_utils.c file_utils.h \
341 string_utils.c string_utils.h \
342 utils.c utils.h
343 endif
344
345
346 if ENABLE_TOOLS
347 if !HAVE_GETSUBOPT
348 lxc_copy_SOURCES += tools/include/getsubopt.c tools/include/getsubopt.h
349 endif
350 endif
351
352 if ENABLE_COMMANDS
353 if HAVE_STATIC_LIBCAP
354 sbin_PROGRAMS += init.lxc.static
355
356 init_lxc_static_SOURCES = cmd/lxc_init.c \
357 caps.c caps.h \
358 error.c error.h \
359 initutils.c initutils.h \
360 file_utils.c file_utils.h \
361 log.c log.h \
362 macro.h \
363 namespace.c namespace.h \
364 string_utils.c string_utils.h
365
366 if !HAVE_GETLINE
367 if HAVE_FGETLN
368 init_lxc_static_SOURCES += ../include/getline.c ../include/getline.h
369 endif
370 endif
371
372 if !HAVE_STRLCPY
373 init_lxc_static_SOURCES += ../include/strlcpy.c ../include/strlcpy.h
374 endif
375
376 if !HAVE_STRLCAT
377 init_lxc_static_SOURCES += ../include/strlcat.c ../include/strlcat.h
378 endif
379
380 init_lxc_static_LDFLAGS = -all-static
381 init_lxc_static_LDADD = @CAP_LIBS@
382 init_lxc_static_CFLAGS = $(AM_CFLAGS) -DNO_LXC_CONF
383 endif
384 endif
385
386 if ENABLE_PAM
387 if HAVE_PAM
388 pam_LTLIBRARIES = pam_cgfs.la
389
390 pam_cgfs_la_SOURCES = pam/pam_cgfs.c \
391 macro.h \
392 file_utils.c file_utils.h \
393 string_utils.c string_utils.h
394
395 if !HAVE_STRLCAT
396 pam_cgfs_la_SOURCES += ../include/strlcat.c ../include/strlcat.h
397 endif
398
399 if !HAVE_STRLCPY
400 pam_cgfs_la_SOURCES += ../include/strlcpy.c ../include/strlcpy.h
401 endif
402
403 pam_cgfs_la_CFLAGS = $(AM_CFLAGS) \
404 -DNO_LOG
405
406 pam_cgfs_la_LIBADD = $(AM_LIBS) \
407 $(PAM_LIBS) \
408 -L$(top_srcdir)
409
410 pam_cgfs_la_LDFLAGS = $(AM_LDFLAGS) \
411 -avoid-version \
412 -module \
413 -shared
414 endif
415 endif
416
417 install-exec-local: install-libLTLIBRARIES
418 mkdir -p $(DESTDIR)$(datadir)/lxc
419 install -c -m 644 lxc.functions $(DESTDIR)$(datadir)/lxc
420 mv $(shell readlink -f $(DESTDIR)$(libdir)/liblxc.so) $(DESTDIR)$(libdir)/liblxc.so.@LXC_ABI@
421 rm -f $(DESTDIR)$(libdir)/liblxc.so $(DESTDIR)$(libdir)/liblxc.so.1
422 cd $(DESTDIR)$(libdir); \
423 ln -sf liblxc.so.@LXC_ABI@ liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)); \
424 ln -sf liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) liblxc.so
425
426 install-exec-hook:
427 chmod u+s $(DESTDIR)$(libexecdir)/lxc/lxc-user-nic
428
429 uninstall-local:
430 $(RM) $(DESTDIR)$(libdir)/liblxc.so*
431 $(RM) $(DESTDIR)$(libdir)/liblxc.a
432 if ENABLE_PAM
433 if HAVE_PAM
434 $(RM) $(DESTDIR)$(pamdir)/pam_cgfs.so*
435
436 install-data-hook: install-pamLTLIBRARIES
437 $(RM) "$(DESTDIR)$(pamdir)/pam_cgfs.la"
438 $(RM) "$(DESTDIR)$(pamdir)/pam_cgfs.a"
439 endif
440 endif