Makefile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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/bsearch \
  24. stdlib/strtol \
  25. stdlib/a64l \
  26. stdlib/rand \
  27. string/strncmp \
  28. string/strcspn \
  29. string/strchr \
  30. string/strrchr \
  31. string/strspn \
  32. string/strstr \
  33. string/strpbrk \
  34. string/strtok \
  35. string/strtok_r \
  36. unistd/getopt \
  37. unlink \
  38. waitpid \
  39. write
  40. # Binaries that may generate varied output
  41. BINS=\
  42. $(EXPECT_BINS) \
  43. alloc \
  44. chdir \
  45. getid \
  46. setid
  47. all: $(BINS)
  48. clean:
  49. rm -f $(BINS) *.out
  50. run: $(BINS)
  51. for bin in $^; \
  52. do \
  53. echo "# $${bin} #"; \
  54. "./$${bin}" test args || exit $$?; \
  55. done
  56. expected: $(EXPECT_BINS)
  57. rm -rf expected
  58. mkdir -p expected
  59. for bin in $^; \
  60. do \
  61. echo "# $${bin} #"; \
  62. mkdir -p expected/`dirname $${bin}`; \
  63. "./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr" || exit $$?; \
  64. done
  65. verify: $(EXPECT_BINS)
  66. rm -rf gen
  67. mkdir -p gen
  68. for bin in $^; \
  69. do \
  70. echo "# $${bin} #"; \
  71. mkdir -p gen/`dirname $${bin}`; \
  72. "./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr" || exit $$?; \
  73. diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout" || exit $$?; \
  74. diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr" || exit $$?; \
  75. done
  76. GCCHEAD=\
  77. -nostdinc \
  78. -nostdlib \
  79. -I ../include \
  80. -I ../target/include \
  81. -I ../openlibm/include \
  82. -I ../openlibm/src \
  83. ../target/debug/libcrt0.a
  84. GCCTAIL=\
  85. ../target/debug/libc.a \
  86. ../openlibm/libopenlibm.a
  87. %: %.c
  88. gcc -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@"