Files
graphene/Scripts/Makefile.Test
T
2020-02-05 23:21:05 -08:00

80 lines
2.2 KiB
Makefile

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.configs
include $(SCRIPTS_DIR)/Makefile.rules
include $(SCRIPTS_DIR)/Makefile.manifest
ifeq ($(SGX),1)
PAL_LOADER = pal_loader SGX
else
PAL_LOADER = pal_loader
endif
CFLAGS = -Wall -std=gnu99
CXXFLAGS = -Wall -std=c++14
LDFLAGS =
CFLAGS-libos = -I$(SHIMDIR)/include -L$(SHIMDIR)/../glibc-build/libos
CFLAGS-libos-debug = -I$(SHIMDIR)/include -I$(PALDIR)/../include/pal -I$(PALDIR)/../lib -fno-builtin -nostdlib
CXXFLAGS-libos-debug = -I$(SHIMDIR)/include -I$(PALDIR)/../include/pal -I$(PALDIR)/../lib -fno-builtin -nostdlib
LDFLAGS-libos-debug = -L$(SHIMDIR)/src -L$(PALDIR)/host/$(PAL_HOST) -Wl,-rpath-link=$(abspath $(RUNTIME)) -lpal -lsysdb_debug
.PHONY: default
default: all
.PHONY: all
all: pal_loader $(target) | $(exec_target) $(call expand_target_to_sgx,$(exec_target)) $(call expand_target_to_sig,$(exec_target))
.PHONY: sgx-tokens
sgx-tokens: $(call expand_target_to_token,$(exec_target))
ifeq ($(DEBUG),1)
CC += -g
CXX += -g
endif
ifeq ($(WERROR),1)
CFLAGS += -Werror
endif
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' \
$(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' \
$(extra_rules)
endif
pal_loader:
ln -sf $(RUNTIME)/pal_loader
ifeq ($(filter %clean,$(MAKECMDGOALS)),)
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