Makefile 2.0 KB

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