Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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)) manifest
  5. exec_target = $(special_executables) $(c_executables) $(cxx_executables) ls.manifest
  6. target = $(exec_target) $(manifests)
  7. level = ../
  8. include ../Makefile
  9. CFLAGS-libos = -I$(SHIMDIR)/../include -L$(SHIMDIR)/../../glibc-build/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. else
  28. .IGNORE: $(special_executables) $(c_executables) $(cxx_executables)
  29. $(special_executables) $(c_executables) $(cxx_executables):
  30. endif