Makefile 1.0 KB

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