Selaa lähdekoodia

[LibOS,Pal] Modify Makefiles' logic to simplify checks on SYS

The goal of `$(SYS)` check in Makefiles is to skip all targets on
unsupported systems. This commit defines a default goal `all` as
a no-op for simplicity.
Isaku Yamahata 4 vuotta sitten
vanhempi
commit
cff1146892

+ 4 - 5
LibOS/shim/src/Makefile

@@ -50,12 +50,15 @@ all_objs = $(objs) vdso/vdso-note vdso/vdso
 graphene_lib = .lib/graphene-lib.a
 pal_lib = $(RUNTIME_DIR)/libpal-$(PAL_HOST).so
 
+ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
 all: $(files_to_build) $(files_to_install)
+else
+all:
+endif
 
 $(files_to_install): $(RUNTIME_DIR)/%: %
 	$(call cmd,ln_sf)
 
-ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
 LDFLAGS-libsysdb.so += --version-script shim.map -T shim.lds
 libsysdb.so: $(addsuffix .o,$(objs)) $(filter %.map %.lds,$(LDFLAGS-$@)) \
 	     $(graphene_lib) $(pal_lib)
@@ -80,10 +83,6 @@ $(graphene_lib): graphene_lib_recurse
 
 libsysdb.a: $(addsuffix .o,$(objs))
 	$(call cmd,ar_a_o)
-else
-.IGNORE: $(shim_target)
-$(shim_target):
-endif
 
 %.o: %.c
 	$(call cmd,cc_o_c)

+ 0 - 6
LibOS/shim/test/benchmark/Makefile

@@ -8,8 +8,6 @@ include ../../../../Scripts/Makefile.configs
 include ../../../../Scripts/Makefile.manifest
 include ../../../../Scripts/Makefile.Test
 
-ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
-
 CFLAGS-rpc_latency += $(CFLAGS-libos)
 CFLAGS-rpc_latency2 += $(CFLAGS-libos)
 
@@ -22,7 +20,3 @@ LDLIBS-test_start += -lm
 
 %: %.cpp
 	$(call cmd,cxxsingle)
-else
-.IGNORE: $(c_executables) $(cxx_executables)
-$(c_executables) $(cxx_executables):
-endif

+ 0 - 6
LibOS/shim/test/inline/Makefile

@@ -22,8 +22,6 @@ crt_init-recurse:
 $(PALDIR)/../crt_init/user_start.o: crt_init-recurse
 	@true
 
-ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
-
 CFLAGS += $(CFLAGS-libos-debug)
 CXXFLAGS += $(CXXFLAGS-libos-debug)
 LDLIBS += $(LDLIBS-user_start) $(LDFLAGS-libos-debug)
@@ -33,7 +31,3 @@ $(c_executables): %: %.c $(LDLIBS-user_start)
 
 $(cxx_executables): %: %.cpp $(LDLIBS-user_start)
 	$(call cmd,cxxsingle)
-else
-.IGNORE: $(c_executables) $(cxx_executables)
-$(c_executables) $(cxx_executables):
-endif

+ 0 - 6
LibOS/shim/test/native/Makefile

@@ -9,8 +9,6 @@ include ../../../../Scripts/Makefile.configs
 include ../../../../Scripts/Makefile.manifest
 include ../../../../Scripts/Makefile.Test
 
-ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
-
 CFLAGS-msg_create_libos += $(CFLAGS-libos)
 CFLAGS-msg_send_libos += $(CFLAGS-libos)
 
@@ -34,7 +32,3 @@ LDLIBS-test_start_pthread_m += -lm
 ifeq ($(filter %clean,$(MAKECMDGOALS)),)
 include $(wildcard *.d)
 endif
-else
-.IGNORE: $(c_executables) $(cxx_executables)
-$(c_executables) $(cxx_executables):
-endif

+ 0 - 7
LibOS/shim/test/regression/Makefile

