makefile 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. ## GNU Mes --- Maxwell Equations of Software
  2. ## Copyright © 2016,2017,2018,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  3. ## Copyright © 2019 Jeremiah Orians
  4. ##
  5. ## This file is part of GNU Mes.
  6. ##
  7. ## GNU Mes is free software; you can redistribute it and/or modify it
  8. ## under the terms of the GNU General Public License as published by
  9. ## the Free Software Foundation; either version 3 of the License, or (at
  10. ## your option) any later version.
  11. ##
  12. ## GNU Mes is distributed in the hope that it will be useful, but
  13. ## WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ## GNU General Public License for more details.
  16. ##
  17. ## You should have received a copy of the GNU General Public License
  18. ## along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
  19. # Prevent rebuilding
  20. VPATH = src:bin:test:test/results
  21. CC?=gcc
  22. CFLAGS:=$(CFLAGS) -D_GNU_SOURCE -std=c99 -ggdb -D WITH_GLIBC=1 -O0
  23. KAEM = kaem
  24. GUILD = guild
  25. ARCH := x86
  26. default: mes-m2-boot
  27. mes-m2: builtins.c cc.c core.c display.c eval-apply.c gc.c hash.c lib.c apply.c math.c mes.c module.c posix.c reader.c stack.c string.c struct.c symbol.c vector.c | bin
  28. $(CC) $(CFLAGS) \
  29. -DMES_VERSION="0" \
  30. src/builtins.c \
  31. src/cc.c \
  32. src/core.c \
  33. src/display.c \
  34. src/eval-apply.c \
  35. src/gc.c \
  36. src/hash.c \
  37. src/lib.c \
  38. src/apply.c \
  39. src/math.c \
  40. src/mes.c \
  41. src/module.c \
  42. src/reader.c \
  43. src/stack.c \
  44. src/string.c \
  45. src/struct.c \
  46. src/symbol.c \
  47. src/vector.c \
  48. -o bin/mes-m2
  49. mes: builtins.c cc.c core.c display.c eval-apply.c gc.c hash.c lib.c m2.c math.c mes.c module.c posix.c reader.c stack.c string.c struct.c symbol.c vector.c | bin
  50. kaem --verbose --strict
  51. mes-m2-boot:
  52. rm -rf m2
  53. mkdir -p m2
  54. $(KAEM) --strict --verbose --file kaem.${ARCH}
  55. # Clean up after ourselves
  56. .PHONY: clean
  57. clean:
  58. rm -rf bin/ test/results/
  59. # ./test/test000/cleanup.sh
  60. # Directories
  61. bin:
  62. mkdir -p bin
  63. results:
  64. mkdir -p test/results
  65. # For development using Guile
  66. MODULE_SCM_FILES = $(shell find module -name '*.scm')
  67. GO_FILES = $(MODULE_SCM_FILES:%.scm=%.go)
  68. GUILD_OPTIMIZE = -O1
  69. %.go: %.scm
  70. GUILE_LOAD_PATH=module:$(GUILE_LOAD_PATH) \
  71. GUILE_LOAD_COMPILED_PATH=module:$(GUILE_LOAD_COMPILED_PATH) \
  72. $(GUILD) compile $(GUILD_OPTIMIZE) -o $@ $^
  73. all-go: $(GO_FILES)
  74. clean-go:
  75. rm -f $(GO_FILES)
  76. # tests
  77. test: test000.answer \
  78. test001.answer \
  79. test002.answer \
  80. test003.answer \
  81. test004.answer \
  82. test005.answer \
  83. test006.answer \
  84. test007.answer \
  85. test008.answer \
  86. test009.answer \
  87. test010.answer \
  88. test011.answer \
  89. test012.answer \
  90. test013.answer \
  91. test014.answer \
  92. test015.answer \
  93. test016.answer \
  94. test017.answer \
  95. test018.answer \
  96. test019.answer \
  97. test020.answer \
  98. test021.answer \
  99. test022.answer \
  100. test023.answer \
  101. test024.answer \
  102. test025.answer \
  103. test026.answer \
  104. test027.answer \
  105. test028.answer \
  106. test029.answer \
  107. test030.answer \
  108. test031.answer \
  109. test032.answer \
  110. test033.answer \
  111. test034.answer \
  112. test035.answer \
  113. test036.answer \
  114. test037.answer \
  115. test038.answer \
  116. test040.answer \
  117. test041.answer \
  118. test042.answer \
  119. test043.answer \
  120. test044.answer \
  121. test045.answer \
  122. test046.answer \
  123. test047.answer \
  124. test048.answer \
  125. test049.answer \
  126. test050.answer \
  127. test051.answer \
  128. test052.answer \
  129. test053.answer \
  130. test054.answer \
  131. test055.answer \
  132. test056.answer \
  133. test057.answer \
  134. test058.answer \
  135. test059.answer \
  136. test060.answer \
  137. test061.answer \
  138. test062.answer \
  139. test063.answer \
  140. test064.answer \
  141. test065.answer \
  142. test066.answer \
  143. test067.answer \
  144. test068.answer \
  145. test101.answer
  146. # test039.answer \
  147. # test100.answer \
  148. # test102.answer \
  149. # test103.answer \
  150. # test105.answer \
  151. # test106.answer \
  152. # test109.answer \
  153. # test133.answer \
  154. # test200-binary | results
  155. sha256sum -c test/test.answers
  156. # test104.answer
  157. # test107.answer
  158. # test108.answer
  159. # test110.answer
  160. # test111.answer
  161. # test112.answer
  162. # test113.answer
  163. # test114.answer
  164. # test115.answer
  165. # test116.answer
  166. # test117.answer
  167. # test118.answer
  168. # test119.answer
  169. # test120.answer
  170. # test121.answer
  171. # test122.answer
  172. # test123.answer
  173. # test124.answer
  174. # test125.answer
  175. # test126.answer
  176. # test127.answer
  177. # test128.answer
  178. # test129.answer
  179. # test130.answer
  180. # test131.answer
  181. # test132.answer
  182. test000.answer: results mes-m2
  183. test/test000/hello.sh
  184. test001.answer: results mes-m2
  185. test/test001/hello.sh
  186. test002.answer: results mes-m2
  187. test/test002/hello.sh
  188. test003.answer: results mes-m2
  189. test/test003/hello.sh
  190. test004.answer: results mes-m2
  191. test/test004/hello.sh
  192. test005.answer: results mes-m2
  193. test/test005/hello.sh
  194. test006.answer: results mes-m2
  195. test/test006/hello.sh
  196. test007.answer: results mes-m2
  197. test/test007/hello.sh
  198. test008.answer: results mes-m2
  199. test/test008/hello.sh
  200. test009.answer: results mes-m2
  201. test/test009/hello.sh
  202. test010.answer: results mes-m2
  203. test/test010/hello.sh
  204. test011.answer: results mes-m2
  205. test/test011/hello.sh
  206. test012.answer: results mes-m2
  207. test/test012/hello.sh
  208. test013.answer: results mes-m2
  209. test/test013/hello.sh
  210. test014.answer: results mes-m2
  211. test/test014/hello.sh
  212. test015.answer: results mes-m2
  213. test/test015/hello.sh
  214. test016.answer: results mes-m2
  215. test/test016/hello.sh
  216. test017.answer: results mes-m2
  217. test/test017/hello.sh
  218. test018.answer: results mes-m2
  219. test/test018/hello.sh
  220. test019.answer: results mes-m2
  221. test/test019/hello.sh
  222. test020.answer: results mes-m2
  223. test/test020/hello.sh
  224. test021.answer: results mes-m2
  225. test/test021/hello.sh
  226. test022.answer: results mes-m2
  227. test/test022/hello.sh
  228. test023.answer: results mes-m2
  229. test/test023/hello.sh
  230. test024.answer: results mes-m2
  231. test/test024/hello.sh
  232. test025.answer: results mes-m2
  233. test/test025/hello.sh
  234. test026.answer: results mes-m2
  235. test/test026/hello.sh
  236. test027.answer: results mes-m2
  237. test/test027/hello.sh
  238. test028.answer: results mes-m2
  239. test/test028/hello.sh
  240. test029.answer: results mes-m2
  241. test/test029/hello.sh
  242. test030.answer: results mes-m2
  243. test/test030/hello.sh
  244. test031.answer: results mes-m2
  245. test/test031/hello.sh
  246. test032.answer: results mes-m2
  247. test/test032/hello.sh
  248. test033.answer: results mes-m2
  249. test/test033/hello.sh
  250. test034.answer: results mes-m2
  251. test/test034/hello.sh
  252. test035.answer: results mes-m2
  253. test/test035/hello.sh
  254. test036.answer: results mes-m2
  255. test/test036/hello.sh
  256. test037.answer: results mes-m2
  257. test/test037/hello.sh
  258. test038.answer: results mes-m2
  259. test/test038/hello.sh
  260. test039.answer: results mes-m2
  261. test/test039/hello.sh
  262. test040.answer: results mes-m2
  263. test/test040/hello.sh
  264. test041.answer: results mes-m2
  265. test/test041/hello.sh
  266. test042.answer: results mes-m2
  267. test/test042/hello.sh
  268. test043.answer: results mes-m2
  269. test/test043/hello.sh
  270. test044.answer: results mes-m2
  271. test/test044/hello.sh
  272. test045.answer: results mes-m2
  273. test/test045/hello.sh
  274. test046.answer: results mes-m2
  275. test/test046/hello.sh
  276. test047.answer: results mes-m2
  277. test/test047/hello.sh
  278. test048.answer: results mes-m2
  279. test/test048/hello.sh
  280. test049.answer: results mes-m2
  281. test/test049/hello.sh
  282. test050.answer: results mes-m2
  283. test/test050/hello.sh
  284. test051.answer: results mes-m2
  285. test/test051/hello.sh
  286. test052.answer: results mes-m2
  287. test/test052/hello.sh
  288. test053.answer: results mes-m2
  289. test/test053/hello.sh
  290. test054.answer: results mes-m2
  291. test/test054/hello.sh
  292. test055.answer: results mes-m2
  293. test/test055/hello.sh
  294. test056.answer: results mes-m2
  295. test/test056/hello.sh
  296. test057.answer: results mes-m2
  297. test/test057/hello.sh
  298. test058.answer: results mes-m2
  299. test/test058/hello.sh
  300. test059.answer: results mes-m2
  301. test/test059/hello.sh
  302. test060.answer: results mes-m2
  303. test/test060/hello.sh
  304. test061.answer: results mes-m2
  305. test/test061/hello.sh
  306. test062.answer: results mes-m2
  307. test/test062/hello.sh
  308. test063.answer: results mes-m2
  309. test/test063/hello.sh
  310. test064.answer: results mes-m2
  311. test/test064/hello.sh
  312. test065.answer: results mes-m2
  313. test/test065/hello.sh
  314. test066.answer: results mes-m2
  315. test/test066/hello.sh
  316. test067.answer: results mes-m2
  317. test/test067/hello.sh
  318. test068.answer: results mes-m2
  319. test/test068/hello.sh
  320. test100.answer: results mes-m2
  321. test/test100/hello.sh
  322. test101.answer: results mes-m2
  323. test/test101/hello.sh
  324. test102.answer: results mes-m2
  325. test/test102/hello.sh
  326. test103.answer: results mes-m2
  327. test/test103/hello.sh
  328. test104.answer: results mes-m2
  329. test/test104/hello.sh
  330. test105.answer: results mes-m2
  331. test/test105/hello.sh
  332. test106.answer: results mes-m2
  333. test/test106/hello.sh
  334. test107.answer: results mes-m2
  335. test/test107/hello.sh
  336. test108.answer: results mes-m2
  337. test/test108/hello.sh
  338. test109.answer: results mes-m2
  339. test/test109/hello.sh
  340. test110.answer: results mes-m2
  341. test/test110/hello.sh
  342. test111.answer: results mes-m2
  343. test/test111/hello.sh
  344. test112.answer: results mes-m2
  345. test/test112/hello.sh
  346. test113.answer: results mes-m2
  347. test/test113/hello.sh
  348. test114.answer: results mes-m2
  349. test/test114/hello.sh
  350. test115.answer: results mes-m2
  351. test/test115/hello.sh
  352. test116.answer: results mes-m2
  353. test/test116/hello.sh
  354. test117.answer: results mes-m2
  355. test/test117/hello.sh
  356. test118.answer: results mes-m2
  357. test/test118/hello.sh
  358. test119.answer: results mes-m2
  359. test/test119/hello.sh
  360. test120.answer: results mes-m2
  361. test/test120/hello.sh
  362. test121.answer: results mes-m2
  363. test/test121/hello.sh
  364. test122.answer: results mes-m2
  365. test/test122/hello.sh
  366. test123.answer: results mes-m2
  367. test/test123/hello.sh
  368. test124.answer: results mes-m2
  369. test/test124/hello.sh
  370. test125.answer: results mes-m2
  371. test/test125/hello.sh
  372. test126.answer: results mes-m2
  373. test/test126/hello.sh
  374. test127.answer: results mes-m2
  375. test/test127/hello.sh
  376. test128.answer: results mes-m2
  377. test/test128/hello.sh
  378. test129.answer: results mes-m2
  379. test/test129/hello.sh
  380. test130.answer: results mes-m2
  381. test/test130/hello.sh
  382. test131.answer: results mes-m2
  383. test/test131/hello.sh
  384. test132.answer: results mes-m2
  385. test/test132/hello.sh
  386. test133.answer: results mes-m2
  387. test/test133/hello.sh
  388. test200-binary: results mes-m2
  389. test/test200/hello.sh
  390. # Generate test answers
  391. .PHONY: Generate-test-answers
  392. Generate-test-answers:
  393. sha256sum test/results/* >| test/test.answers
  394. DESTDIR:=
  395. PREFIX:=/usr/local
  396. bindir:=$(DESTDIR)$(PREFIX)/bin
  397. .PHONY: install
  398. install: mes-m2-boot
  399. mkdir -p $(bindir)
  400. cp bin/mes $(bindir)