Makefile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. include ../src/Makefile.Test
  6. executables = HelloWorld File Failure Thread Fork Event Process Exception \
  7. Memory Pipe Tcp Udp Yield Broadcast Ipc Server Wait HandleSend \
  8. Select Segment Sleep Cpuid Pie
  9. manifests = manifest
  10. target = $(executables) $(manifests)
  11. graphene_lib = .lib/graphene-lib.a
  12. pal_lib = ../src/libpal.so
  13. headers = $(wildcard ../include/pal/*.h)
  14. all: $(call expand_target,$(target))
  15. debug: CC=gcc -g
  16. debug: $(target)
  17. manifest: manifest.template
  18. cp -f $< $@
  19. %.manifest: %.manifest.template
  20. cp -f $< $@
  21. ifeq ($(SYS),x86_64-linux-gnu)
  22. $(executables): %: %.c $(graphene_lib) $(pal_lib) ../src/user_start.o
  23. @echo [ $@ ]
  24. @$(CC) $(CFLAGS) $(if $(filter Pie,$@),-fPIC -pie,) $^ -o $@
  25. $(graphene_lib):
  26. $(MAKE) -C ../lib target=$(shell pwd)/.lib/ $(debug)
  27. .PHONY: pack
  28. pack: $(executables)
  29. @../../Scripts/pack_binaries.sh test $^
  30. else
  31. $(executables): .packed/test.tar.gz
  32. tar -xmozf $< $@
  33. endif
  34. clean:
  35. rm -rf $(call expand_target,$(target)) .lib