Makefile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. SYS ?= $(shell gcc -dumpmachine)
  2. CC = gcc
  3. CFLAGS = -Wall -O2 -std=gnu99 -fgnu89-inline -fno-builtin -nostdlib \
  4. -I../include/pal -I../lib
  5. default: all
  6. include ../src/Makefile.Test
  7. executables = HelloWorld File Failure Thread Fork Event Process Exception \
  8. Memory Pipe Tcp Udp Yield Broadcast Ipc Server Wait HandleSend \
  9. Select Segment Sleep Cpuid Pie
  10. manifests = manifest
  11. target = $(executables) $(manifests)
  12. graphene_lib = .lib/graphene-lib.a
  13. pal_lib = ../src/libpal.so
  14. headers = $(wildcard ../include/pal/*.h)
  15. all: pal_loader $(call expand_target,$(target))
  16. ifeq ($(DEBUG),1)
  17. CC += -g
  18. endif
  19. export DEBUG
  20. pal_loader:
  21. ln -sf ../../Runtime/pal_loader
  22. manifest: manifest.template
  23. cp -f $< $@
  24. %.manifest: %.manifest.template
  25. cp -f $< $@
  26. ifeq ($(SYS),x86_64-linux-gnu)
  27. $(executables): %: %.c $(graphene_lib) $(pal_lib) ../src/user_start.o
  28. @echo [ $@ ]
  29. @$(CC) $(CFLAGS) $(if $(filter Pie,$@),-fPIC -pie,) $^ -o $@
  30. $(graphene_lib):
  31. $(MAKE) -C ../lib target=$(shell pwd)/.lib/
  32. .PHONY: pack
  33. pack: $(executables)
  34. @../../Scripts/pack_binaries.sh test $^
  35. else
  36. $(executables): .packed/test.tar.gz
  37. tar -xmozf $< $@
  38. endif
  39. clean:
  40. rm -rf pal_loader $(call expand_target,$(target)) .lib *.cached