Makefile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. strings \
  30. stdio/fwrite \
  31. stdio/all \
  32. stdio/freopen \
  33. stdlib/strtol \
  34. stdlib/strtoul \
  35. stdlib/a64l \
  36. stdlib/rand \
  37. string/strncmp \
  38. string/strcspn \
  39. string/strchr \
  40. string/strrchr \
  41. string/strspn \
  42. string/strstr \
  43. string/strpbrk \
  44. string/strtok \
  45. string/strtok_r \
  46. unistd/getopt \
  47. waitpid \
  48. wchar/mbrtowc \
  49. wchar/mbsrtowcs \
  50. wchar/putwchar \
  51. wchar/wcrtomb \
  52. write \
  53. time \
  54. gmtime \
  55. asctime
  56. # Binaries that may generate varied output
  57. BINS=\
  58. $(EXPECT_BINS) \
  59. alloc \
  60. chdir \
  61. gethostname \
  62. getid \
  63. link \
  64. setid \
  65. stdlib/bsearch \
  66. stdlib/mktemp \
  67. unlink
  68. all: $(BINS)
  69. clean:
  70. rm -f $(BINS) *.out
  71. run: $(BINS)
  72. for bin in $^; \
  73. do \
  74. echo "# $${bin} #"; \
  75. "./$${bin}" test args || exit $$?; \
  76. done
  77. expected: $(EXPECT_BINS)
  78. rm -rf expected
  79. mkdir -p expected
  80. for bin in $^; \
  81. do \
  82. echo "# $${bin} #"; \
  83. mkdir -p expected/`dirname $${bin}`; \
  84. "./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr" || exit $$?; \
  85. done
  86. verify: $(EXPECT_BINS)
  87. rm -rf gen
  88. mkdir -p gen
  89. for bin in $^; \
  90. do \
  91. echo "# $${bin} #"; \
  92. mkdir -p gen/`dirname $${bin}`; \
  93. "./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr" || exit $$?; \
  94. diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout" || exit $$?; \
  95. diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr" || exit $$?; \
  96. done
  97. CFLAGS=\
  98. -nostdinc \
  99. -nostdlib \
  100. -I ../include \
  101. -I ../target/include \
  102. -I ../target/openlibm/include \
  103. -I ../target/openlibm/src \
  104. HEADLIBS=\
  105. ../target/debug/crt0.o
  106. TAILLIBS=\
  107. ../target/debug/libc.a \
  108. ../target/openlibm/libopenlibm.a
  109. %: %.c $(HEADLIBS) $(TAILLIBS)
  110. gcc -fno-builtin -fno-stack-protector -Wall -g $(CFLAGS) $(HEADLIBS) "$<" $(TAILLIBS) -o "$@"