Makefile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. include ../../Scripts/Makefile.configs
  2. include ../../Scripts/Makefile.rules
  3. CFLAGS += -fno-builtin -nostdlib -no-pie \
  4. -I../include/pal -I../include/lib
  5. executables = \
  6. HelloWorld \
  7. File \
  8. Failure \
  9. Thread \
  10. Fork \
  11. Event \
  12. Process \
  13. Exception \
  14. Memory \
  15. Pipe \
  16. Tcp \
  17. Udp \
  18. Yield \
  19. Server \
  20. Wait \
  21. HandleSend \
  22. Select \
  23. Segment \
  24. Sleep \
  25. Pie
  26. manifests = manifest
  27. target = \
  28. $(executables) \
  29. $(manifests)
  30. include ../../Scripts/Makefile.manifest
  31. graphene_lib = .lib/graphene-lib.a
  32. pal_lib = ../../Runtime/libpal-$(PAL_HOST).so
  33. ifneq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
  34. $(error unsupported platform. $(SYS))
  35. endif
  36. .PHONY: all
  37. all: pal_loader $(target) $(call expand_target_to_sig,$(target)) $(call expand_target_to_sgx,$(target))
  38. .PHONY: sgx-tokens
  39. sgx-tokens: $(call expand_target_to_token,$(target))
  40. pal_loader:
  41. ln -sf ../../Runtime/pal_loader
  42. .PHONY: crt_init-recurse
  43. crt_init-recurse:
  44. $(MAKE) -C ../crt_init all
  45. ../crt_init/user_start.o: crt_init-recurse
  46. @true
  47. CFLAGS-Pie = -fPIC -pie
  48. LDLIBS += $(graphene_lib) $(pal_lib) ../crt_init/user_start.o
  49. $(executables): %: %.c $(LDLIBS)
  50. $(call cmd,csingle)
  51. $(graphene_lib):
  52. $(MAKE) -C ../lib target=$(abspath .lib)/
  53. ifeq ($(filter %clean,$(MAKECMDGOALS)),)
  54. -include $(addsuffix .d, $(executables)) $(addsuffix .i.d, $(executables)) $(addsuffix .s.d, $(executables))
  55. endif
  56. .PHONY: clean
  57. clean:
  58. $(RM) -r pal_loader $(target) .lib *.cached *.sig *.token *.manifest.sgx \
  59. $(addsuffix .d, $(executables)) $(addsuffix .i.d, $(executables)) \
  60. $(addsuffix .s.d, $(executables)) \
  61. $(addsuffix .manifest.sgx.d,$(executables)) \
  62. .output.*
  63. .PHONY: distclean
  64. distclean: clean