Browse Source

[LibOS,Pal] Consolidate DEBUG, WERROR, PROFILE in Makefile.configs

Isaku Yamahata 4 years ago
parent
commit
29d907a573

+ 0 - 16
LibOS/shim/src/Makefile

@@ -27,10 +27,6 @@ LDFLAGS += -shared -nostdlib -z combreloc -z relro -z now -z defs \
 	  -dynamic-link=libpal.so \
 	  -rpath-link=$(abspath $(RUNTIME_DIR))
 
-ifeq ($(WERROR),1)
-CFLAGS += -Werror
-endif
-
 files_to_build = libsysdb.a libsysdb.so libsysdb_debug.so
 files_to_install = $(addprefix $(RUNTIME_DIR)/,$(files_to_build))
 
@@ -58,18 +54,6 @@ pal_lib = $(RUNTIME_DIR)/libpal-$(PAL_HOST).so
 
 all: $(files_to_build) $(files_to_install)
 
-ifeq ($(DEBUG),1)
-CC += -gdwarf-2 -g3
-CFLAGS += -DDEBUG
-ASFLAGS += -DDEBUG
-else
-CFLAGS += -O2
-endif
-
-ifeq ($(PROFILING), 1)
-CFLAGS += -DPROFILE
-endif
-
 $(files_to_install): $(RUNTIME_DIR)/%: %
 	$(call cmd,ln_sf)
 

+ 0 - 5
Pal/lib/Makefile

@@ -81,11 +81,6 @@ endif
 .PHONY: all
 all: $(target)graphene-lib.a
 
-ifeq ($(DEBUG),1)
-CC += -g
-CFLAGS += -DDEBUG
-endif
-
 $(target)graphene-lib.a: $(addprefix $(target),$(objs))
 	@mkdir -p $(dir $@)
 	$(call cmd,ar_a_o)

+ 0 - 8
Pal/regression/Makefile

