Makefile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. special_executables = bootstrap_static bootstrap_pie shared_object
  2. c_executables = $(filter-out $(special_executables),$(patsubst %.c,%,$(wildcard *.c)))
  3. cxx_executables = $(patsubst %.cpp,%,$(wildcard *.cpp))
  4. manifests = $(patsubst %.manifest.template,%.manifest,$(wildcard *.manifest.template)) manifest
  5. exec_target = $(special_executables) $(c_executables) $(cxx_executables)
  6. target = $(exec_target) $(manifests)
  7. clean-extra += clean-tmp
  8. .PHONY: default
  9. default: all
  10. level = ../
  11. include ../Makefile
  12. CFLAGS-libos = -L../../../build/libos -I../../include
  13. ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
  14. $(c_executables): %: %.c
  15. @echo [ $@ ]
  16. @$(CC) $(CFLAGS) $(if $(findstring .libos,$@),$(CFLAGS-libos),) -o $@ $< \
  17. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  18. $(cxx_executables): %: %.cpp
  19. @echo [ $@ ]
  20. @$(CC) $(CFLAGS) -o $@ $< \
  21. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  22. bootstrap_static: %: %.c
  23. @echo [ $@ ]
  24. @$(CC) $(CFLAGS) -o $@ -static $< \
  25. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  26. bootstrap_pie: %: %.c
  27. @echo [ $@ ]
  28. @$(CC) $(CFLAGS) -fPIC --pie -o $@ $< \
  29. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  30. shared_object: %: %.c
  31. @echo [ $@ ]
  32. @$(CC) $(CFLAGS) -o $@ -fPIC -pie $< \
  33. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  34. else
  35. .IGNORE: $(special_executables) $(c_executables) $(cxx_executables)
  36. $(special_executables) $(c_executables) $(cxx_executables):
  37. endif
  38. PYTHONENV="PYTHONPATH=../../../../Scripts"
  39. ifeq ($(SGX_RUN),1)
  40. PYTHONENV += "TIMEOUT=20000"
  41. endif
  42. .PHONY: regression
  43. regression: $(target)
  44. @echo "\n\nBasic Bootstrapping:"
  45. @for f in $(wildcard 00_*.py); do env $(PYTHONENV) python3 $$f $(RUNTIME)/pal-$(PAL_HOST) || exit $$?; done
  46. @echo "\n\nSyscall Support:"
  47. @for f in $(wildcard 30_*.py); do env $(PYTHONENV) python3 $$f $(RUNTIME)/pal-$(PAL_HOST) || exit $$?; done
  48. @echo "\n\nFile System Support:"
  49. @for f in $(wildcard 40_*.py); do env $(PYTHONENV) python3 $$f $(RUNTIME)/pal-$(PAL_HOST) || exit $$?; done
  50. @echo "\n\nSocket Support:"
  51. @for f in $(wildcard 80_*.py); do env $(PYTHONENV) python3 $$f $(RUNTIME)/pal-$(PAL_HOST) || exit $$?; done
  52. @echo "\n\nLarge File Support:"
  53. @for f in $(wildcard 90_*.py); do env $(PYTHONENV) python3 $$f $(RUNTIME)/pal-$(PAL_HOST) || exit $$?; done
  54. .PHONY: clean-tmp
  55. clean-tmp:
  56. rm -rf *.tmp ../apps/ltp/*.csv *.cached *.manifest.sgx *~ *.sig *.token