Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. CFLAGS-libos = -L../../../build/libos -I../../include
  2. special_executables = static pie
  3. c_executables = $(filter-out $(special_executables),$(patsubst %.c,%,$(wildcard *.c)))
  4. cxx_executables = $(patsubst %.cpp,%,$(wildcard *.cpp))
  5. exec_target = $(special_executables) $(c_executables) $(cxx_executables)
  6. target = $(exec_target) manifest static.manifest pal pal_sec
  7. level = ../
  8. include ../Makefile
  9. manifest: manifest.template
  10. rm -rf $@
  11. cp $@.template $@
  12. %.manifest: %.manifest.template
  13. rm -rf $@
  14. cp $@.template $@
  15. ifeq ($(SYS),x86_64-linux-gnu)
  16. $(c_executables): %: %.c
  17. @echo [ $@ ]
  18. @$(CC) $(CFLAGS) $(if $(findstring .libos,$@),$(CFLAGS-libos),) -o $@ $< \
  19. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  20. $(cxx_executables): %: %.cpp
  21. @echo [ $@ ]
  22. @$(CC) $(CFLAGS) -o $@ $< \
  23. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  24. static: %: %.c
  25. @echo [ $@ ]
  26. @$(CC) $(CFLAGS) -o $@ -static $< \
  27. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  28. pie: %: %.c
  29. @echo [ $@ ]
  30. @$(CC) $(CFLAGS) -fPIC --pie -o $@ $< \
  31. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  32. .PHONY: pack
  33. pack: $(special_executables) $(c_executables) $(cxx_executables)
  34. @../../../../Scripts/pack_binaries.sh test $^
  35. else
  36. $(special_executables) $(c_executables) $(cxx_executables): .packed/test.tar.gz
  37. tar -xmozf $< $@
  38. endif