Makefile 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. special_executables = bootstrap_static bootstrap_pie shared_object openmp
  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. @$(CXX) $(CXXFLAGS) -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. syscall: CFLAGS += -I$(PALDIR)/../include -I$(PALDIR)/host/$(PAL_HOST)
  35. openmp: %: %.c
  36. @echo [ $@ ]
  37. @$(CC) $(CFLAGS) -o $@ -fopenmp $< \
  38. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  39. else
  40. .IGNORE: $(special_executables) $(c_executables) $(cxx_executables)
  41. $(special_executables) $(c_executables) $(cxx_executables):
  42. endif
  43. export PAL_LOADER = $(RUNTIME)/pal-$(PAL_HOST)
  44. export PAL_SEC = $(RUNTIME)/pal_sec-$(PAL_HOST)
  45. export PYTHONPATH=../../../../Scripts
  46. .PHONY: regression
  47. regression: $(target)
  48. $(RM) libos-regression.xml
  49. $(MAKE) libos-regression.xml
  50. libos-regression.xml:
  51. python3 -m pytest --junit-xml $@ -v test_libos.py
  52. .PHONY: clean-tmp
  53. clean-tmp:
  54. rm -rf *.tmp ../apps/ltp/*.csv *.cached *.manifest.sgx *~ *.sig *.token