Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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) $(CFLAGS) $(if $(findstring .libos,$@),$(CFLAGS-libos),) -o $@ $< \
  13. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  14. $(cxx_executables): %: %.cpp
  15. @echo [ $@ ]
  16. @$(CC) $(CFLAGS) $(if $(findstring .libos,$@),$(CFLAGS-libos),) -o $@ $< \
  17. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  18. static: %: %.c
  19. @echo [ $@ ]
  20. @$(CC) $(CFLAGS) -o $@ -static $< \
  21. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  22. pie: %: %.c
  23. @echo [ $@ ]
  24. @$(CC) $(CFLAGS) -fPIC --pie -o $@ $< \
  25. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  26. else
  27. .IGNORE: $(special_executables) $(c_executables) $(cxx_executables)
  28. $(special_executables) $(c_executables) $(cxx_executables):
  29. endif