Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. CFLAGS-libos = -L../../../build/libos -I../../include
  2. SPECIALS = static pie
  3. NATIVE_TESTS_CPP = $(patsubst %.cpp,%,$(wildcard *.cpp))
  4. NATIVE_TESTS = $(patsubst %.c,%,$(wildcard *.c))
  5. targets = $(NATIVE_TESTS) $(NATIVE_TESTS_CPP) $(NATIVE_TESTS_STATIC) \
  6. manifest static.manifest pal pal_sec
  7. rtarget = helloworld clone vfork fork exec vfork_exec errno dup time \
  8. helloworld.pthread udp tcp unix file dev
  9. clean-extra = clean-exec
  10. level = ../
  11. include ../Makefile
  12. test-helloworld = grep -q "Hello World" OUTPUT
  13. test-clone = grep -q "in the child: pid = 2" OUTPUT
  14. test-vfork = grep -q "Hello, Dad!" OUTPUT
  15. test-fork = grep -q "Hello, Dad!" OUTPUT
  16. test-exec = grep -q "Hello World" OUTPUT
  17. test-file = grep -q "Hello World" OUTPUT && [ ! -f testfile ]
  18. test-errno = grep -q "errno = 22" OUTPUT
  19. test-dup = grep -q "Hello World" OUTPUT
  20. test-time = grep -q "Current timestamp" OUTPUT
  21. test-helloworld.pthread = grep -q "Hello World" OUTPUT
  22. %.manifest: %.manifest.template
  23. rm -rf $@
  24. cp $@.template $@
  25. $(filter-out $(SPECIALS),$(NATIVE_TESTS)): %: %.c
  26. @echo [ $@ ]
  27. @$(CC) $(CFLAGS) $(if $(findstring .libos,$@),$(CFLAGS-libos),) -o $@ $< \
  28. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  29. $(filter-out $(SPECIALS),$(NATIVE_TESTS_CPP)): %: %.cpp
  30. @echo [ $@ ]
  31. @$(CC) $(CFLAGS) -o $@ $< \
  32. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  33. static: %: %.c
  34. @echo [ $@ ]
  35. @$(CC) $(CFLAGS) -o $@ -static $< \
  36. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  37. pie: %: %.c
  38. @echo [ $@ ]
  39. @$(CC) $(CFLAGS) -fPIC --pie -o $@ $< \
  40. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  41. test-helloworld = grep -q "Hello world" OUTPUT
  42. clean-exec:
  43. find -type f -executable -exec rm {} \;
  44. rm -rf manifest static.manifest pal pal_sec