Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. CFLAGS-libos = -L../../../build/libos -I../../include
  2. NATIVE_TESTS_CPP = $(patsubst %.cpp,%,$(wildcard *.cpp))
  3. NATIVE_TESTS_STATIC = static
  4. NATIVE_TESTS = $(filter-out $(NATIVE_TESTS_STATIC),$(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. $(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. $(NATIVE_TESTS_CPP): %: %.cpp
  30. @echo [ $@ ]
  31. @$(CC) $(CFLAGS) -o $@ $< \
  32. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  33. $(NATIVE_TESTS_STATIC): %: %.c
  34. @echo [ $@ ]
  35. @$(CC) $(CFLAGS) -o $@ -static $< \
  36. $(shell echo $@ | sed 's/^[^\.]*//g' | sed 's/\./ -l/g')
  37. test-helloworld = grep -q "Hello world" OUTPUT
  38. clean-exec:
  39. find -type f -executable -exec rm {} \;
  40. rm -rf manifest static.manifest pal pal_sec