123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- include ../../Scripts/Makefile.configs
- include ../src/Makefile.Host
- include ../../Scripts/Makefile.rules
- include ../src/Makefile.Test
- CFLAGS = -Wall -O2 -std=c11 -fno-builtin -nostdlib -no-pie \
- -I../include/pal -I../lib
- .PHONY: default
- default: all
- executables = HelloWorld File Failure Thread Fork Event Process Exception \
- Memory Pipe Tcp Udp Yield Server Wait HandleSend Select Segment \
- Sleep Cpuid Pie
- manifests = manifest
- target = $(executables) $(manifests)
- graphene_lib = .lib/graphene-lib.a
- pal_lib = ../../Runtime/libpal-$(PAL_HOST).so
- .PHONY: all
- all: pal_loader $(call expand_target,$(target))
- .PHONY: sgx-tokens
- sgx-tokens: $(call expand_target_to_token,$(target))
- ifeq ($(DEBUG),1)
- CC += -g
- endif
- export DEBUG
- ifeq ($(WERROR),1)
- CFLAGS += -Werror
- endif
- pal_loader:
- ln -sf ../../Runtime/pal_loader
- manifest: manifest.template
- $(call cmd,manifest)
- %.manifest: %.manifest.template
- $(call cmd,manifest)
- ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
- 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
- cp -f $< $@
- $(graphene_lib): .lib/host_endian.h
- $(MAKE) -C ../lib target=$(abspath .lib)/
- ifeq ($(filter %clean,$(MAKECMDGOALS)),)
- ifeq ($(SGX), 1)
- include $(addsuffix .manifest.sgx.d,$(executables))
- endif
- endif
- else
- .IGNORE: $(executables)
- $(executables):
- endif
- ifeq ($(filter %clean,$(MAKECMDGOALS)),)
- -include $(addsuffix .d, $(executables)) $(addsuffix .i.d, $(executables)) $(addsuffix .s.d, $(executables))
- endif
- .PHONY: clean
- clean:
- rm -rf pal_loader $(call expand_target,$(target)) .lib *.cached *.sig *.token \
- $(addsuffix .d, $(executables)) $(addsuffix .i.d, $(executables)) \
- $(addsuffix .s.d, $(executables)) \
- $(addsuffix .manifest.sgx.d,$(executables)) \
- .output.*
- .PHONY: distclean
- distclean: clean
|