Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # Binaries that should generate the same output every time
  2. EXPECT_BINS=\
  3. atof \
  4. atoi \
  5. brk \
  6. args \
  7. create \
  8. ctype \
  9. dup \
  10. error \
  11. fchdir \
  12. fcntl \
  13. fsync \
  14. ftruncate \
  15. link \
  16. math \
  17. mem \
  18. pipe \
  19. printf \
  20. rmdir \
  21. sleep \
  22. sprintf \
  23. stdlib/strtol \
  24. stdlib/a64l \
  25. string/strncmp \
  26. string/strcspn \
  27. string/strchr \
  28. string/strrchr \
  29. string/strspn \
  30. unlink \
  31. waitpid \
  32. write
  33. # Binaries that may generate varied output
  34. BINS=\
  35. $(EXPECT_BINS) \
  36. alloc \
  37. chdir \
  38. getid \
  39. setid
  40. all: $(BINS)
  41. clean:
  42. rm -f $(BINS) *.out
  43. run: $(BINS)
  44. for bin in $^; \
  45. do \
  46. echo "# $${bin} #"; \
  47. "./$${bin}" test args || exit $$?; \
  48. done
  49. expected: $(EXPECT_BINS)
  50. rm -rf expected
  51. mkdir -p expected
  52. for bin in $^; \
  53. do \
  54. echo "# $${bin} #"; \
  55. mkdir -p expected/`dirname $${bin}`; \
  56. "./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr" || exit $$?; \
  57. done
  58. verify: $(EXPECT_BINS)
  59. rm -rf gen
  60. mkdir -p gen
  61. for bin in $^; \
  62. do \
  63. echo "# $${bin} #"; \
  64. mkdir -p gen/`dirname $${bin}`; \
  65. "./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr" || exit $$?; \
  66. diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout" || exit $$?; \
  67. diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr" || exit $$?; \
  68. done
  69. GCCHEAD=\
  70. -nostdinc \
  71. -nostdlib \
  72. -I ../include \
  73. -I ../target/include \
  74. -I ../openlibm/include \
  75. -I ../openlibm/src \
  76. ../target/debug/libcrt0.a
  77. GCCTAIL=\
  78. ../target/debug/libc.a \
  79. ../openlibm/libopenlibm.a
  80. %: %.c
  81. gcc -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@"