Files
graphene/Scripts/Makefile.Test
T
Stefan Berger 206eb81eec [Makefiles] Get arch and distro specific vars from Makefile.configs
Extend Makefile.configs and define several variables for make to use
derived from 'gcc -dumpmachine'. In particular:
- ARCH as the architecture, e.g., x86_64
- ARCH_LONG as the long version of the architecture, e.g., x86_64-linux-gnu
- ARCH_LIBDIR as the directory where libraries are located,
  e.g., /lib/x86_64-linux-gnu

In Makefiles and manifest templates, replace the hard-coded
x86_64-linux_gnu and /lib/x86_64-linux-gnu through these variables.
Extend the already existing sed scripts to replace the necessary
variables.
2020-05-01 20:54:04 +00:00

71 lines
2.3 KiB
Makefile

ifeq ($(SYS),)
$(error include Makefile.config before $(lastword $(MAKEFILE_LIST)))
endif
ifeq ($(MAKEFILE_MANIFEST_DIR),)
$(error include Makefile.manifest before $(lastword $(MAKEFILE_LIST)))
endif
SCRIPTS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
SHIM_TEST_DIR = $(SCRIPTS_DIR)/../LibOS/shim/test
PALDIR = $(abspath $(SCRIPTS_DIR)/../Pal/src)
SHIMDIR = $(abspath $(SCRIPTS_DIR)/../LibOS/shim)
RUNTIME = $(abspath $(SCRIPTS_DIR)/../Runtime)
include $(SCRIPTS_DIR)/Makefile.rules
CFLAGS-libos = -I$(SHIMDIR)/include -L$(SHIMDIR)/../glibc-build/libos
CFLAGS-libos-debug = -I$(SHIMDIR)/include -I$(PALDIR)/../include/pal -I$(PALDIR)/../include/lib -fno-builtin -nostdlib
CXXFLAGS-libos-debug = -I$(SHIMDIR)/include -I$(PALDIR)/../include/pal -I$(PALDIR)/../include/lib -fno-builtin -nostdlib
LDFLAGS-libos-debug = -L$(SHIMDIR)/src -L$(PALDIR)/host/$(PAL_HOST) -Wl,-rpath-link=$(abspath $(RUNTIME)) -lpal -lsysdb_debug
.PHONY: all
ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
all: pal_loader $(target) | $(exec_target) $(call expand_target_to_sgx,$(exec_target)) $(call expand_target_to_sig,$(exec_target))
else
all: pal_loader
endif
.PHONY: sgx-tokens
sgx-tokens: $(call expand_target_to_token,$(exec_target))
ifeq ($(ABSPATH_IN_MANIFEST),yes)
manifest_rules = \
-e 's:\$$(PAL):$(abspath $(RUNTIME))/pal_loader:g' \
-e 's:\$$(PWD):$(PWD):g' \
-e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
-e 's:\$$(SHIMPATH):$(abspath $(RUNTIME))/libsysdb.so:g' \
-e 's:\$$(LIBCDIR):$(abspath $(RUNTIME)):g' \
-e 's:\$$(ARCH_LIBDIR):$(ARCH_LIBDIR):g' \
$(extra_rules)
else
manifest_rules= \
-e 's:\$$(PAL):$(abspath $(RUNTIME))/pal_loader:g' \
-e 's:\$$(PWD):$(PWD):g' \
-e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
-e 's:\$$(SHIMPATH):$(RUNTIME)/libsysdb.so:g' \
-e 's:\$$(LIBCDIR):$(RUNTIME):g' \
-e 's:\$$(ARCH_LIBDIR):$(ARCH_LIBDIR):g' \
$(extra_rules)
endif
pal_loader:
ln -sf $(RUNTIME)/pal_loader
ifeq ($(filter %clean,$(MAKECMDGOALS)),)
include $(wildcard *.d)
ifeq ($(SGX),1)
include $(addsuffix .manifest.sgx.d,$(patsubst %.manifest,%,$(exec_target)))
endif
endif
.PHONY: clean
clean: $(clean-extra)
$(RM) -r pal_loader $(exec_target) $(target) $(wildcard *.d) .output.* \
*.sig *.token *.manifest.sgx
.PHONY: distclean
distclean: clean