Makefile.Test 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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-libos = -I$(SHIMDIR)/include -L$(SHIMDIR)/../glibc-build/libos
  14. CFLAGS-libos-debug = -I$(SHIMDIR)/include -I$(PALDIR)/../include/pal -I$(PALDIR)/../include/lib -fno-builtin -nostdlib
  15. CXXFLAGS-libos-debug = -I$(SHIMDIR)/include -I$(PALDIR)/../include/pal -I$(PALDIR)/../include/lib -fno-builtin -nostdlib
  16. LDFLAGS-libos-debug = -L$(SHIMDIR)/src -L$(PALDIR)/host/$(PAL_HOST) -Wl,-rpath-link=$(abspath $(RUNTIME)) -lpal -lsysdb_debug
  17. .PHONY: all
  18. ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
  19. all: pal_loader $(target) | $(exec_target) $(call expand_target_to_sgx,$(exec_target)) $(call expand_target_to_sig,$(exec_target))
  20. else
  21. all: pal_loader
  22. endif
  23. .PHONY: sgx-tokens
  24. sgx-tokens: $(call expand_target_to_token,$(exec_target))
  25. ifeq ($(ABSPATH_IN_MANIFEST),yes)
  26. manifest_rules = \
  27. -e 's:\$$(PAL):$(abspath $(RUNTIME))/pal_loader:g' \
  28. -e 's:\$$(PWD):$(PWD):g' \
  29. -e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
  30. -e 's:\$$(SHIMPATH):$(abspath $(RUNTIME))/libsysdb.so:g' \
  31. -e 's:\$$(LIBCDIR):$(abspath $(RUNTIME)):g' \
  32. $(extra_rules)
  33. else
  34. manifest_rules= \
  35. -e 's:\$$(PAL):$(abspath $(RUNTIME))/pal_loader:g' \
  36. -e 's:\$$(PWD):$(PWD):g' \
  37. -e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
  38. -e 's:\$$(SHIMPATH):$(RUNTIME)/libsysdb.so:g' \
  39. -e 's:\$$(LIBCDIR):$(RUNTIME):g' \
  40. $(extra_rules)
  41. endif
  42. pal_loader:
  43. ln -sf $(RUNTIME)/pal_loader
  44. ifeq ($(filter %clean,$(MAKECMDGOALS)),)
  45. include $(wildcard *.d)
  46. ifeq ($(SGX),1)
  47. include $(addsuffix .manifest.sgx.d,$(patsubst %.manifest,%,$(exec_target)))
  48. endif
  49. endif
  50. .PHONY: clean
  51. clean: $(clean-extra)
  52. $(RM) -r pal_loader $(exec_target) $(target) $(wildcard *.d) .output.* \
  53. *.sig *.token *.manifest.sgx
  54. .PHONY: distclean
  55. distclean: clean