github.com/kubiko/snapd@v0.0.0-20201013125620-d4f3094d9ddf/cmd/Makefile.am (about) 1 2 EXTRA_DIST = VERSION snap-confine/PORTING 3 CLEANFILES = 4 TESTS = 5 libexec_PROGRAMS = 6 dist_man_MANS = 7 noinst_PROGRAMS = 8 noinst_LIBRARIES = 9 10 CHECK_CFLAGS = -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes \ 11 -Wno-missing-field-initializers -Wno-unused-parameter 12 13 # Make all warnings errors when building for unit tests 14 if WITH_UNIT_TESTS 15 CHECK_CFLAGS += -Werror 16 endif 17 18 subdirs = \ 19 libsnap-confine-private \ 20 snap-confine \ 21 snap-discard-ns \ 22 snap-gdb-shim \ 23 snap-update-ns \ 24 snapd-env-generator \ 25 snapd-generator \ 26 system-shutdown 27 28 # Run check-syntax when checking 29 # TODO: conver those to autotools-style tests later 30 check: check-unit-tests 31 32 # Force particular coding style on all source and header files. 33 .PHONY: check-syntax-c 34 check-syntax-c: 35 echo "WARNING: check-syntax-c produces different results for different version of indent" 36 echo "Your version of indent: `indent --version`" 37 @d=`mktemp -d`; \ 38 trap 'rm -rf $d' EXIT; \ 39 for f in $(foreach dir,$(subdirs),$(wildcard $(srcdir)/$(dir)/*.[ch])) ; do \ 40 out="$$d/`basename $$f.out`"; \ 41 echo "Checking $$f ... "; \ 42 HOME=$(srcdir) indent "$$f" -o "$$out"; \ 43 diff -Naur "$$f" "$$out" || exit 1; \ 44 done; 45 46 .PHONY: check-unit-tests 47 if WITH_UNIT_TESTS 48 check-unit-tests: snap-confine/unit-tests system-shutdown/unit-tests libsnap-confine-private/unit-tests 49 $(HAVE_VALGRIND) ./libsnap-confine-private/unit-tests 50 SNAP_DEVICE_HELPER=$(srcdir)/snap-confine/snap-device-helper $(HAVE_VALGRIND) ./snap-confine/unit-tests 51 $(HAVE_VALGRIND) ./system-shutdown/unit-tests 52 else 53 check-unit-tests: 54 echo "unit tests are disabled (rebuild with --enable-unit-tests)" 55 endif 56 57 new_format = \ 58 libsnap-confine-private/cgroup-support.c \ 59 libsnap-confine-private/cgroup-support.h \ 60 libsnap-confine-private/infofile-test.c \ 61 libsnap-confine-private/infofile.c \ 62 libsnap-confine-private/infofile.h \ 63 libsnap-confine-private/panic-test.h \ 64 libsnap-confine-private/panic.c \ 65 libsnap-confine-private/panic.h \ 66 snap-confine/seccomp-support-ext.c \ 67 snap-confine/seccomp-support-ext.h \ 68 snap-confine/selinux-support.c \ 69 snap-confine/selinux-support.h \ 70 snap-confine/snap-confine-invocation-test.c \ 71 snap-confine/snap-confine-invocation.c \ 72 snap-confine/snap-confine-invocation.h \ 73 snap-discard-ns/snap-discard-ns.c \ 74 snap-gdb-shim/snap-gdb-shim.c \ 75 snap-gdb-shim/snap-gdbserver-shim.c 76 77 # NOTE: clang-format is using project-wide .clang-format file. 78 .PHONY: fmt 79 fmt:: $(filter $(addprefix %,$(new_format)),$(foreach dir,$(subdirs),$(wildcard $(srcdir)/$(dir)/*.[ch]))) 80 clang-format -i $^ 81 82 fmt:: $(filter-out $(addprefix %,$(new_format)),$(foreach dir,$(subdirs),$(wildcard $(srcdir)/$(dir)/*.[ch]))) 83 HOME=$(srcdir) indent $^ 84 85 # The hack target helps developers work on snap-confine on their live system by 86 # installing a fresh copy of snap confine and the appropriate apparmor profile. 87 .PHONY: hack 88 hack: snap-confine/snap-confine-debug snap-confine/snap-confine.apparmor snap-update-ns/snap-update-ns snap-seccomp/snap-seccomp snap-discard-ns/snap-discard-ns 89 sudo install -D -m 4755 snap-confine/snap-confine-debug $(DESTDIR)$(libexecdir)/snap-confine 90 if [ -d /etc/apparmor.d ]; then sudo install -m 644 snap-confine/snap-confine.apparmor $(DESTDIR)/etc/apparmor.d/$(patsubst .%,%,$(subst /,.,$(libexecdir))).snap-confine.real; fi 91 sudo install -d -m 755 $(DESTDIR)/var/lib/snapd/apparmor/snap-confine/ 92 if [ "$$(command -v apparmor_parser)" != "" ]; then sudo apparmor_parser -r snap-confine/snap-confine.apparmor; fi 93 sudo install -m 755 snap-update-ns/snap-update-ns $(DESTDIR)$(libexecdir)/snap-update-ns 94 sudo install -m 755 snap-discard-ns/snap-discard-ns $(DESTDIR)$(libexecdir)/snap-discard-ns 95 sudo install -m 755 snap-seccomp/snap-seccomp $(DESTDIR)$(libexecdir)/snap-seccomp 96 if [ "$$(command -v restorecon)" != "" ]; then sudo restorecon -R -v $(DESTDIR)$(libexecdir)/; fi 97 98 # for the hack target also: 99 snap-update-ns/snap-update-ns: snap-update-ns/*.go snap-update-ns/*.[ch] 100 cd snap-update-ns && GOPATH=$(or $(GOPATH),$(realpath $(srcdir)/../../../../..)) go build -v 101 snap-seccomp/snap-seccomp: snap-seccomp/*.go 102 cd snap-seccomp && GOPATH=$(or $(GOPATH),$(realpath $(srcdir)/../../../../..)) go build -v 103 104 ## 105 ## libsnap-confine-private.a 106 ## 107 108 noinst_LIBRARIES += libsnap-confine-private.a 109 110 libsnap_confine_private_a_SOURCES = \ 111 libsnap-confine-private/apparmor-support.c \ 112 libsnap-confine-private/apparmor-support.h \ 113 libsnap-confine-private/cgroup-freezer-support.c \ 114 libsnap-confine-private/cgroup-freezer-support.h \ 115 libsnap-confine-private/cgroup-support.c \ 116 libsnap-confine-private/cgroup-support.h \ 117 libsnap-confine-private/classic.c \ 118 libsnap-confine-private/classic.h \ 119 libsnap-confine-private/cleanup-funcs.c \ 120 libsnap-confine-private/cleanup-funcs.h \ 121 libsnap-confine-private/error.c \ 122 libsnap-confine-private/error.h \ 123 libsnap-confine-private/fault-injection.c \ 124 libsnap-confine-private/fault-injection.h \ 125 libsnap-confine-private/feature.c \ 126 libsnap-confine-private/feature.h \ 127 libsnap-confine-private/infofile.c \ 128 libsnap-confine-private/locking.c \ 129 libsnap-confine-private/locking.h \ 130 libsnap-confine-private/mount-opt.c \ 131 libsnap-confine-private/mount-opt.h \ 132 libsnap-confine-private/mountinfo.c \ 133 libsnap-confine-private/mountinfo.h \ 134 libsnap-confine-private/panic.c \ 135 libsnap-confine-private/panic.h \ 136 libsnap-confine-private/privs.c \ 137 libsnap-confine-private/privs.h \ 138 libsnap-confine-private/secure-getenv.c \ 139 libsnap-confine-private/secure-getenv.h \ 140 libsnap-confine-private/snap.c \ 141 libsnap-confine-private/snap.h \ 142 libsnap-confine-private/string-utils.c \ 143 libsnap-confine-private/string-utils.h \ 144 libsnap-confine-private/tool.c \ 145 libsnap-confine-private/tool.h \ 146 libsnap-confine-private/utils.c \ 147 libsnap-confine-private/utils.h 148 libsnap_confine_private_a_CFLAGS = $(CHECK_CFLAGS) 149 150 noinst_LIBRARIES += libsnap-confine-private-debug.a 151 libsnap_confine_private_debug_a_SOURCES = $(libsnap_confine_private_a_SOURCES) 152 libsnap_confine_private_debug_a_CFLAGS = $(CHECK_CFLAGS) -DSNAP_CONFINE_DEBUG_BUILD=1 153 154 if WITH_UNIT_TESTS 155 noinst_PROGRAMS += libsnap-confine-private/unit-tests 156 libsnap_confine_private_unit_tests_SOURCES = \ 157 libsnap-confine-private/classic-test.c \ 158 libsnap-confine-private/cleanup-funcs-test.c \ 159 libsnap-confine-private/error-test.c \ 160 libsnap-confine-private/fault-injection-test.c \ 161 libsnap-confine-private/feature-test.c \ 162 libsnap-confine-private/infofile-test.c \ 163 libsnap-confine-private/locking-test.c \ 164 libsnap-confine-private/mount-opt-test.c \ 165 libsnap-confine-private/mountinfo-test.c \ 166 libsnap-confine-private/panic-test.c \ 167 libsnap-confine-private/privs-test.c \ 168 libsnap-confine-private/secure-getenv-test.c \ 169 libsnap-confine-private/snap-test.c \ 170 libsnap-confine-private/string-utils-test.c \ 171 libsnap-confine-private/test-utils-test.c \ 172 libsnap-confine-private/test-utils.c \ 173 libsnap-confine-private/unit-tests-main.c \ 174 libsnap-confine-private/unit-tests.c \ 175 libsnap-confine-private/unit-tests.h \ 176 libsnap-confine-private/utils-test.c 177 libsnap_confine_private_unit_tests_CFLAGS = $(CHECK_CFLAGS) $(GLIB_CFLAGS) 178 libsnap_confine_private_unit_tests_LDADD = $(GLIB_LIBS) 179 libsnap_confine_private_unit_tests_CFLAGS += -D_ENABLE_FAULT_INJECTION 180 libsnap_confine_private_unit_tests_STATIC = 181 182 if STATIC_LIBCAP 183 libsnap_confine_private_unit_tests_STATIC += -lcap 184 else 185 libsnap_confine_private_unit_tests_LDADD += -lcap 186 endif # STATIC_LIBCAP 187 188 # Use a hacked rule if we're doing static build. This allows us to inject the LIBS += .. rule below. 189 libsnap-confine-private/unit-tests$(EXEEXT): $(libsnap_confine_private_unit_tests_OBJECTS) $(libsnap_confine_private_unit_tests_DEPENDENCIES) $(EXTRA_libsnap_confine_private_unit_tests_DEPENDENCIES) libsnap-confine-private/$(am__dirstamp) 190 @rm -f libsnap-confine-private/unit-tests$(EXEEXT) 191 $(AM_V_CCLD)$(libsnap_confine_private_unit_tests_LINK) $(libsnap_confine_private_unit_tests_OBJECTS) $(libsnap_confine_private_unit_tests_LDADD) $(LIBS) 192 193 libsnap-confine-private/unit-tests$(EXEEXT): LIBS += -Wl,-Bstatic $(libsnap_confine_private_unit_tests_STATIC) -Wl,-Bdynamic 194 endif # WITH_UNIT_TESTS 195 196 ## 197 ## decode-mount-opts 198 ## 199 200 noinst_PROGRAMS += decode-mount-opts/decode-mount-opts 201 202 decode_mount_opts_decode_mount_opts_SOURCES = \ 203 decode-mount-opts/decode-mount-opts.c 204 decode_mount_opts_decode_mount_opts_LDADD = libsnap-confine-private.a 205 decode_mount_opts_decode_mount_opts_STATIC = 206 207 if STATIC_LIBCAP 208 decode_mount_opts_decode_mount_opts_STATIC += -lcap 209 else 210 decode_mount_opts_decode_mount_opts_LDADD += -lcap 211 endif # STATIC_LIBCAP 212 213 # XXX: this makes automake generate decode_mount_opts_decode_mount_opts_LINK 214 decode_mount_opts_decode_mount_opts_CFLAGS = -D_fake 215 216 # Use a hacked rule if we're doing static build. This allows us to inject the LIBS += .. rule below. 217 decode-mount-opts/decode-mount-opts$(EXEEXT): $(decode_mount_opts_decode_mount_opts_OBJECTS) $(decode_mount_opts_decode_mount_opts_DEPENDENCIES) $(EXTRA_decode_mount_opts_decode_mount_opts_DEPENDENCIES) libsnap-confine-private/$(am__dirstamp) 218 @rm -f decode-mount-opts/decode-mount-opts$(EXEEXT) 219 $(AM_V_CCLD)$(decode_mount_opts_decode_mount_opts_LINK) $(decode_mount_opts_decode_mount_opts_OBJECTS) $(decode_mount_opts_decode_mount_opts_LDADD) $(LIBS) 220 221 decode-mount-opts/decode-mount-opts$(EXEEXT): LIBS += -Wl,-Bstatic $(decode_mount_opts_decode_mount_opts_STATIC) -Wl,-Bdynamic 222 223 ## 224 ## snap-confine 225 ## 226 227 libexec_PROGRAMS += snap-confine/snap-confine 228 if HAVE_RST2MAN 229 dist_man_MANS += snap-confine/snap-confine.8 230 CLEANFILES += snap-confine/snap-confine.8 231 endif 232 EXTRA_DIST += snap-confine/snap-confine.rst 233 EXTRA_DIST += snap-confine/snap-confine.apparmor.in 234 235 snap_confine_snap_confine_SOURCES = \ 236 snap-confine/cookie-support.c \ 237 snap-confine/cookie-support.h \ 238 snap-confine/mount-support-nvidia.c \ 239 snap-confine/mount-support-nvidia.h \ 240 snap-confine/mount-support.c \ 241 snap-confine/mount-support.h \ 242 snap-confine/ns-support.c \ 243 snap-confine/ns-support.h \ 244 snap-confine/seccomp-support-ext.c \ 245 snap-confine/seccomp-support-ext.h \ 246 snap-confine/seccomp-support.c \ 247 snap-confine/seccomp-support.h \ 248 snap-confine/snap-confine-args.c \ 249 snap-confine/snap-confine-args.h \ 250 snap-confine/snap-confine-invocation.c \ 251 snap-confine/snap-confine-invocation.h \ 252 snap-confine/snap-confine.c \ 253 snap-confine/udev-support.c \ 254 snap-confine/udev-support.h \ 255 snap-confine/user-support.c \ 256 snap-confine/user-support.h 257 258 snap_confine_snap_confine_CFLAGS = $(CHECK_CFLAGS) $(AM_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -DNATIVE_LIBDIR=\"$(libdir)\" 259 snap_confine_snap_confine_LDFLAGS = $(AM_LDFLAGS) 260 snap_confine_snap_confine_LDADD = libsnap-confine-private.a 261 snap_confine_snap_confine_CFLAGS += $(LIBUDEV_CFLAGS) 262 snap_confine_snap_confine_LDADD += $(snap_confine_snap_confine_extra_libs) 263 # _STATIC is where we collect statically linked in libraries 264 snap_confine_snap_confine_STATIC = 265 # use a separate variable instead of snap_confine_snap_confine_LDADD to collect 266 # all external libraries, this way it can be reused in 267 # snap_confine_snap_confine_debug_LDADD withouth applying any text 268 # transformations 269 snap_confine_snap_confine_extra_libs = $(LIBUDEV_LIBS) 270 271 if STATIC_LIBCAP 272 snap_confine_snap_confine_STATIC += -lcap 273 else 274 snap_confine_snap_confine_extra_libs += -lcap 275 endif # STATIC_LIBCAP 276 277 # Use a hacked rule if we're doing static build. This allows us to inject the LIBS += .. rule below. 278 snap-confine/snap-confine$(EXEEXT): $(snap_confine_snap_confine_OBJECTS) $(snap_confine_snap_confine_DEPENDENCIES) $(EXTRA_snap_confine_snap_confine_DEPENDENCIES) libsnap-confine-private/$(am__dirstamp) 279 @rm -f snap-confine/snap-confine$(EXEEXT) 280 $(AM_V_CCLD)$(snap_confine_snap_confine_LINK) $(snap_confine_snap_confine_OBJECTS) $(snap_confine_snap_confine_LDADD) $(LIBS) 281 282 snap-confine/snap-confine$(EXEEXT): LIBS += -Wl,-Bstatic $(snap_confine_snap_confine_STATIC) -Wl,-Bdynamic -pthread 283 284 # This is here to help fix rpmlint hardening issue. 285 # https://en.opensuse.org/openSUSE:Packaging_checks#non-position-independent-executable 286 snap_confine_snap_confine_CFLAGS += $(SUID_CFLAGS) 287 snap_confine_snap_confine_LDFLAGS += $(SUID_LDFLAGS) 288 289 if APPARMOR 290 snap_confine_snap_confine_CFLAGS += $(APPARMOR_CFLAGS) 291 if STATIC_LIBAPPARMOR 292 snap_confine_snap_confine_STATIC += $(shell $(PKG_CONFIG) --static --libs libapparmor) 293 else 294 snap_confine_snap_confine_extra_libs += $(APPARMOR_LIBS) 295 endif # STATIC_LIBAPPARMOR 296 endif # APPARMOR 297 298 if SELINUX 299 snap_confine_snap_confine_SOURCES += \ 300 snap-confine/selinux-support.c \ 301 snap-confine/selinux-support.h 302 snap_confine_snap_confine_CFLAGS += $(SELINUX_CFLAGS) 303 if STATIC_LIBSELINUX 304 snap_confine_snap_confine_STATIC += $(shell $(PKG_CONFIG) --static --libs libselinux) 305 else 306 snap_confine_snap_confine_extra_libs += $(SELINUX_LIBS) 307 endif # STATIC_LIBSELINUX 308 endif # SELINUX 309 310 # an extra build that has additional debugging enabled at compile time 311 312 noinst_PROGRAMS += snap-confine/snap-confine-debug 313 snap_confine_snap_confine_debug_SOURCES = $(snap_confine_snap_confine_SOURCES) 314 snap_confine_snap_confine_debug_CFLAGS = $(snap_confine_snap_confine_CFLAGS) 315 snap_confine_snap_confine_debug_LDFLAGS = $(snap_confine_snap_confine_LDFLAGS) 316 snap_confine_snap_confine_debug_LDADD = libsnap-confine-private-debug.a $(snap_confine_snap_confine_extra_libs) 317 snap_confine_snap_confine_debug_CFLAGS += -DSNAP_CONFINE_DEBUG_BUILD=1 318 snap_confine_snap_confine_debug_STATIC = $(snap_confine_snap_confine_STATIC) 319 320 # Use a hacked rule if we're doing static build. This allows us to inject the LIBS += .. rule below. 321 snap-confine/snap-confine-debug$(EXEEXT): $(snap_confine_snap_confine_debug_OBJECTS) $(snap_confine_snap_confine_debug_DEPENDENCIES) $(EXTRA_snap_confine_snap_confine_debug_DEPENDENCIES) libsnap-confine-private/$(am__dirstamp) 322 @rm -f snap-confine/snap-confine-debug$(EXEEXT) 323 $(AM_V_CCLD)$(snap_confine_snap_confine_debug_LINK) $(snap_confine_snap_confine_debug_OBJECTS) $(snap_confine_snap_confine_debug_LDADD) $(LIBS) 324 325 snap-confine/snap-confine-debug$(EXEEXT): LIBS += -Wl,-Bstatic $(snap_confine_snap_confine_debug_STATIC) -Wl,-Bdynamic -pthread 326 327 if WITH_UNIT_TESTS 328 noinst_PROGRAMS += snap-confine/unit-tests 329 snap_confine_unit_tests_SOURCES = \ 330 libsnap-confine-private/test-utils.c \ 331 libsnap-confine-private/unit-tests-main.c \ 332 libsnap-confine-private/unit-tests.c \ 333 libsnap-confine-private/unit-tests.h \ 334 snap-confine/cookie-support-test.c \ 335 snap-confine/mount-support-test.c \ 336 snap-confine/ns-support-test.c \ 337 snap-confine/snap-confine-args-test.c \ 338 snap-confine/snap-confine-invocation-test.c \ 339 snap-confine/snap-device-helper-test.c 340 snap_confine_unit_tests_CFLAGS = $(snap_confine_snap_confine_CFLAGS) $(GLIB_CFLAGS) 341 snap_confine_unit_tests_LDADD = $(snap_confine_snap_confine_LDADD) $(GLIB_LIBS) 342 snap_confine_unit_tests_LDFLAGS = $(snap_confine_snap_confine_LDFLAGS) 343 snap_confine_unit_tests_STATIC = $(snap_confine_snap_confine_STATIC) 344 345 # Use a hacked rule if we're doing static build. This allows us to inject the LIBS += .. rule below. 346 snap-confine/unit-tests$(EXEEXT): $(snap_confine_unit_tests_OBJECTS) $(snap_confine_unit_tests_DEPENDENCIES) $(EXTRA_snap_confine_unit_tests_DEPENDENCIES) libsnap-confine-private/$(am__dirstamp) 347 @rm -f snap-confine/unit-tests$(EXEEXT) 348 $(AM_V_CCLD)$(snap_confine_unit_tests_LINK) $(snap_confine_unit_tests_OBJECTS) $(snap_confine_unit_tests_LDADD) $(LIBS) 349 350 snap-confine/unit-tests$(EXEEXT): LIBS += -Wl,-Bstatic $(snap_confine_unit_tests_STATIC) -Wl,-Bdynamic -pthread 351 endif # WITH_UNIT_TESTS 352 353 if HAVE_RST2MAN 354 %.8: %.rst 355 $(HAVE_RST2MAN) $^ > $@ 356 endif 357 358 snap-confine/snap-confine.apparmor: snap-confine/snap-confine.apparmor.in Makefile 359 sed -e 's,[@]LIBEXECDIR[@],$(libexecdir),g' -e 's,[@]SNAP_MOUNT_DIR[@],$(SNAP_MOUNT_DIR),g' <$< >$@ 360 361 # Install the apparmor profile 362 # 363 # NOTE: the funky make functions here just convert /foo/bar/froz into 364 # foo.bar.froz The inner subst replaces slashes with dots and the outer 365 # patsubst strips the leading dot 366 install-data-local:: snap-confine/snap-confine.apparmor 367 if APPARMOR 368 install -d -m 755 $(DESTDIR)/etc/apparmor.d/ 369 install -m 644 snap-confine/snap-confine.apparmor $(DESTDIR)/etc/apparmor.d/$(patsubst .%,%,$(subst /,.,$(libexecdir))).snap-confine 370 endif 371 install -d -m 755 $(DESTDIR)/var/lib/snapd/apparmor/snap-confine/ 372 373 # NOTE: The 'void' directory *has to* be chmod 111 374 install-data-local:: 375 install -d -m 111 $(DESTDIR)/var/lib/snapd/void 376 377 install-exec-hook:: 378 # Ensure that snap-confine is u+s (setuid) 379 chmod 4755 $(DESTDIR)$(libexecdir)/snap-confine 380 381 ## 382 ## snap-mgmt 383 ## 384 385 libexec_SCRIPTS = snap-mgmt/snap-mgmt 386 CLEANFILES += snap-mgmt/$(am__dirstamp) snap-mgmt/snap-mgmt 387 388 snap-mgmt/$(am__dirstamp): 389 mkdir -p $$(dirname $@) 390 touch $@ 391 392 snap-mgmt/snap-mgmt: snap-mgmt/snap-mgmt.sh.in Makefile snap-mgmt/$(am__dirstamp) 393 sed -e 's,[@]SNAP_MOUNT_DIR[@],$(SNAP_MOUNT_DIR),' <$< >$@ 394 395 if SELINUX 396 ## 397 ## snap-mgmt-selinux 398 ## 399 400 libexec_SCRIPTS += snap-mgmt/snap-mgmt-selinux 401 CLEANFILES += snap-mgmt/$(am__dirstamp) snap-mgmt/snap-mgmt-selinux 402 403 snap-mgmt/snap-mgmt-selinux: snap-mgmt/snap-mgmt-selinux.sh.in Makefile snap-mgmt/$(am__dirstamp) 404 sed -e 's,[@]SNAP_MOUNT_DIR[@],$(SNAP_MOUNT_DIR),' <$< >$@ 405 endif 406 407 ## 408 ## ubuntu-core-launcher 409 ## 410 411 install-exec-hook:: 412 install -d -m 755 $(DESTDIR)$(bindir) 413 ln -sf $(libexecdir)/snap-confine $(DESTDIR)$(bindir)/ubuntu-core-launcher 414 415 ## 416 ## snap-device-helper 417 ## 418 419 EXTRA_DIST += \ 420 snap-confine/snap-device-helper 421 422 # NOTE: This makes distcheck fail but it is required for udev, so go figure. 423 # http://www.gnu.org/software/automake/manual/automake.html#Hard_002dCoded-Install-Paths 424 # 425 # Install support script for udev rules 426 install-exec-local:: 427 install -d -m 755 $(DESTDIR)$(libexecdir) 428 install -m 755 $(srcdir)/snap-confine/snap-device-helper $(DESTDIR)$(libexecdir) 429 430 ## 431 ## snap-discard-ns 432 ## 433 434 libexec_PROGRAMS += snap-discard-ns/snap-discard-ns 435 if HAVE_RST2MAN 436 dist_man_MANS += snap-discard-ns/snap-discard-ns.8 437 CLEANFILES += snap-discard-ns/snap-discard-ns.8 438 endif 439 EXTRA_DIST += snap-discard-ns/snap-discard-ns.rst 440 441 snap_discard_ns_snap_discard_ns_SOURCES = \ 442 snap-discard-ns/snap-discard-ns.c 443 snap_discard_ns_snap_discard_ns_CFLAGS = $(CHECK_CFLAGS) $(AM_CFLAGS) 444 snap_discard_ns_snap_discard_ns_LDFLAGS = $(AM_LDFLAGS) 445 snap_discard_ns_snap_discard_ns_LDADD = libsnap-confine-private.a 446 snap_discard_ns_snap_discard_ns_STATIC = 447 448 # Use a hacked rule if we're doing static build. This allows us to inject the LIBS += .. rule below. 449 snap-discard-ns/snap-discard-ns$(EXEEXT): $(snap_discard_ns_snap_discard_ns_OBJECTS) $(snap_discard_ns_snap_discard_ns_DEPENDENCIES) $(EXTRA_snap_discard_ns_snap_discard_ns_DEPENDENCIES) snap-discard-ns/$(am__dirstamp) 450 @rm -f snap-discard-ns/snap-discard-ns$(EXEEXT) 451 $(AM_V_CCLD)$(snap_discard_ns_snap_discard_ns_LINK) $(snap_discard_ns_snap_discard_ns_OBJECTS) $(snap_discard_ns_snap_discard_ns_LDADD) $(LIBS) 452 453 snap-discard-ns/snap-discard-ns$(EXEEXT): LIBS += -Wl,-Bstatic $(snap_discard_ns_snap_discard_ns_STATIC) -Wl,-Bdynamic -pthread 454 455 ## 456 ## system-shutdown 457 ## 458 459 libexec_PROGRAMS += system-shutdown/system-shutdown 460 461 system_shutdown_system_shutdown_SOURCES = \ 462 system-shutdown/system-shutdown-utils.c \ 463 system-shutdown/system-shutdown-utils.h \ 464 system-shutdown/system-shutdown.c 465 system_shutdown_system_shutdown_LDADD = libsnap-confine-private.a 466 system_shutdown_system_shutdown_CFLAGS = $(CHECK_CFLAGS) $(filter-out -fPIE -pie,$(CFLAGS)) -static 467 system_shutdown_system_shutdown_LDFLAGS = $(filter-out -fPIE -pie,$(LDFLAGS)) -static 468 469 if WITH_UNIT_TESTS 470 noinst_PROGRAMS += system-shutdown/unit-tests 471 system_shutdown_unit_tests_SOURCES = \ 472 libsnap-confine-private/unit-tests-main.c \ 473 libsnap-confine-private/unit-tests.c \ 474 system-shutdown/system-shutdown-utils-test.c 475 system_shutdown_unit_tests_LDADD = libsnap-confine-private.a 476 system_shutdown_unit_tests_CFLAGS = $(GLIB_CFLAGS) 477 system_shutdown_unit_tests_LDADD += $(GLIB_LIBS) 478 endif 479 480 ## 481 ## snap-gdb-shim 482 ## 483 484 libexec_PROGRAMS += snap-gdb-shim/snap-gdb-shim 485 486 snap_gdb_shim_snap_gdb_shim_SOURCES = \ 487 snap-gdb-shim/snap-gdb-shim.c 488 489 snap_gdb_shim_snap_gdb_shim_LDADD = libsnap-confine-private.a 490 491 ## 492 ## snap-gdbserver-shim 493 ## 494 495 libexec_PROGRAMS += snap-gdb-shim/snap-gdbserver-shim 496 497 snap_gdb_shim_snap_gdbserver_shim_SOURCES = \ 498 snap-gdb-shim/snap-gdbserver-shim.c 499 500 snap_gdb_shim_snap_gdbserver_shim_LDADD = libsnap-confine-private.a 501 502 ## 503 ## snapd-generator 504 ## 505 506 systemdsystemgeneratordir = $(SYSTEMD_SYSTEM_GENERATOR_DIR) 507 systemdsystemgenerator_PROGRAMS = snapd-generator/snapd-generator 508 509 snapd_generator_snapd_generator_SOURCES = snapd-generator/main.c 510 snapd_generator_snapd_generator_LDADD = libsnap-confine-private.a 511 512 ## 513 ## snapd-env-generator 514 ## 515 516 systemdsystemenvgeneratordir=$(SYSTEMD_SYSTEM_ENV_GENERATOR_DIR) 517 systemdsystemenvgenerator_PROGRAMS = snapd-env-generator/snapd-env-generator 518 519 snapd_env_generator_snapd_env_generator_SOURCES = snapd-env-generator/main.c 520 snapd_env_generator_snapd_env_generator_LDADD = libsnap-confine-private.a 521 EXTRA_DIST += snapd-env-generator/snapd-env-generator.rst 522 523 if HAVE_RST2MAN 524 dist_man_MANS += snapd-env-generator/snapd-env-generator.8 525 CLEANFILES += snapd-env-generator/snapd-env-generator.8 526 endif 527 528 ## 529 ## snapd-apparmor 530 ## 531 532 EXTRA_DIST += snapd-apparmor/snapd-apparmor 533 534 install-exec-local:: 535 install -d -m 755 $(DESTDIR)$(libexecdir) 536 if APPARMOR 537 install -m 755 $(srcdir)/snapd-apparmor/snapd-apparmor $(DESTDIR)$(libexecdir) 538 endif