Makefile.Host 816 B

123456789101112131415161718192021222324252627282930313233
  1. all_hosts = Skeleton Linux Linux-SGX FreeBSD
  2. SYS ?= $(shell gcc -dumpmachine)
  3. ifeq ($(PAL_HOST),)
  4. ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
  5. PAL_HOST := Linux
  6. else ifeq ($(findstring freebsd,$(SYS)),freebsd)
  7. PAL_HOST := FreeBSD
  8. else
  9. $(error Unsupported platform: $(SYS))
  10. endif
  11. endif
  12. # Set SGX=1 to build Graphene for SGX
  13. ifeq ($(SGX)$(SGX_RUN),11)
  14. $(error "Do not use SGX=1 and SGX_RUN=1 at the same time")
  15. endif
  16. ifeq ($(SGX)$(SGX_RUN),1)
  17. PAL_HOST := $(patsubst %-SGX,%,$(PAL_HOST))-SGX
  18. endif
  19. ifeq ($(findstring $(PAL_HOST),$(all_hosts)),)
  20. $(error Unsupported platform: $(PAL_HOST))
  21. endif
  22. export SYS
  23. export PAL_HOST
  24. export PAL_HOST_MACRO = $(shell echo $(PAL_HOST) | tr '[:lower:]' '[:upper:]' | tr '-' '_')
  25. .DEFAULT_GOAL := all
  26. .PHONY: print_host
  27. print_host:
  28. @echo $(PAL_HOST)