Makefile 977 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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
  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 manifest.template manifest
  18. ifeq ($(SYS),x86_64-linux-gnu)
  19. $(executables): %: %.c $(graphene_lib) $(pal_lib) ../src/user_start.o
  20. @echo [ $@ ]
  21. @$(CC) $(CFLAGS) $^ -o $@
  22. $(graphene_lib):
  23. $(MAKE) -C ../lib target=$(shell pwd)/.lib/ $(debug)
  24. .PHONY: pack
  25. pack: $(executables)
  26. @../../Scripts/pack_binaries.sh test $^
  27. else
  28. $(executables): .packed/test.tar.gz
  29. tar -xmozf $< $@
  30. endif
  31. clean:
  32. rm -rf $(target) .lib