Makefile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # Binaries that should generate the same output every time
  2. EXPECT_BINS=\
  3. assert \
  4. atof \
  5. atoi \
  6. brk \
  7. args \
  8. create \
  9. ctype \
  10. dup \
  11. error \
  12. fchdir \
  13. fcntl \
  14. fsync \
  15. ftruncate \
  16. getc_unget \
  17. locale \
  18. math \
  19. mem \
  20. pipe \
  21. printf \
  22. rename \
  23. rmdir \
  24. scanf \
  25. setjmp \
  26. sleep \
  27. sprintf \
  28. stdio/fwrite \
  29. stdio/all \
  30. stdio/freopen \
  31. stdlib/strtol \
  32. stdlib/strtoul \
  33. stdlib/a64l \
  34. stdlib/rand \
  35. string/strncmp \
  36. string/strcspn \
  37. string/strchr \
  38. string/strrchr \
  39. string/strspn \
  40. string/strstr \
  41. string/strpbrk \
  42. string/strtok \
  43. string/strtok_r \
  44. unistd/getopt \
  45. waitpid \
  46. write \
  47. time \
  48. gmtime \
  49. asctime
  50. # Binaries that may generate varied output
  51. BINS=\
  52. $(EXPECT_BINS) \
  53. alloc \
  54. chdir \
  55. gethostname \
  56. getid \
  57. link \
  58. setid \
  59. stdlib/bsearch \
  60. stdlib/mktemp \
  61. unlink
  62. all: $(BINS)
  63. clean:
  64. rm -f $(BINS) *.out
  65. run: $(BINS)
  66. for bin in $^; \
  67. do \
  68. echo "# $${bin} #"; \
  69. "./$${bin}" test args || exit $$?; \
  70. done
  71. expected: $(EXPECT_BINS)
  72. rm -rf expected
  73. mkdir -p expected
  74. for bin in $^; \
  75. do \
  76. echo "# $${bin} #"; \
  77. mkdir -p expected/`dirname $${bin}`; \
  78. "./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr" || exit $$?; \
  79. done
  80. verify: $(EXPECT_BINS)
  81. rm -rf gen
  82. mkdir -p gen
  83. for bin in $^; \
  84. do \
  85. echo "# $${bin} #"; \
  86. mkdir -p gen/`dirname $${bin}`; \
  87. "./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr" || exit $$?; \
  88. diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout" || exit $$?; \
  89. diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr" || exit $$?; \
  90. done
  91. CFLAGS=\
  92. -nostdinc \
  93. -nostdlib \
  94. -I ../include \
  95. -I ../target/include \
  96. -I ../target/openlibm/include \
  97. -I ../target/openlibm/src \
  98. HEADLIBS=\
  99. ../target/debug/crt0.o
  100. TAILLIBS=\
  101. ../target/debug/libc.a \
  102. ../target/openlibm/libopenlibm.a
  103. %: %.c $(HEADLIBS) $(TAILLIBS)
  104. gcc -fno-stack-protector -Wall $(CFLAGS) $(HEADLIBS) "$<" $(TAILLIBS) -o "$@"