Makefile 1.3 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. ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
  10. $(c_executables): %: %.c
  11. @echo [ $@ ]
  12. @$(CC) -MD -MP $(CFLAGS) $(if $(findstring .libos,$@),$(CFLAGS-libos),) -o $@ $< \
  13. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  14. $(cxx_executables): %: %.cpp
  15. @echo [ $@ ]
  16. @$(CXX) -MD -MP $(CXXFLAGS) $(if $(findstring .libos,$@),$(CFLAGS-libos),) -o $@ $< \
  17. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  18. static: %: %.c
  19. @echo [ $@ ]
  20. @$(CC) -MD -MP $(CFLAGS) -o $@ -static $< \
  21. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  22. pie: %: %.c
  23. @echo [ $@ ]
  24. @$(CC) -MD -MP $(CFLAGS) -fPIC --pie -o $@ $< \
  25. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  26. include $(wildcard *.d)
  27. else
  28. .IGNORE: $(special_executables) $(c_executables) $(cxx_executables)
  29. $(special_executables) $(c_executables) $(cxx_executables):
  30. endif