Makefile (1571B)
1 CFLAGS ?= -Wall -std=c99 2 INCLUDE := -I./include/ 3 DESTDIR ?= /usr/local 4 PREFIX := libpsaff 5 BUILDDIR ?= bin 6 7 .PHONY: all install test uninstall run docker ci 8 9 all: libpsaff.so 10 11 libpsaff.so: 12 $(CC) $(INCLUDE) $(CFLAGS) -c -fpic src/common.c -o common.o 13 $(CC) $(INCLUDE) $(CFLAGS) -c -fpic src/client.c -o client.o 14 $(CC) $(INCLUDE) $(CFLAGS) -c -fpic src/service.c -o server.o 15 $(CC) -shared -o libpsaff.so common.o client.o server.o 16 17 ifeq ($(DEBUG),1) 18 CFLAGS += -DDEBUG -g 19 endif 20 21 clean: 22 rm -rf $(BUILDDIR) 23 rm -f *.so *.o 24 rm -rf test/*dSYM 25 cd test && make clean 26 27 test: 28 cd test && make 29 30 test/partition: 31 cd test && make 32 33 run: test/partition 34 pkill partition || true 35 pkill client || true 36 ipcs | grep q | awk '{ printf " -q " $$2 }' | xargs ipcrm > /dev/null 2>&1 || true 37 (sleep 3 && ./test/client)& 38 ./test/partition 39 40 ci: 41 pkill client || true 42 ipcs | grep q | awk '{ printf " -q " $$2 }' | xargs ipcrm > /dev/null 2>&1 || true 43 ./test/partition 2>&1 & 44 sleep 3 && ./test/client 45 pkill partition || true 46 47 docker: 48 @docker run --rm -ti -v $$PWD:/opt --entrypoint /bin/bash ubuntu \ 49 -c "cd /opt && ls && apt-get update -qq && apt install \ 50 -y gcc make gdb python -qq && make clean && make install && make test && ldconfig && make run" 51 52 install: libpsaff.so 53 mkdir -p $(DESTDIR)/lib 54 mkdir -p $(DESTDIR)/include 55 cp libpsaff.so $(DESTDIR)/lib/ 56 cp -r include/* $(DESTDIR)/include/ 57 cp tools/psa_autogen /usr/local/bin/ 58 59 uninstall: 60 rm $(DESTDIR)/lib/libpsaff.so 61 rm -rf $(DESTDIR)/include/psa 62 rm -rf $(DESTDIR)/include/psasim 63 rm -f /usr/local/bin/psa_autogen 64