1 DEF_CFLAGS = -g -O3 -Wall -Werror -Wextra -Wno-missing-field-initializers -fPIC -I. 2 DEF_CPPFLAGS = -D_GNU_SOURCE -DSECCOMP_BPF_STANDALONE -iquote ../../.. 3 DEF_LDFLAGS = -g -lpthread 4 DEPFLAGS = -MMD -MF .$@.d 5 MODS := demo sandbox_bpf basicblock codegen die errorcode syscall syscall_iterator trap verifier 6 OBJS64 := $(shell echo ${MODS} | xargs -n 1 | sed -e 's/$$/.o64/') 7 OBJS32 := $(shell echo ${MODS} | xargs -n 1 | sed -e 's/$$/.o32/') 8 ALL_OBJS = $(OBJS32) $(OBJS64) 9 DEP_FILES = $(wildcard $(foreach f,$(ALL_OBJS),.$(f).d)) 10 11 .SUFFIXES: .o64 .o32 12 13 all: demo32 demo64 14 15 clean: 16 $(RM) demo32 demo64 17 $(RM) *.o *.o32 *.o64 .*.d 18 $(RM) core core.* vgcore vgcore.* strace.log* 19 20 -include $(DEP_FILES) 21 22 demo32: ${OBJS32} 23 ${CXX} -m32 -o $@ $+ ${DEF_LDFLAGS} ${LDFLAGS} 24 demo64: ${OBJS64} 25 ${CXX} -m64 -o $@ $+ ${DEF_LDFLAGS} ${LDFLAGS} 26 27 .cc.o32: 28 ${CXX} -m32 ${DEF_CFLAGS} ${DEF_CPPFLAGS} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -c -o $@ $< 29 .cc.o64: 30 ${CXX} -m64 ${DEF_CFLAGS} ${DEF_CPPFLAGS} ${CFLAGS} ${CPPFLAGS} ${DEPFLAGS} -c -o $@ $< 31