[Pal/{test, regression}] Use Makefile.rules to simplify Makefile

This commit is contained in:
Isaku Yamahata
2019-08-24 01:50:58 +02:00
committed by Michał Kowalczyk
parent 723af03513
commit 2f03b32db7
2 changed files with 15 additions and 12 deletions
+11 -9
View File
@@ -1,7 +1,7 @@
include ../src/Makefile.Host
CC = gcc
CFLAGS = -Wall -O2 -std=c11 -fno-builtin -nostdlib -mavx -no-pie \
CFLAGS = -Wall -O2 -std=c11 -fno-builtin -nostdlib -mavx \
-I../include/pal -I../lib -I../src
preloads = $(patsubst %.c,%,$(wildcard *.so.c))
@@ -51,15 +51,17 @@ manifest: manifest.template
$(MAKE) -C ../src $(notdir $@)
ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
$(preloads): %.so: %.so.c ../src/user_shared_start.o \
$(graphene_lib) $(pal_lib)
@echo [ $@ ]
@$(CC) -MD -MP -shared -fPIC $(filter-out -no-pie,$(CFLAGS)) $(filter-out %.h,$^) -o $@
LDLIBS-preloads = ../src/user_shared_start.o $(graphene_lib) $(pal_lib)
$(preloads): CFLAGS += -shared -fPIC
$(preloads): LDLIBS = $(LDLIBS-preloads)
$(preloads): %.so: %.so.c $(LDLIBS-preloads)
$(call cmd,csingle)
$(executables): %: %.c ../src/user_start.o \
$(graphene_lib) $(pal_lib) $(preloads)
@echo [ $@ ]
@$(CC) -MD -MP $(CFLAGS) $(filter-out %.h,$^) -o $@
LDLIBS-executables = ../src/user_start.o $(graphene_lib) $(pal_lib) $(preloads)
$(executables): CFLAGS += -no-pie
$(executables): LDLIBS = $(LDLIBS-executables)
$(executables): %: %.c $(LDLIBS-executables)
$(call cmd,csingle)
include $(wildcard *.d)
ifeq ($(SGX), 1)
+4 -3
View File
@@ -42,9 +42,10 @@ manifest: manifest.template
cp -f $< $@
ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
$(executables): %: %.c $(graphene_lib) $(pal_lib) ../src/user_start.o
@echo [ $@ ]
@$(CC) -MD -MP $(CFLAGS) $(if $(filter Pie,$@),-fPIC -pie,) $^ -o $@
CFLAGS-Pie = -fPIC -pie
LDLIBS = $(graphene_lib) $(pal_lib) ../src/user_start.o
$(executables): %: %.c $(LDLIBS)
$(call cmd,csingle)
.lib/host_endian.h: ../src/host/$(PAL_HOST)/host_endian.h
@mkdir -p .lib