Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. cp -f manifest.template manifest
  15. # Regression Test
  16. rtest: $(rtarget)
  17. for d in $(rtarget); \
  18. do \
  19. make run-$$d || return $$?; \
  20. done
  21. test-HelloWorld = grep -q "Hello World" OUTPUT
  22. test-File = grep -q "Hello World" OUTPUT
  23. test-Failure = grep -q "Function not supported" OUTPUT
  24. test-Exception = test `grep -c "failure in the handler" OUTPUT` -eq 30
  25. test-Pipe = test `grep -c "Hello World" OUTPUT` -eq 10
  26. test-Tcp = test `grep -c "Hello World" OUTPUT` -eq 10
  27. test-Udp = test `grep -c "Hello World" OUTPUT` -eq 10
  28. $(patsubst %,run-%,$(rtarget)): run-%: %
  29. @echo [ run $< $(value arg-$<) ]
  30. @./libpal.so $< $(value arg-$<) > OUTPUT
  31. @$(value test-$<)
  32. @rm -rf OUTPUT
  33. %.e: %.c $(libobj) $(headers)
  34. @echo [ $@ ]
  35. @$(CC) $(CFLAGS) -E $< -o $@
  36. $(target): %: %.c $(graphene_lib) $(pal_lib)
  37. @echo [ $@ ]
  38. @$(CC) $(CFLAGS) $^ -o $@
  39. clean:
  40. rm -rf $(target) manifest
  41. find -type f -executable -exec rm {} \;