Makefile.Test 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ifeq ($(SYS),)
  2. $(error include Makefile.config before $(lastword $(MAKEFILE_LIST)))
  3. endif
  4. ifeq ($(MAKEFILE_MANIFEST_DIR),)
  5. $(error include Makefile.manifest before $(lastword $(MAKEFILE_LIST)))
  6. endif
  7. SCRIPTS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
  8. SHIM_TEST_DIR = $(SCRIPTS_DIR)/../LibOS/shim/test
  9. PALDIR = $(abspath $(SCRIPTS_DIR)/../Pal/src)
  10. SHIMDIR = $(abspath $(SCRIPTS_DIR)/../LibOS/shim)
  11. RUNTIME = $(abspath $(SCRIPTS_DIR)/../Runtime)
  12. include $(SCRIPTS_DIR)/Makefile.rules
  13. CFLAGS += -std=gnu99
  14. # TODO: enable -Wunused-result
  15. CFLAGS += -Wno-unused-result
  16. CFLAGS-libos = -I$(SHIMDIR)/include -L$(SHIMDIR)/../glibc-build/libos
  17. CFLAGS-libos-debug = -I$(SHIMDIR)/include -I$(PALDIR)/../include/pal -I$(PALDIR)/../lib -fno-builtin -nostdlib
  18. CXXFLAGS-libos-debug = -I$(SHIMDIR)/include -I$(PALDIR)/../include/pal -I$(PALDIR)/../lib -fno-builtin -nostdlib
  19. LDFLAGS-libos-debug = -L$(SHIMDIR)/src -L$(PALDIR)/host/$(PAL_HOST) -Wl,-rpath-link=$(abspath $(RUNTIME)) -lpal -lsysdb_debug
  20. .PHONY: all
  21. ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
  22. all: pal_loader $(target) | $(exec_target) $(call expand_target_to_sgx,$(exec_target)) $(call expand_target_to_sig,$(exec_target))
  23. else
  24. all: pal_loader
  25. endif
  26. .PHONY: sgx-tokens
  27. sgx-tokens: $(call expand_target_to_token,$(exec_target))
  28. ifeq ($(ABSPATH_IN_MANIFEST),yes)
  29. manifest_rules = \
  30. -e 's:\$$(PAL):$(abspath $(RUNTIME))/pal_loader:g' \
  31. -e 's:\$$(PWD):$(PWD):g' \
  32. -e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
  33. -e 's:\$$(SHIMPATH):$(abspath $(RUNTIME))/libsysdb.so:g' \
  34. -e 's:\$$(LIBCDIR):$(abspath $(RUNTIME)):g' \
  35. $(extra_rules)
  36. else
  37. manifest_rules= \
  38. -e 's:\$$(PAL):$(abspath $(RUNTIME))/pal_loader:g' \
  39. -e 's:\$$(PWD):$(PWD):g' \
  40. -e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
  41. -e 's:\$$(SHIMPATH):$(RUNTIME)/libsysdb.so:g' \
  42. -e 's:\$$(LIBCDIR):$(RUNTIME):g' \
  43. $(extra_rules)
  44. endif
  45. pal_loader:
  46. ln -sf $(RUNTIME)/pal_loader
  47. ifeq ($(filter %clean,$(MAKECMDGOALS)),)
  48. ifeq ($(SGX),1)
  49. include $(addsuffix .manifest.sgx.d,$(patsubst %.manifest,%,$(exec_target)))
  50. endif
  51. endif
  52. .PHONY: clean
  53. clean: $(clean-extra)
  54. $(RM) -r pal_loader $(exec_target) $(target) $(wildcard *.d) .output.* \
  55. *.sig *.token *.manifest.sgx
  56. .PHONY: distclean
  57. distclean: clean