diff --git a/LibOS/shim/test/Makefile b/LibOS/shim/test/Makefile index 08b0e644..10740882 100644 --- a/LibOS/shim/test/Makefile +++ b/LibOS/shim/test/Makefile @@ -1,94 +1,14 @@ -subdirs = native +# SUBDIRS = regression native inline benchmark +SUBDIRS = native SYS ?= $(shell gcc -dumpmachine) export SYS -PALDIR = $(level)../../../Pal/src -SHIMDIR = $(level)../src -RUNTIME = $(level)../../../Runtime - -ifeq ($(SGX),1) -PAL_LOADER = pal_loader SGX -else -PAL_LOADER = pal_loader -endif - -CC = gcc -CXX = g++ -CFLAGS = -Wall -std=gnu99 -CFLAGS-debug = -I$(SHIMDIR)/../include -I$(PALDIR)/../include/pal -I$(PALDIR)/../lib -CXXFLAGS = -Wall -std=c++14 -CXXFLAGS-debug = -I$(SHIMDIR)/../include -I$(PALDIR)/../include/pal -I$(PALDIR)/../lib -LDFLAGS = -LDFLAGS-debug = -L$(SHIMDIR) -L$(PALDIR) -Wl,-rpath-link=$(abspath $(RUNTIME)) - -CFLAGS-libos = -I$(SHIMDIR)/../include -L$(SHIMDIR)/../../glibc-build/libos - .PHONY: default default: all -include $(level)../../../Makefile.configs -include $(level)../../../Makefile.rules -include $(PALDIR)/Makefile.Test - -.PHONY: all -all: pal_loader $(target) $(if $(level),,build-subdirs) | $(call expand_target,$(exec_target)) - -ifeq ($(DEBUG),1) -CC += -g -CXX += -g -endif -export DEBUG - -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):'$$RELDIR'$(RUNTIME)/libsysdb.so:g' \ - -e 's:\$$(LIBCDIR):'$$RELDIR'$(RUNTIME):g' \ - $(extra_rules) -endif - -pal_loader: - ln -sf $(RUNTIME)/pal_loader - -relative-to = $(shell python -c "import os.path; print os.path.relpath(\"$(abspath $2)\",\"$(abspath $1)\")") - -%manifest: %manifest.template - @echo [ $@ ] - RELDIR=$(filter-out ./,$(call relative-to,$(dir $@),$(shell pwd))/) && \ - sed $(manifest_rules) $< > $@ - (grep -q '^#!' $@ && chmod +x $@) || true - -manifest: manifest.template - @echo [ $@ ] - sed $(manifest_rules) $< > $@ - -ifeq ($(SGX), 1) -include $(addsuffix .manifest.sgx.d,$(patsubst %.manifest,%,$(exec_target))) -endif - -.PHONY: clean -clean: $(clean-extra) $(if $(level),,clean-subdirs) - rm -rf pal_loader $(call expand_target,$(exec_target)) $(target) $(wildcard *.d) - -.PHONY: build-subdirs -build-subdirs: - for f in $(subdirs); do (cd $$f; $(MAKE); cd ..); done - -.PHONY: clean-subdirs -clean-subdirs: - for f in $(subdirs); do (cd $$f; $(MAKE) clean; cd ..); done +.PHONY: all clean +all clean: + for d in $(SUBDIRS); do \ + $(MAKE) -C $$d $@; \ + done diff --git a/LibOS/shim/test/Makefile.Test b/LibOS/shim/test/Makefile.Test index e07042a9..f15eb459 100644 --- a/LibOS/shim/test/Makefile.Test +++ b/LibOS/shim/test/Makefile.Test @@ -28,6 +28,8 @@ LDFLAGS-libos-debug = -L$(SHIMDIR) -L$(PALDIR)/host/$(PAL_HOST) -Wl,-rpath-link= .PHONY: default default: all +include $(SHIM_TEST_DIR)/../../../Makefile.configs +include $(SHIM_TEST_DIR)/../../../Makefile.rules include $(PALDIR)/Makefile.Test .PHONY: all @@ -66,7 +68,7 @@ pal_loader: relative-to = $(shell python -c "import os.path; print os.path.relpath(\"$(abspath $2)\",\"$(abspath $1)\")") -%manifest: %manifest.template +%.manifest: %.manifest.template @echo [ $@ ] RELDIR=$(filter-out ./,$(call relative-to,$(dir $@),$(shell pwd))/) && \ sed $(manifest_rules) $< > $@ @@ -76,9 +78,9 @@ manifest: manifest.template @echo [ $@ ] sed $(manifest_rules) $< > $@ -ifneq ($(MAKECMDGOALS),clean) +ifeq ($(filter clean,$(MAKECMDGOALS)),) ifeq ($(SGX),1) -include $(addsuffix .manifest.sgx.d,$(exec_target)) +include $(addsuffix .manifest.sgx.d,$(patsubst %.manifest,%,$(exec_target))) endif endif diff --git a/LibOS/shim/test/apps b/LibOS/shim/test/apps index 937b59d5..b60c298e 160000 --- a/LibOS/shim/test/apps +++ b/LibOS/shim/test/apps @@ -1 +1 @@ -Subproject commit 937b59d5e998ac8ab9e3addb72f5f4a09efda659 +Subproject commit b60c298e4446e0fe38eef963196af28cf012d3b0 diff --git a/LibOS/shim/test/benchmark/Makefile b/LibOS/shim/test/benchmark/Makefile index 1341a4e8..2db56de0 100644 --- a/LibOS/shim/test/benchmark/Makefile +++ b/LibOS/shim/test/benchmark/Makefile @@ -4,8 +4,6 @@ cxx_executables = $(patsubst %.cpp,%,$(wildcard *.cpp)) target = $(c_executables) $(cxx_executables) \ manifest -include ../../../../Makefile.configs -include ../../../../Makefile.rules include ../Makefile.Test %.manifest: %.manifest.template @@ -21,10 +19,10 @@ LDLIBS-rpc_latency.libos += -llibos LDLIBS-rpc_latency2.libos += -llibos LDLIBS-test_start.m += -lm -%: %.c +$(c_executables): %: %.c $(call cmd,csingle) -%: %.cpp +$(cxx_executables): %: %.cpp $(call cmd,cxxsingle) else .IGNORE: $(c_executables) $(cxx_executables) diff --git a/LibOS/shim/test/inline/Makefile b/LibOS/shim/test/inline/Makefile index 31b4cd94..f0c736ac 100644 --- a/LibOS/shim/test/inline/Makefile +++ b/LibOS/shim/test/inline/Makefile @@ -7,8 +7,6 @@ target = $(c_executables) $(cxx_executables) manifest .PHONY: default default: all -include ../../../../Makefile.configs -include ../../../../Makefile.rules include ../Makefile.Test $(PALDIR)/user_start.o: $(PALDIR)/user_start.S diff --git a/LibOS/shim/test/native/Makefile b/LibOS/shim/test/native/Makefile index 9679f676..4fe930dc 100644 --- a/LibOS/shim/test/native/Makefile +++ b/LibOS/shim/test/native/Makefile @@ -5,8 +5,6 @@ manifests = $(patsubst %.template,%,$(wildcard *.manifest.template)) manifest exec_target = $(c_executables) $(cxx_executables) ls.manifest target = $(exec_target) $(manifests) -include ../../../../Makefile.configs -include ../../../../Makefile.rules include ../Makefile.Test ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux) @@ -25,10 +23,10 @@ LDLIBS-start.pthread.m += -lpthread -lm LDLIBS-sync.pthread += -lpthread LDLIBS-test_start_pthread_m.m += -lm -%: %.c +$(c_executables): %: %.c $(call cmd,csingle) -%: %.cpp +$(cxx_executables): %: %.cpp $(call cmd,cxxsingle) include $(wildcard *.d) diff --git a/LibOS/shim/test/regression/Makefile b/LibOS/shim/test/regression/Makefile index 5cf19b3f..dd81d667 100644 --- a/LibOS/shim/test/regression/Makefile +++ b/LibOS/shim/test/regression/Makefile @@ -10,8 +10,6 @@ clean-extra += clean-tmp .PHONY: default default: all -include ../../../../Makefile.configs -include ../../../../Makefile.rules include ../Makefile.Test ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)