Makefile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. BINS=\
  2. alloc \
  3. atof \
  4. atoi \
  5. brk \
  6. args \
  7. chdir \
  8. create \
  9. ctype \
  10. dup \
  11. error \
  12. fchdir \
  13. fcntl \
  14. fsync \
  15. ftruncate \
  16. getid \
  17. link \
  18. math \
  19. rmdir \
  20. pipe \
  21. printf \
  22. sleep \
  23. write
  24. all: $(BINS)
  25. clean:
  26. rm -f $(BINS) *.out
  27. run: $(BINS)
  28. for bin in $(BINS); \
  29. do \
  30. echo "# $${bin} #"; \
  31. "./$${bin}" test args; \
  32. done
  33. expected: $(BINS)
  34. rm -rf expected
  35. mkdir -p expected
  36. for bin in $(BINS); \
  37. do \
  38. echo "# $${bin} #"; \
  39. "./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr"; \
  40. done
  41. verify: $(BINS)
  42. rm -rf gen
  43. mkdir -p gen
  44. for bin in $(BINS); \
  45. do \
  46. echo "# $${bin} #"; \
  47. "./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr"; \
  48. diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout"; \
  49. diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr"; \
  50. done
  51. GCCHEAD=\
  52. -nostdinc \
  53. -nostdlib \
  54. -I ../include \
  55. -I ../target/include \
  56. -I ../openlibm/include \
  57. -I ../openlibm/src \
  58. ../target/debug/libcrt0.a
  59. GCCTAIL=\
  60. ../target/debug/libc.a \
  61. ../openlibm/libopenlibm.a
  62. %: %.c
  63. gcc -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@"