Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. write
  23. all: $(BINS)
  24. clean:
  25. rm -f $(BINS) *.out
  26. run: $(BINS)
  27. for bin in $(BINS); \
  28. do \
  29. echo "# $${bin} #"; \
  30. "./$${bin}" test args; \
  31. done
  32. expected: $(BINS)
  33. rm -rf expected
  34. mkdir -p expected
  35. for bin in $(BINS); \
  36. do \
  37. echo "# $${bin} #"; \
  38. "./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr"; \
  39. done
  40. verify: $(BINS)
  41. rm -rf gen
  42. mkdir -p gen
  43. for bin in $(BINS); \
  44. do \
  45. echo "# $${bin} #"; \
  46. "./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr"; \
  47. diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout"; \
  48. diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr"; \
  49. done
  50. GCCHEAD=\
  51. -nostdinc \
  52. -nostdlib \
  53. -I ../include \
  54. -I ../target/include \
  55. -I ../openlibm/include \
  56. -I ../openlibm/src \
  57. ../target/debug/libcrt0.a
  58. GCCTAIL=\
  59. ../target/debug/libc.a \
  60. ../openlibm/libopenlibm.a
  61. %: %.c
  62. gcc -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@"