@@ -11,8 +11,6 @@ include ../../../../Scripts/Makefile.configs
 include ../../../../Scripts/Makefile.manifest
 include ../../../../Scripts/Makefile.Test
 
-ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
-
 CFLAGS-bootstrap_static = -static
 CFLAGS-bootstrap_pie = -fPIC -pie
 CFLAGS-shared_object = -fPIC -pie
@@ -34,11 +32,6 @@ CFLAGS-sigprocmask += -pthread
 %: %.cpp
 	$(call cmd,cxxsingle)
 
-else
-.IGNORE: $(c_executables) $(cxx_executables)
-$(c_executables) $(cxx_executables):
-endif
-
 export PAL_LOADER = $(RUNTIME)/pal-$(PAL_HOST)
 export PYTHONPATH=../../../../Scripts
 

+ 5 - 6
Pal/regression/Makefile

@@ -49,6 +49,11 @@ RUNTIME_DIR = $(CURDIR)/../../Runtime
 
 .PHONY: all
 all: $(target) $(call expand_target_to_sig,$(target)) $(call expand_target_to_sgx,$(target)) $(preloads)
+ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
+all: $(target) $(call expand_target_to_sig,$(target)) $(call expand_target_to_sgx,$(target)) $(preloads)
+else
+all:
+endif
 
 .PHONY: sgx-tokens
 sgx-tokens: $(call expand_target_to_token,$(target))
@@ -79,7 +84,6 @@ CFLAGS-AvxDisable += -mavx
 ../regression/File: | File
 	@true
 
-ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
 LDLIBS-preloads = ../crt_init/user_shared_start.o $(graphene_lib) $(pal_lib)
 $(preloads): CFLAGS += -shared -fPIC
 $(preloads): LDLIBS = $(LDLIBS-preloads)
@@ -110,11 +114,6 @@ endif
 $(graphene_lib): .lib/host_endian.h
 	$(MAKE) -C ../lib target=$(abspath .lib)/
 
-else
-.IGNORE: $(preloads) $(executables)
-$(preloads) $(executables):
-endif
-
 export PAL_LOADER = $(RUNTIME_DIR)/pal-$(PAL_HOST)
 export PYTHONPATH=../../Scripts
 

+ 4 - 5
Pal/test/Makefile

@@ -17,7 +17,11 @@ graphene_lib = .lib/graphene-lib.a
 pal_lib = ../../Runtime/libpal-$(PAL_HOST).so
 
 .PHONY: all
+ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
 all: pal_loader $(target) $(call expand_target_to_sig,$(target)) $(call expand_target_to_sgx,$(target))
+else
+all:
+endif
 
 .PHONY: sgx-tokens
 sgx-tokens: $(call expand_target_to_token,$(target))
@@ -25,7 +29,6 @@ sgx-tokens: $(call expand_target_to_token,$(target))
 pal_loader:
 	ln -sf ../../Runtime/pal_loader
 
-ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
 .PHONY: crt_init-recurse
 crt_init-recurse:
 	$(MAKE) -C ../crt_init all
@@ -44,10 +47,6 @@ $(executables): %: %.c $(LDLIBS)
 
 $(graphene_lib): .lib/host_endian.h
 	$(MAKE) -C ../lib target=$(abspath .lib)/
-else
-.IGNORE: $(executables)
-$(executables):
-endif
 
 ifeq ($(filter %clean,$(MAKECMDGOALS)),)
 -include $(addsuffix .d, $(executables)) $(addsuffix .i.d, $(executables)) $(addsuffix .s.d, $(executables))

+ 12 - 2
Scripts/Makefile.Test

@@ -1,3 +1,11 @@
+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
 
@@ -5,9 +13,7 @@ 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
 
 CFLAGS += -std=gnu99
 
@@ -21,7 +27,11 @@ CXXFLAGS-libos-debug = -I$(SHIMDIR)/include -I$(PALDIR)/../include/pal -I$(PALDI
 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))