Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. CC = gcc
  2. CFLAGS = -Wall -O2 -std=gnu99 -fgnu89-inline -fno-builtin -nostdlib -e main \
  3. -I../include/pal -I../lib -L../src -lpal
  4. rtarget = HelloWorld File Failure Thread Fork Event \
  5. Process Exception Memory Pipe Tcp Udp Yield Broadcast
  6. target = $(rtarget) Ipc Server Wait HandleSend Select
  7. graphene_lib = ../lib/graphene-lib.a
  8. pal_lib = ../src/libpal.so
  9. headers = $(wildcard ../include/pal/*.h)
  10. all: $(target) manifest
  11. debug: CC=gcc -g
  12. debug: $(target) manifest
  13. manifest: manifest.template
  14. [ ! -f manifest ] || mv -f manifest manifest.backup
  15. cp manifest.template manifest
  16. # Regression Test
  17. rtest: $(rtarget)
  18. for d in $(rtarget); \
  19. do \
  20. make run-$$d || return $$?; \
  21. done
  22. test-HelloWorld = grep -q "Hello World" OUTPUT
  23. test-File = grep -q "Hello World" OUTPUT
  24. test-Failure = grep -q "Function not supported" OUTPUT
  25. test-Exception = test `grep -c "failure in the handler" OUTPUT` -eq 30
  26. test-Pipe = test `grep -c "Hello World" OUTPUT` -eq 10
  27. test-Tcp = test `grep -c "Hello World" OUTPUT` -eq 10
  28. test-Udp = test `grep -c "Hello World" OUTPUT` -eq 10
  29. $(patsubst %,run-%,$(rtarget)): run-%: %
  30. @echo [ run $< $(value arg-$<) ]
  31. @./libpal.so $< $(value arg-$<) > OUTPUT
  32. @$(value test-$<)
  33. @rm -rf OUTPUT
  34. %.e: %.c $(libobj) $(headers)
  35. @echo [ $@ ]
  36. @$(CC) $(CFLAGS) -E $< -o $@
  37. $(target): %: %.c $(graphene_lib) $(pal_lib)
  38. @echo [ $@ ]
  39. @$(CC) $(CFLAGS) $^ -o $@
  40. clean:
  41. rm -rf $(target)
  42. [ ! -f manifest ] || mv manifest manifest.backup
  43. find -type f -executable -exec rm {} \;