@@ -58,14 +58,6 @@ all: $(target) $(call expand_target_to_sig,$(target)) $(call expand_target_to_sg
 .PHONY: sgx-tokens
 sgx-tokens: $(call expand_target_to_token,$(target))
 
-ifeq ($(DEBUG),1)
-CC += -g
-endif
-
-ifeq ($(WERROR),1)
-CFLAGS += -Werror
-endif
-
 # To enable tests for remote attestation, please provide RA_CLIENT_SPID and RA_CLIENT_KEY
 # in the environment variables.
 # To obtain a SPID, register in the Intel API portal:

+ 0 - 9
Pal/src/Makefile

@@ -22,10 +22,6 @@ include host/$(PAL_HOST)/Makefile.am
 
 CFLAGS	+= -I. -I../include -I$(HOST_DIR) -I../lib
 
-ifeq ($(PROFILING),1)
-CFLAGS	+= -DPROFILING=1
-endif
-
 PAL_HOST_MACRO = $(shell echo $(PAL_HOST) | tr '[:lower:]' '[:upper:]' | tr '-' '_')
 
 # Build Targets:
@@ -45,11 +41,6 @@ objs	= $(addprefix db_,streams memory threading mutex events process \
 graphene_lib = $(LIB_DIR)/graphene-lib.a
 host_lib = $(HOST_DIR)/libpal-$(PAL_HOST).a
 
-ifeq ($(DEBUG),1)
-CC += -gdwarf-2 -g3
-CFLAGS += -DDEBUG
-endif
-
 # Install Targets (all in RUNTIME_DIR):
 #       pal-{Host Name}:       loader for PAL (as an executable)
 #       libpal-{Host Name}.so: dynamic-linking library

+ 0 - 6
Pal/src/host/Linux-SGX/Makefile

@@ -26,12 +26,6 @@ graphene_lib = .lib/graphene-lib.a
 .PHONY: all
 all: sgx-driver/isgx_version.h $(host_files)
 
-ifeq ($(DEBUG),1)
-CC += -gdwarf-2 -g3
-CFLAGS += -DDEBUG
-ASFLAGS += -DDEBUG
-endif
-
 ../../host_endian.h: host_endian.h
 	$(MAKE) -C ../../ $<
 

+ 0 - 4
Pal/src/host/Linux-SGX/Makefile.am

@@ -16,10 +16,6 @@ LDFLAGS += -shared -nostdlib -z combreloc -z defs \
 CRYPTO_PROVIDER = mbedtls
 CFLAGS += -DCRYPTO_USE_MBEDTLS
 
-ifeq ($(WERROR),1)
-CFLAGS += -Werror
-endif
-
 pal_loader = $(HOST_DIR)/pal-sgx
 pal_lib = $(HOST_DIR)/libpal.so
 pal_lib_deps = pal-symbols $(HOST_DIR)/pal.map.template $(HOST_DIR)/enclave.lds

+ 0 - 9
Pal/src/host/Linux/Makefile

@@ -5,10 +5,6 @@ CFLAGS	+= -I. -Iinclude -I../.. -I../../../include -I../../../lib \
 	   -I../../../linux-kernel/graphene
 ASFLAGS += -I. -Iinclude -I../.. -I../../../include
 
-ifeq ($(PROFILING),1)
-CFLAGS	+= -DPROFILING=1
-endif
-
 host_files = libpal-Linux.a pal.map
 
 defs	= -DIN_PAL -DPAL_DIR=$(PAL_DIR) -DRUNTIME_DIR=$(RUNTIME_DIR)
@@ -22,11 +18,6 @@ graphene_lib = .lib/graphene-lib.a
 .PHONY: all
 all: $(host_files)
 
-ifeq ($(DEBUG),1)
-CC += -gdwarf-2 -g3
-CFLAGS += -DDEBUG
-endif
-
 libpal-Linux.a: $(addsuffix .o,$(objs)) $(graphene_lib)
 	$(call cmd,ar_a_o)
 

+ 0 - 4
Pal/src/host/Linux/Makefile.am

@@ -14,10 +14,6 @@ LDFLAGS += -shared -nostdlib -z combreloc -z defs \
 	  --version-script $(HOST_DIR)/pal.map -T $(HOST_DIR)/pal.lds \
 	  -z relro -z now
 
-ifeq ($(WERROR),1)
-CFLAGS += -Werror
-endif
-
 pal_loader = $(HOST_DIR)/libpal.so
 pal_lib = $(HOST_DIR)/libpal.so
 pal_lib_deps = pal-symbols $(HOST_DIR)/pal.map.template $(HOST_DIR)/pal.lds

+ 0 - 5
Pal/src/host/Skeleton/Makefile

@@ -16,11 +16,6 @@ headers	= $(wildcard *.h) $(wildcard ../../*.h) $(wildcard ../../../lib/*.h)
 .PHONY: all
 all: $(host_files)
 
-ifeq ($(DEBUG),1)
-CC += -gdwarf-2 -g3
-CFLAGS += -DDEBUG
-endif
-
 ../../host_endian.h: host_endian.h
 	$(MAKE) -C ../../ $<
 

+ 0 - 4
Pal/src/host/Skeleton/Makefile.am

@@ -10,10 +10,6 @@ ASFLAGS += -DPIC -DSHARED -fPIC -DASSEMBLER -Wa,--noexecstack \
 LDFLAGS += -shared -nostdlib -z combreloc -z defs \
 	  --version-script $(HOST_DIR)/pal.map -T $(HOST_DIR)/pal.lds
 
-ifeq ($(WERROR),1)
-CFLAGS += -Werror
-endif
-
 pal_loader =
 pal_sec =
 pal_lib = $(HOST_DIR)/libpal.so

+ 0 - 8
Pal/test/Makefile

@@ -25,14 +25,6 @@ all: pal_loader $(target) $(call expand_target_to_sig,$(target)) $(call expand_t
 .PHONY: sgx-tokens
 sgx-tokens: $(call expand_target_to_token,$(target))
 
-ifeq ($(DEBUG),1)
-CC += -g
-endif
-
-ifeq ($(WERROR),1)
-CFLAGS += -Werror
-endif
-
 pal_loader:
 	ln -sf ../../Runtime/pal_loader
 

+ 0 - 9
Scripts/Makefile.Test

@@ -34,15 +34,6 @@ all: pal_loader $(target) | $(exec_target) $(call expand_target_to_sgx,$(exec_ta
 .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' \

+ 16 - 0
Scripts/Makefile.configs

@@ -26,5 +26,21 @@ export SYS
 DEBUG ?=
 export DEBUG
 
+ifeq ($(DEBUG),1)
+CFLAGS += -gdwarf-2 -g3
+CXXFLAGS += -gdwarf-2 -g3
+CFLAGS += -DDEBUG
+ASFLAGS += -DDEBUG
+endif
+
+ifeq ($(WERROR),1)
+CFLAGS += -Werror
+CXXFLAGS += -Werror
+endif
+
+ifeq ($(PROFILING),1)
+CFLAGS += -DPROFILING=1
+endif
+
 MAKEFILE_CONFIGS_INCLUDED = y
 include $(MAKEFILE_CONFIGS_DIR)/Makefile.Host