Makefile 1.3 KB

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