Makefile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. getid \
  16. getc_unget \
  17. link \
  18. locale \
  19. math \
  20. mem \
  21. pipe \
  22. printf \
  23. rename \
  24. rmdir \
  25. scanf \
  26. sleep \
  27. sprintf \
  28. stdio/fwrite \
  29. stdio/all \
  30. stdio/freopen \
  31. stdlib/bsearch \
  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. unlink \
  47. waitpid \
  48. write \
  49. time \
  50. gmtime \
  51. asctime
  52. # Binaries that may generate varied output
  53. BINS=\
  54. $(EXPECT_BINS) \
  55. alloc \
  56. chdir \
  57. getid \
  58. setid
  59. all: $(BINS)
  60. clean:
  61. rm -f $(BINS) *.out
  62. run: $(BINS)
  63. for bin in $^; \
  64. do \
  65. echo "# $${bin} #"; \
  66. "./$${bin}" test args || exit $$?; \
  67. done
  68. expected: $(EXPECT_BINS)
  69. rm -rf expected
  70. mkdir -p expected
  71. for bin in $^; \
  72. do \
  73. echo "# $${bin} #"; \
  74. mkdir -p expected/`dirname $${bin}`; \
  75. "./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr" || exit $$?; \
  76. done
  77. verify: $(EXPECT_BINS)
  78. rm -rf gen
  79. mkdir -p gen
  80. for bin in $^; \
  81. do \
  82. echo "# $${bin} #"; \
  83. mkdir -p gen/`dirname $${bin}`; \
  84. "./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr" || exit $$?; \
  85. diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout" || exit $$?; \
  86. diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr" || exit $$?; \
  87. done
  88. CFLAGS=\
  89. -nostdinc \
  90. -nostdlib \
  91. -I ../include \
  92. -I ../target/include \
  93. -I ../target/openlibm/include \
  94. -I ../target/openlibm/src \
  95. HEADLIBS=\
  96. ../target/debug/crt0.o
  97. TAILLIBS=\
  98. ../target/debug/libc.a \
  99. ../target/openlibm/libopenlibm.a
  100. %: %.c $(HEADLIBS) $(TAILLIBS)
  101. gcc -fno-stack-protector -Wall $(CFLAGS) $(HEADLIBS) "$<" $(TAILLIBS) -o "$@"