Makefile 1.9 KB

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