1 # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 include common.mk 6 7 LIBDIR = lib 8 PRELOADNAME = libminijailpreload.so 9 PRELOADPATH = \"/$(LIBDIR)/$(PRELOADNAME)\" 10 CPPFLAGS += -DPRELOADPATH="$(PRELOADPATH)" 11 12 ifneq ($(HAVE_SECUREBITS_H),no) 13 CPPFLAGS += -DHAVE_SECUREBITS_H 14 endif 15 ifneq ($(USE_seccomp),yes) 16 CPPFLAGS += -DUSE_SECCOMP_SOFTFAIL 17 endif 18 19 all: CC_BINARY(minijail0) CC_LIBRARY(libminijail.so) \ 20 CC_LIBRARY(libminijailpreload.so) 21 22 # TODO(jorgelo): convert to TEST(). 23 tests: CC_BINARY(libminijail_unittest) CC_BINARY(syscall_filter_unittest) 24 25 CC_BINARY(minijail0): LDLIBS += -lcap -ldl 26 CC_BINARY(minijail0): libconstants.gen.o libsyscalls.gen.o libminijail.o \ 27 syscall_filter.o signal_handler.o bpf.o util.o elfparse.o minijail0.o 28 clean: CLEAN(minijail0) 29 30 CC_LIBRARY(libminijail.so): LDLIBS += -lcap 31 CC_LIBRARY(libminijail.so): libminijail.o syscall_filter.o signal_handler.o \ 32 bpf.o util.o libconstants.gen.o libsyscalls.gen.o 33 clean: CLEAN(libminijail.so) 34 35 CC_BINARY(libminijail_unittest): LDLIBS += -lcap 36 CC_BINARY(libminijail_unittest): libminijail_unittest.o libminijail.o \ 37 syscall_filter.o signal_handler.o bpf.o util.o libconstants.gen.o \ 38 libsyscalls.gen.o 39 clean: CLEAN(libminijail_unittest) 40 41 CC_LIBRARY(libminijailpreload.so): LDLIBS += -lcap -ldl 42 CC_LIBRARY(libminijailpreload.so): libminijailpreload.o libminijail.o \ 43 libconstants.gen.o libsyscalls.gen.o syscall_filter.o signal_handler.o \ 44 bpf.o util.o 45 clean: CLEAN(libminijailpreload.so) 46 47 CC_BINARY(syscall_filter_unittest): syscall_filter_unittest.o syscall_filter.o \ 48 bpf.o util.o libconstants.gen.o libsyscalls.gen.o 49 clean: CLEAN(syscall_filter_unittest) 50 51 libsyscalls.gen.o: CPPFLAGS += -I$(SRC) 52 53 libsyscalls.gen.o.depends: libsyscalls.gen.c 54 55 # Only regenerate libsyscalls.gen.c if the Makefile or header changes. 56 # NOTE! This will not detect if the file is not appropriate for the target. 57 # TODO(jorgelo): fix generation when 'CC' env variable is not set. 58 libsyscalls.gen.c: $(SRC)/Makefile $(SRC)/libsyscalls.h 59 @printf "Generating target-arch specific $@... " 60 $(QUIET)$(SRC)/gen_syscalls.sh $@ 61 @printf "done.\n" 62 clean: CLEAN(libsyscalls.gen.c) 63 64 $(eval $(call add_object_rules,libsyscalls.gen.o,CC,c,CFLAGS)) 65 66 libconstants.gen.o: CPPFLAGS += -I$(SRC) 67 68 libconstants.gen.o.depends: libconstants.gen.c 69 70 # Only regenerate libconstants.gen.c if the Makefile or header changes. 71 # NOTE! This will not detect if the file is not appropriate for the target. 72 # TODO(jorgelo): fix generation when 'CC' env variable is not set. 73 libconstants.gen.c: $(SRC)/Makefile $(SRC)/libconstants.h 74 @printf "Generating target-arch specific $@... " 75 $(QUIET)$(SRC)/gen_constants.sh $@ 76 @printf "done.\n" 77 clean: CLEAN(libconstants.gen.c) 78 79 $(eval $(call add_object_rules,libconstants.gen.o,CC,c,CFLAGS)) 80