Makefile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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: $(call expand_target,$(target))
  16. ifeq ($(DEBUG),1)
  17. CC += -g
  18. endif
  19. export DEBUG
  20. manifest: manifest.template
  21. cp -f $< $@
  22. %.manifest: %.manifest.template
  23. cp -f $< $@
  24. ifeq ($(SYS),x86_64-linux-gnu)
  25. $(executables): %: %.c $(graphene_lib) $(pal_lib) ../src/user_start.o
  26. @echo [ $@ ]
  27. @$(CC) $(CFLAGS) $(if $(filter Pie,$@),-fPIC -pie,) $^ -o $@
  28. $(graphene_lib):
  29. $(MAKE) -C ../lib target=$(shell pwd)/.lib/
  30. .PHONY: pack
  31. pack: $(executables)
  32. @../../Scripts/pack_binaries.sh test $^
  33. else
  34. $(executables): .packed/test.tar.gz
  35. tar -xmozf $< $@
  36. endif
  37. clean:
  38. rm -rf $(call expand_target,$(target)) .lib *.cached