Makefile.Host 843 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. ifeq ($(SGX_RUN),1)
  13. $(error "SGX_RUN has been removed. Always set SGX=1 if building for SGX and use the 'sgx-tokens' make target to build launch/EINIT tokens")
  14. endif
  15. ifeq ($(SGX),1)
  16. PAL_HOST := $(patsubst %-SGX,%,$(PAL_HOST))-SGX
  17. endif
  18. ifeq ($(findstring $(PAL_HOST),$(all_hosts)),)
  19. $(error Unsupported platform: $(PAL_HOST))
  20. endif
  21. export SYS
  22. export PAL_HOST
  23. export PAL_HOST_MACRO = $(shell echo $(PAL_HOST) | tr '[:lower:]' '[:upper:]' | tr '-' '_')
  24. .DEFAULT_GOAL := all
  25. .PHONY: print_host
  26. print_host:
  27. @echo $(PAL_HOST)