[LibOS] Simplify shim/test/Makefile

This commit is contained in:
Isaku Yamahata
2019-09-03 20:06:59 +02:00
committed by Michał Kowalczyk
parent 3d19670374
commit e83a5ec6fe
7 changed files with 17 additions and 103 deletions
+7 -87
View File
@@ -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
+5 -3
View File
@@ -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
+2 -4
View File
@@ -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)
-2
View File
@@ -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
+2 -4
View File
@@ -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)
-2
View File
@@ -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)