playground

Sandbox, container or whatever utilities for linux.
git clone https://pi.duncano.de/git/playground.git

Makefile (1082B)


      1 .error : This Makefile needs GNU make
      2 include config.mk
      3 
      4 PROGS = pledge # newns
      5 LIBS = libpledge # libnewns
      6 ALL = $(LIBS:=.a) $(LIBS:=.so) $(PROGS)
      7 
      8 all: options $(ALL)
      9 
     10 $(PROGS) : % : %.o
     11 $(LIBS:=.a) : %.a : %.o
     12 $(LIBS:=.so) : %.so : %.o
     13 
     14 libpledge.o : include/pledge_syscalls.h include/seccomp_bpf_utils.h
     15 libpledge.o pledge.o : include/pledge.h
     16 
     17 pledge: libpledge.a
     18 # newns: libnewns.a
     19 
     20 pledge:
     21 	$(CC) $^ -o $@ $(LDFLAGS)
     22 
     23 # newns:
     24 # 	$(CC) $^ -o $@ $(LDFLAGS)
     25 
     26 %.a:
     27 	ar rc $@ $^
     28 
     29 %.so:
     30 
     31 options:
     32 	@echo "CFLAGS  = ${CFLAGS}"
     33 	@echo "LDFLAGS = ${LDFLAGS}"
     34 	@echo "CC      = ${CC}"
     35 
     36 tests:
     37 	make -C tests/pledge
     38 
     39 clean:
     40 	-rm -f $(ALL) *.o
     41 
     42 install: all
     43 	mkdir -p $(DESTDIR)$(BINDIR) \
     44 		$(DESTDIR)$(LIBDIR) \
     45 		$(DESTDIR)$(INCDIR)
     46 	install -m0644 libpledge.a libpledge.so $(DESTDIR)$(LIBDIR)
     47 	install -m0644 include/pledge.h $(DESTDIR)$(INCDIR)
     48 	install -m0755 pledge $(DESTDIR)$(BINDIR)
     49 	# install -m0755 newns $(DESTDIR)$(BINDIR)
     50 	# install -m0644 libnewns.a libnewns.so $(DESTDIR)$(LIBDIR)
     51 	# install -m0644 newns.h $(DESTDIR)$(INCDIR)
     52 
     53 .PHONY: all options tests clean install