core_app.mk 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473
  1. # Core: Building applications.
  2. CORE_APP_CASES = asn1 auto-git-id erlc-exclude erlc-opts erlc-opts-filter error generate-erl generate-erl-include generate-erl-prepend hrl hrl-recursive mib no-app no-makedep pt pt-erlc-opts xrl xrl-include yrl yrl-include
  3. CORE_APP_TARGETS = $(addprefix core-app-,$(CORE_APP_CASES))
  4. CORE_APP_CLEAN_TARGETS = $(addprefix clean-,$(CORE_APP_TARGETS))
  5. .PHONY: core-app $(CORE_APP_TARGETS) clean-core-app $(CORE_APP_CLEAN_TARGETS)
  6. clean-core-app: $(CORE_APP_CLEAN_TARGETS)
  7. $(CORE_APP_CLEAN_TARGETS):
  8. $t rm -rf $(APP_TO_CLEAN)/
  9. core-app: $(CORE_APP_TARGETS)
  10. core-app-asn1: build clean-core-app-asn1
  11. $i "Bootstrap a new OTP library named $(APP)"
  12. $t mkdir $(APP)/
  13. $t cp ../erlang.mk $(APP)/
  14. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  15. $i "Download .asn1 files from Erlang/OTP"
  16. $t mkdir $(APP)/asn1/
  17. $t curl -s -o $(APP)/asn1/CAP.asn1 $(OTP_MASTER)/lib/asn1/test/asn1_SUITE_data/CAP.asn1
  18. $t curl -s -o $(APP)/asn1/Def.asn1 $(OTP_MASTER)/lib/asn1/test/asn1_SUITE_data/Def.asn1
  19. $i "Generate .erl files dependent from headers generated by .asn1 files"
  20. $t printf "%s\n" "-module(use_cap)." "-include(\"CAP.hrl\")." > $(APP)/src/use_cap.erl
  21. $t printf "%s\n" "-module(use_def)." "-include(\"Def.hrl\")." > $(APP)/src/use_def.erl
  22. $i "Generate an unrelated .hrl file"
  23. $t mkdir $(APP)/include/
  24. $t touch $(APP)/include/unrelated.hrl
  25. $i "Build the application"
  26. $t $(MAKE) -C $(APP) $v
  27. $i "Check that all compiled files exist"
  28. $t test -f $(APP)/$(APP).d
  29. $t test -f $(APP)/ebin/$(APP).app
  30. $t test -f $(APP)/ebin/CAP.beam
  31. $t test -f $(APP)/ebin/Def.beam
  32. $t test -f $(APP)/ebin/use_cap.beam
  33. $t test -f $(APP)/ebin/use_def.beam
  34. $t test -f $(APP)/include/CAP.asn1db
  35. $t test -f $(APP)/include/CAP.hrl
  36. $t test -f $(APP)/include/Def.asn1db
  37. $t test -f $(APP)/include/Def.hrl
  38. $t test -f $(APP)/src/CAP.erl
  39. $t test -f $(APP)/src/Def.erl
  40. $i "Check that the application was compiled correctly"
  41. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  42. ok = application:start($(APP)), \
  43. {ok, Mods = ['CAP', 'Def', use_cap, use_def]} \
  44. = application:get_key($(APP), modules), \
  45. [{module, M} = code:load_file(M) || M <- Mods], \
  46. halt()"
  47. $i "Touch one .asn1 file; check that only required files are rebuilt"
  48. # The use_cap.erl gets touched because of its dependency to CAP.hrl.
  49. $t printf "%s\n" \
  50. $(APP)/$(APP).d \
  51. $(APP)/ebin/$(APP).app \
  52. $(APP)/ebin/CAP.beam \
  53. $(APP)/ebin/use_cap.beam \
  54. $(APP)/include/CAP.asn1db \
  55. $(APP)/include/CAP.hrl \
  56. $(APP)/src/CAP.erl \
  57. $(APP)/src/use_cap.erl | sort > $(APP)/EXPECT
  58. $t touch $(APP)/asn1/CAP.asn1
  59. $t $(MAKE) -C $(APP) $v
  60. $t find $(APP) -type f -newer $(APP)/asn1/CAP.asn1 | sort | diff $(APP)/EXPECT -
  61. $t rm $(APP)/EXPECT
  62. $i "Check that the application was compiled correctly"
  63. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  64. ok = application:start($(APP)), \
  65. {ok, Mods = ['CAP', 'Def', use_cap, use_def]} \
  66. = application:get_key($(APP), modules), \
  67. [{module, M} = code:load_file(M) || M <- Mods], \
  68. halt()"
  69. $i "Clean the application"
  70. $t $(MAKE) -C $(APP) clean $v
  71. $i "Check that source files still exist"
  72. $t test -f $(APP)/Makefile
  73. $t test -f $(APP)/erlang.mk
  74. $t test -f $(APP)/asn1/CAP.asn1
  75. $t test -f $(APP)/asn1/Def.asn1
  76. $t test -f $(APP)/include/unrelated.hrl
  77. ifdef LEGACY
  78. $t test -f $(APP)/src/$(APP).app.src
  79. endif
  80. $t test -f $(APP)/src/use_cap.erl
  81. $t test -f $(APP)/src/use_def.erl
  82. $i "Check that all build artifacts are removed, including intermediates"
  83. $t test ! -e $(APP)/$(APP).d
  84. $t test ! -e $(APP)/ebin/
  85. $t test ! -e $(APP)/include/CAP.asn1db
  86. $t test ! -e $(APP)/include/CAP.hrl
  87. $t test ! -e $(APP)/include/Def.asn1db
  88. $t test ! -e $(APP)/include/Def.hrl
  89. $t test ! -e $(APP)/src/CAP.erl
  90. $t test ! -e $(APP)/src/Def.erl
  91. $i "Build the application again"
  92. $t $(MAKE) -C $(APP) $v
  93. $i "Check that all compiled files exist"
  94. $t test -f $(APP)/$(APP).d
  95. $t test -f $(APP)/ebin/$(APP).app
  96. $t test -f $(APP)/ebin/CAP.beam
  97. $t test -f $(APP)/ebin/Def.beam
  98. $t test -f $(APP)/ebin/use_cap.beam
  99. $t test -f $(APP)/ebin/use_def.beam
  100. $t test -f $(APP)/include/CAP.asn1db
  101. $t test -f $(APP)/include/CAP.hrl
  102. $t test -f $(APP)/include/Def.asn1db
  103. $t test -f $(APP)/include/Def.hrl
  104. $t test -f $(APP)/src/CAP.erl
  105. $t test -f $(APP)/src/Def.erl
  106. $i "Check that the application was compiled correctly"
  107. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  108. ok = application:start($(APP)), \
  109. {ok, Mods = ['CAP', 'Def', use_cap, use_def]} \
  110. = application:get_key($(APP), modules), \
  111. [{module, M} = code:load_file(M) || M <- Mods], \
  112. halt()"
  113. core-app-auto-git-id: build clean-core-app-auto-git-id
  114. $i "Bootstrap a new OTP library named $(APP)"
  115. $t mkdir $(APP)/
  116. $t cp ../erlang.mk $(APP)/
  117. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  118. $i "Make it a git repository"
  119. $t cd $(APP) && \
  120. git init -q && \
  121. git config user.email "testsuite@erlang.mk" && \
  122. git config user.name "test suite" && \
  123. git add . && \
  124. git commit -q -m "Tests"
  125. $i "Build the application"
  126. $t $(MAKE) -C $(APP) $v
  127. ifdef LEGACY
  128. # Legacy replaces {id, "git"} always regardless of built as a dependency.
  129. $i "Check that the generated .app file has an id key"
  130. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  131. ok = application:start($(APP)), \
  132. {ok, ID} = application:get_key($(APP), id), \
  133. true = ID =/= [], \
  134. halt()"
  135. else
  136. # If there is no .app.src though, only fill in id when built as a dependency.
  137. $i "Check that the generated .app file has no id key"
  138. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  139. ok = application:start($(APP)), \
  140. {ok, []} = application:get_key($(APP), id), \
  141. halt()"
  142. endif
  143. $i "Clean the application"
  144. $t $(MAKE) -C $(APP) clean $v
  145. $i "Build the application with IS_DEP=1"
  146. $t $(MAKE) -C $(APP) IS_DEP=1 $v
  147. $i "Check that the generated .app file has an id key"
  148. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  149. ok = application:start($(APP)), \
  150. {ok, ID} = application:get_key($(APP), id), \
  151. true = ID =/= [], \
  152. halt()"
  153. core-app-erlc-exclude: build clean-core-app-erlc-exclude
  154. $i "Bootstrap a new OTP library named $(APP)"
  155. $t mkdir $(APP)/
  156. $t cp ../erlang.mk $(APP)/
  157. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  158. $i "Generate .erl files"
  159. $t echo "-module(boy)." > $(APP)/src/boy.erl
  160. $t echo "-module(girl)." > $(APP)/src/girl.erl
  161. $i "Exclude boy.erl from the compilation"
  162. $t echo "ERLC_EXCLUDE = boy" >> $(APP)/Makefile
  163. $i "Build the application"
  164. $t $(MAKE) -C $(APP) $v
  165. $i "Check that boy.erl was not compiled"
  166. $t test ! -e $(APP)/ebin/boy.beam
  167. $i "Check that the application was compiled correctly (without boy.erl)"
  168. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  169. ok = application:start($(APP)), \
  170. {ok, Mods = [girl]} \
  171. = application:get_key($(APP), modules), \
  172. [{module, M} = code:load_file(M) || M <- Mods], \
  173. halt()"
  174. core-app-erlc-opts: build clean-core-app-erlc-opts
  175. $i "Bootstrap a new OTP library named $(APP)"
  176. $t mkdir $(APP)/
  177. $t cp ../erlang.mk $(APP)/
  178. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  179. $i "Define an empty ERLC_OPTS (without debug_info)"
  180. $t echo "ERLC_OPTS =" >> $(APP)/Makefile
  181. $i "Generate .erl files"
  182. $t echo "-module(boy)." > $(APP)/src/boy.erl
  183. $t echo "-module(girl)." > $(APP)/src/girl.erl
  184. $i "Build the application"
  185. $t $(MAKE) -C $(APP) $v
  186. $i "Check that the application was compiled correctly (without debug_info)"
  187. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  188. ok = application:start($(APP)), \
  189. {ok, Mods = [boy, girl]} \
  190. = application:get_key($(APP), modules), \
  191. [{module, M} = code:load_file(M) || M <- Mods], \
  192. false = proplists:is_defined(debug_info, proplists:get_value(options, boy:module_info(compile))), \
  193. false = proplists:is_defined(debug_info, proplists:get_value(options, girl:module_info(compile))), \
  194. halt()"
  195. core-app-erlc-opts-filter: build clean-core-app-erlc-opts-filter
  196. $i "Bootstrap a new OTP library named $(APP)"
  197. $t mkdir $(APP)/
  198. $t cp ../erlang.mk $(APP)/
  199. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  200. $i "Define ERLC_OPTS filtering out debug_info"
  201. $t echo "ERLC_OPTS := \$$(filter-out +debug_info,\$$(ERLC_OPTS))" >> $(APP)/Makefile
  202. $i "Generate .erl files"
  203. $t echo "-module(boy)." > $(APP)/src/boy.erl
  204. $t echo "-module(girl)." > $(APP)/src/girl.erl
  205. $i "Build the application"
  206. $t $(MAKE) -C $(APP) $v
  207. $i "Check that the application was compiled correctly (without debug_info)"
  208. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  209. ok = application:start($(APP)), \
  210. {ok, Mods = [boy, girl]} \
  211. = application:get_key($(APP), modules), \
  212. [{module, M} = code:load_file(M) || M <- Mods], \
  213. false = proplists:is_defined(debug_info, proplists:get_value(options, boy:module_info(compile))), \
  214. false = proplists:is_defined(debug_info, proplists:get_value(options, girl:module_info(compile))), \
  215. halt()"
  216. core-app-error: build clean-core-app-error
  217. $i "Bootstrap a new OTP library named $(APP)"
  218. $t mkdir $(APP)/
  219. $t cp ../erlang.mk $(APP)/
  220. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  221. $i "Generate a bad .erl files"
  222. $t touch $(APP)/src/breaking.erl
  223. $i "Generate unrelated .erl files"
  224. $t echo "-module(boy)." > $(APP)/src/boy.erl
  225. $t echo "-module(girl)." > $(APP)/src/girl.erl
  226. $i "Check that trying to build returns non-zero"
  227. $t if $(MAKE) -C $(APP) $v; then false; fi
  228. core-app-generate-erl: build clean-core-app-generate-erl
  229. $i "Bootstrap a new OTP library named $(APP)"
  230. $t mkdir $(APP)/
  231. $t cp ../erlang.mk $(APP)/
  232. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  233. $i "Create a fake script file to be used as dependency"
  234. $t touch $(APP)/script.sh
  235. $i "Append rules to the Makefile to generate a .erl module"
  236. $t echo "\$$(PROJECT).d:: src/generated.erl" >> $(APP)/Makefile
  237. $t echo "src/generated.erl:: script.sh; echo \"-module(generated).\" > \$$@" >> $(APP)/Makefile
  238. $i "Generate unrelated .erl files"
  239. $t echo "-module(boy)." > $(APP)/src/boy.erl
  240. $t echo "-module(girl)." > $(APP)/src/girl.erl
  241. $i "Build the application"
  242. $t $(MAKE) -C $(APP) $v
  243. $i "Check that all compiled files exist"
  244. $t test -f $(APP)/$(APP).d
  245. $t test -f $(APP)/ebin/$(APP).app
  246. $t test -f $(APP)/ebin/boy.beam
  247. $t test -f $(APP)/ebin/generated.beam
  248. $t test -f $(APP)/ebin/girl.beam
  249. $t test -f $(APP)/src/generated.erl
  250. $i "Check that the application was compiled correctly"
  251. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  252. ok = application:start($(APP)), \
  253. {ok, Mods = [boy, generated, girl]} \
  254. = application:get_key($(APP), modules), \
  255. [{module, M} = code:load_file(M) || M <- Mods], \
  256. halt()"
  257. $i "Touch the script file; check that only required files are rebuilt"
  258. $t printf "%s\n" \
  259. $(APP)/$(APP).d \
  260. $(APP)/ebin/$(APP).app \
  261. $(APP)/ebin/generated.beam \
  262. $(APP)/src/generated.erl | sort > $(APP)/EXPECT
  263. $t touch $(APP)/script.sh
  264. $t $(MAKE) -C $(APP) $v
  265. $t find $(APP) -type f -newer $(APP)/script.sh | sort | diff $(APP)/EXPECT -
  266. $t rm $(APP)/EXPECT
  267. $i "Check that the application was compiled correctly"
  268. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  269. ok = application:start($(APP)), \
  270. {ok, Mods = [boy, generated, girl]} \
  271. = application:get_key($(APP), modules), \
  272. [{module, M} = code:load_file(M) || M <- Mods], \
  273. halt()"
  274. $i "Clean the application"
  275. $t $(MAKE) -C $(APP) clean $v
  276. $i "Check that source files still exist"
  277. $t test -f $(APP)/Makefile
  278. $t test -f $(APP)/erlang.mk
  279. $t test -f $(APP)/script.sh
  280. ifdef LEGACY
  281. $t test -f $(APP)/src/$(APP).app.src
  282. endif
  283. $t test -f $(APP)/src/boy.erl
  284. $t test -f $(APP)/src/girl.erl
  285. $i "Check that the generated .erl file still exists"
  286. $t test -f $(APP)/src/generated.erl
  287. $i "Check that all build artifacts are removed"
  288. $t test ! -e $(APP)/$(APP).d
  289. $t test ! -e $(APP)/ebin/
  290. $i "Add a rule to remove the generated .erl file on clean"
  291. $t echo "clean:: ; rm src/generated.erl" >> $(APP)/Makefile
  292. $i "Clean the application again"
  293. $t $(MAKE) -C $(APP) clean $v
  294. $i "Check that the generated .erl file was removed"
  295. $t test ! -e $(APP)/src/generated.erl
  296. $i "Build the application again"
  297. $t $(MAKE) -C $(APP) $v
  298. $i "Check that all compiled files exist"
  299. $t test -f $(APP)/$(APP).d
  300. $t test -f $(APP)/ebin/$(APP).app
  301. $t test -f $(APP)/ebin/boy.beam
  302. $t test -f $(APP)/ebin/generated.beam
  303. $t test -f $(APP)/ebin/girl.beam
  304. $t test -f $(APP)/src/generated.erl
  305. $i "Check that the application was compiled correctly"
  306. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  307. ok = application:start($(APP)), \
  308. {ok, Mods = [boy, generated, girl]} \
  309. = application:get_key($(APP), modules), \
  310. [{module, M} = code:load_file(M) || M <- Mods], \
  311. halt()"
  312. core-app-generate-erl-include: build clean-core-app-generate-erl-include
  313. $i "Bootstrap a new OTP library named $(APP)"
  314. $t mkdir $(APP)/
  315. $t cp ../erlang.mk $(APP)/
  316. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  317. $i "Create a fake script file to be used as dependency"
  318. $t touch $(APP)/script.sh
  319. $i "Append rules to the Makefile to generate a .erl module"
  320. $t echo "\$$(PROJECT).d:: src/generated.erl" >> $(APP)/Makefile
  321. $t echo "src/generated.erl:: script.sh; echo \"-module(generated).\" > \$$@; echo \"-include(\\\"included.hrl\\\").\" >> \$$@" >> $(APP)/Makefile
  322. $i "Generate the .hrl file"
  323. $t mkdir $(APP)/include/
  324. $t touch $(APP)/include/included.hrl
  325. $i "Generate unrelated .erl files"
  326. $t echo "-module(boy)." > $(APP)/src/boy.erl
  327. $t echo "-module(girl)." > $(APP)/src/girl.erl
  328. $i "Build the application"
  329. $t $(MAKE) -C $(APP) $v
  330. $i "Check that all compiled files exist"
  331. $t test -f $(APP)/$(APP).d
  332. $t test -f $(APP)/ebin/$(APP).app
  333. $t test -f $(APP)/ebin/boy.beam
  334. $t test -f $(APP)/ebin/generated.beam
  335. $t test -f $(APP)/ebin/girl.beam
  336. $t test -f $(APP)/src/generated.erl
  337. $i "Check that the application was compiled correctly"
  338. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  339. ok = application:start($(APP)), \
  340. {ok, Mods = [boy, generated, girl]} \
  341. = application:get_key($(APP), modules), \
  342. [{module, M} = code:load_file(M) || M <- Mods], \
  343. halt()"
  344. $i "Touch the .hrl file; check that only required files are rebuilt"
  345. $t printf "%s\n" \
  346. $(APP)/$(APP).d \
  347. $(APP)/ebin/$(APP).app \
  348. $(APP)/ebin/generated.beam \
  349. $(APP)/src/generated.erl | sort > $(APP)/EXPECT
  350. $t touch $(APP)/include/included.hrl
  351. $t $(MAKE) -C $(APP) $v
  352. $t find $(APP) -type f -newer $(APP)/include/included.hrl | sort | diff $(APP)/EXPECT -
  353. $t rm $(APP)/EXPECT
  354. $i "Check that the application was compiled correctly"
  355. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  356. ok = application:start($(APP)), \
  357. {ok, Mods = [boy, generated, girl]} \
  358. = application:get_key($(APP), modules), \
  359. [{module, M} = code:load_file(M) || M <- Mods], \
  360. halt()"
  361. core-app-generate-erl-prepend: build clean-core-app-generate-erl-prepend
  362. $i "Bootstrap a new OTP library named $(APP)"
  363. $t mkdir $(APP)/
  364. $t cp ../erlang.mk $(APP)/
  365. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  366. $i "Create a fake script file to be used as dependency"
  367. $t touch $(APP)/script.sh
  368. $i "Generate a Makefile and prepend rules that generate a .erl module"
  369. $t echo "PROJECT = $(APP)" > $(APP)/Makefile
  370. $t echo ".DEFAULT_GOAL = all" >> $(APP)/Makefile
  371. $t echo "\$$(PROJECT).d:: src/generated.erl" >> $(APP)/Makefile
  372. $t echo "src/generated.erl:: script.sh; echo \"-module(generated).\" > \$$@" >> $(APP)/Makefile
  373. $t echo "include erlang.mk" >> $(APP)/Makefile
  374. $i "Generate unrelated .erl files"
  375. $t echo "-module(boy)." > $(APP)/src/boy.erl
  376. $t echo "-module(girl)." > $(APP)/src/girl.erl
  377. $i "Build the application"
  378. $t $(MAKE) -C $(APP) $v
  379. $i "Check that all compiled files exist"
  380. $t test -f $(APP)/$(APP).d
  381. $t test -f $(APP)/ebin/$(APP).app
  382. $t test -f $(APP)/ebin/boy.beam
  383. $t test -f $(APP)/ebin/generated.beam
  384. $t test -f $(APP)/ebin/girl.beam
  385. $t test -f $(APP)/src/generated.erl
  386. $i "Check that the application was compiled correctly"
  387. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  388. ok = application:start($(APP)), \
  389. {ok, Mods = [boy, generated, girl]} \
  390. = application:get_key($(APP), modules), \
  391. [{module, M} = code:load_file(M) || M <- Mods], \
  392. halt()"
  393. $i "Touch the script file; check that only required files are rebuilt"
  394. $t printf "%s\n" \
  395. $(APP)/$(APP).d \
  396. $(APP)/ebin/$(APP).app \
  397. $(APP)/ebin/generated.beam \
  398. $(APP)/src/generated.erl | sort > $(APP)/EXPECT
  399. $t touch $(APP)/script.sh
  400. $t $(MAKE) -C $(APP) $v
  401. $t find $(APP) -type f -newer $(APP)/script.sh | sort | diff $(APP)/EXPECT -
  402. $t rm $(APP)/EXPECT
  403. $i "Check that the application was compiled correctly"
  404. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  405. ok = application:start($(APP)), \
  406. {ok, Mods = [boy, generated, girl]} \
  407. = application:get_key($(APP), modules), \
  408. [{module, M} = code:load_file(M) || M <- Mods], \
  409. halt()"
  410. $i "Clean the application"
  411. $t $(MAKE) -C $(APP) clean $v
  412. $i "Check that source files still exist"
  413. $t test -f $(APP)/Makefile
  414. $t test -f $(APP)/erlang.mk
  415. $t test -f $(APP)/script.sh
  416. ifdef LEGACY
  417. $t test -f $(APP)/src/$(APP).app.src
  418. endif
  419. $t test -f $(APP)/src/boy.erl
  420. $t test -f $(APP)/src/girl.erl
  421. $i "Check that the generated .erl file still exists"
  422. $t test -f $(APP)/src/generated.erl
  423. $i "Check that all build artifacts are removed"
  424. $t test ! -e $(APP)/$(APP).d
  425. $t test ! -e $(APP)/ebin/
  426. $i "Add a rule to remove the generated .erl file on clean"
  427. $t echo "clean:: ; rm src/generated.erl" >> $(APP)/Makefile
  428. $i "Clean the application again"
  429. $t $(MAKE) -C $(APP) clean $v
  430. $i "Check that the generated .erl file was removed"
  431. $t test ! -e $(APP)/src/generated.erl
  432. $i "Build the application again"
  433. $t $(MAKE) -C $(APP) $v
  434. $i "Check that all compiled files exist"
  435. $t test -f $(APP)/$(APP).d
  436. $t test -f $(APP)/ebin/$(APP).app
  437. $t test -f $(APP)/ebin/boy.beam
  438. $t test -f $(APP)/ebin/generated.beam
  439. $t test -f $(APP)/ebin/girl.beam
  440. $t test -f $(APP)/src/generated.erl
  441. $i "Check that the application was compiled correctly"
  442. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  443. ok = application:start($(APP)), \
  444. {ok, Mods = [boy, generated, girl]} \
  445. = application:get_key($(APP), modules), \
  446. [{module, M} = code:load_file(M) || M <- Mods], \
  447. halt()"
  448. core-app-hrl: build clean-core-app-hrl
  449. $i "Bootstrap a new OTP library named $(APP)"
  450. $t mkdir $(APP)/
  451. $t cp ../erlang.mk $(APP)/
  452. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  453. $i "Generate .hrl files"
  454. $t mkdir $(APP)/include/
  455. $t touch $(APP)/include/blue.hrl $(APP)/include/red.hrl
  456. $i "Generate .erl files dependent from headers"
  457. $t printf "%s\n" "-module(use_blue)." "-include(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  458. $t printf "%s\n" "-module(use_red)." "-include(\"red.hrl\")." > $(APP)/src/use_red.erl
  459. $i "Build the application"
  460. $t $(MAKE) -C $(APP) $v
  461. $i "Check that all compiled files exist"
  462. $t test -f $(APP)/$(APP).d
  463. $t test -f $(APP)/ebin/$(APP).app
  464. $t test -f $(APP)/ebin/use_blue.beam
  465. $t test -f $(APP)/ebin/use_red.beam
  466. $i "Check that the application was compiled correctly"
  467. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  468. ok = application:start($(APP)), \
  469. {ok, Mods = [use_blue, use_red]} \
  470. = application:get_key($(APP), modules), \
  471. [{module, M} = code:load_file(M) || M <- Mods], \
  472. halt()"
  473. $i "Touch one .hrl file; check that only required files are rebuilt"
  474. # The use_red.erl gets touched because of its dependency to red.hrl.
  475. $t printf "%s\n" \
  476. $(APP)/$(APP).d \
  477. $(APP)/ebin/$(APP).app \
  478. $(APP)/ebin/use_red.beam \
  479. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  480. $t touch $(APP)/include/red.hrl
  481. $t $(MAKE) -C $(APP) $v
  482. $t find $(APP) -type f -newer $(APP)/include/red.hrl | sort | diff $(APP)/EXPECT -
  483. $t rm $(APP)/EXPECT
  484. $i "Check that the application was compiled correctly"
  485. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  486. ok = application:start($(APP)), \
  487. {ok, Mods = [use_blue, use_red]} \
  488. = application:get_key($(APP), modules), \
  489. [{module, M} = code:load_file(M) || M <- Mods], \
  490. halt()"
  491. $i "Clean the application"
  492. $t $(MAKE) -C $(APP) clean $v
  493. $i "Check that source files still exist"
  494. $t test -f $(APP)/Makefile
  495. $t test -f $(APP)/erlang.mk
  496. $t test -f $(APP)/include/blue.hrl
  497. $t test -f $(APP)/include/red.hrl
  498. ifdef LEGACY
  499. $t test -f $(APP)/src/$(APP).app.src
  500. endif
  501. $t test -f $(APP)/src/use_blue.erl
  502. $t test -f $(APP)/src/use_red.erl
  503. $i "Check that all build artifacts are removed"
  504. $t test ! -e $(APP)/$(APP).d
  505. $t test ! -e $(APP)/ebin/
  506. $i "Build the application again"
  507. $t $(MAKE) -C $(APP) $v
  508. $i "Check that all compiled files exist"
  509. $t test -f $(APP)/$(APP).d
  510. $t test -f $(APP)/ebin/$(APP).app
  511. $t test -f $(APP)/ebin/use_blue.beam
  512. $t test -f $(APP)/ebin/use_red.beam
  513. $i "Check that the application was compiled correctly"
  514. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  515. ok = application:start($(APP)), \
  516. {ok, Mods = [use_blue, use_red]} \
  517. = application:get_key($(APP), modules), \
  518. [{module, M} = code:load_file(M) || M <- Mods], \
  519. halt()"
  520. core-app-hrl-recursive: build clean-core-app-hrl-recursive
  521. $i "Bootstrap a new OTP library named $(APP)"
  522. $t mkdir $(APP)/
  523. $t cp ../erlang.mk $(APP)/
  524. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  525. $i "Generate .hrl files"
  526. $t mkdir $(APP)/include/
  527. $t touch $(APP)/include/blue.hrl $(APP)/include/pill.hrl
  528. $t echo "-include(\"pill.hrl\")." > $(APP)/include/red.hrl
  529. $i "Generate .erl files dependent from headers"
  530. $t printf "%s\n" "-module(use_blue)." "-include(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  531. $t printf "%s\n" "-module(use_red)." "-include(\"red.hrl\")." > $(APP)/src/use_red.erl
  532. $i "Build the application"
  533. $t $(MAKE) -C $(APP) $v
  534. $i "Check that all compiled files exist"
  535. $t test -f $(APP)/$(APP).d
  536. $t test -f $(APP)/ebin/$(APP).app
  537. $t test -f $(APP)/ebin/use_blue.beam
  538. $t test -f $(APP)/ebin/use_red.beam
  539. $i "Check that the application was compiled correctly"
  540. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  541. ok = application:start($(APP)), \
  542. {ok, Mods = [use_blue, use_red]} \
  543. = application:get_key($(APP), modules), \
  544. [{module, M} = code:load_file(M) || M <- Mods], \
  545. halt()"
  546. $i "Touch the deepest .hrl file; check that only required files are rebuilt"
  547. # The use_red.erl gets touched because of its dependency to red.hrl and pill.hrl.
  548. $t printf "%s\n" \
  549. $(APP)/$(APP).d \
  550. $(APP)/ebin/$(APP).app \
  551. $(APP)/ebin/use_red.beam \
  552. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  553. $t touch $(APP)/include/pill.hrl
  554. $t $(MAKE) -C $(APP) $v
  555. $t find $(APP) -type f -newer $(APP)/include/pill.hrl | sort | diff $(APP)/EXPECT -
  556. $t rm $(APP)/EXPECT
  557. $i "Check that the application was compiled correctly"
  558. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  559. ok = application:start($(APP)), \
  560. {ok, Mods = [use_blue, use_red]} \
  561. = application:get_key($(APP), modules), \
  562. [{module, M} = code:load_file(M) || M <- Mods], \
  563. halt()"
  564. $i "Clean the application"
  565. $t $(MAKE) -C $(APP) clean $v
  566. $i "Check that source files still exist"
  567. $t test -f $(APP)/Makefile
  568. $t test -f $(APP)/erlang.mk
  569. $t test -f $(APP)/include/blue.hrl
  570. $t test -f $(APP)/include/pill.hrl
  571. $t test -f $(APP)/include/red.hrl
  572. ifdef LEGACY
  573. $t test -f $(APP)/src/$(APP).app.src
  574. endif
  575. $t test -f $(APP)/src/use_blue.erl
  576. $t test -f $(APP)/src/use_red.erl
  577. $i "Check that all build artifacts are removed"
  578. $t test ! -e $(APP)/$(APP).d
  579. $t test ! -e $(APP)/ebin/
  580. $i "Build the application again"
  581. $t $(MAKE) -C $(APP) $v
  582. $i "Check that all compiled files exist"
  583. $t test -f $(APP)/$(APP).d
  584. $t test -f $(APP)/ebin/$(APP).app
  585. $t test -f $(APP)/ebin/use_blue.beam
  586. $t test -f $(APP)/ebin/use_red.beam
  587. $i "Check that the application was compiled correctly"
  588. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  589. ok = application:start($(APP)), \
  590. {ok, Mods = [use_blue, use_red]} \
  591. = application:get_key($(APP), modules), \
  592. [{module, M} = code:load_file(M) || M <- Mods], \
  593. halt()"
  594. core-app-mib: build clean-core-app-mib
  595. $i "Bootstrap a new OTP library named $(APP)"
  596. $t mkdir $(APP)/
  597. $t cp ../erlang.mk $(APP)/
  598. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  599. $i "Download .mib files from Erlang/OTP"
  600. $t mkdir $(APP)/mibs/
  601. $t curl -s -o $(APP)/mibs/EX1-MIB.mib $(OTP_MASTER)/lib/snmp/examples/ex1/EX1-MIB.mib
  602. $t curl -s -o $(APP)/mibs/OTP-REG.mib $(OTP_MASTER)/lib/otp_mibs/mibs/OTP-REG.mib
  603. $i "Generate .erl files dependent from headers generated by .mib files"
  604. $t printf "%s\n" "-module(use_v1)." "-include(\"EX1-MIB.hrl\")." > $(APP)/src/use_v1.erl
  605. $t printf "%s\n" "-module(use_v2)." "-include(\"OTP-REG.hrl\")." > $(APP)/src/use_v2.erl
  606. $i "Generate an unrelated .hrl file"
  607. $t mkdir $(APP)/include/
  608. $t touch $(APP)/include/unrelated.hrl
  609. $i "Build the application"
  610. $t $(MAKE) -C $(APP) $v
  611. $i "Check that all compiled files exist"
  612. $t test -f $(APP)/$(APP).d
  613. $t test -f $(APP)/ebin/$(APP).app
  614. $t test -f $(APP)/ebin/use_v1.beam
  615. $t test -f $(APP)/ebin/use_v2.beam
  616. $t test -f $(APP)/include/EX1-MIB.hrl
  617. $t test -f $(APP)/include/OTP-REG.hrl
  618. $t test -f $(APP)/priv/mibs/EX1-MIB.bin
  619. $t test -f $(APP)/priv/mibs/OTP-REG.bin
  620. $i "Check that the application was compiled correctly"
  621. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  622. ok = application:start($(APP)), \
  623. {ok, Mods = [use_v1, use_v2]} \
  624. = application:get_key($(APP), modules), \
  625. [{module, M} = code:load_file(M) || M <- Mods], \
  626. halt()"
  627. $i "Touch one .mib file; check that only required files are rebuilt"
  628. # The use_v1.erl gets touched because of its dependency to EX1-MIB.hrl.
  629. $t printf "%s\n" \
  630. $(APP)/$(APP).d \
  631. $(APP)/ebin/$(APP).app \
  632. $(APP)/ebin/use_v1.beam \
  633. $(APP)/include/EX1-MIB.hrl \
  634. $(APP)/priv/mibs/EX1-MIB.bin \
  635. $(APP)/src/use_v1.erl | sort > $(APP)/EXPECT
  636. $t touch $(APP)/mibs/EX1-MIB.mib
  637. $t $(MAKE) -C $(APP) $v
  638. $t find $(APP) -type f -newer $(APP)/mibs/EX1-MIB.mib | sort | diff $(APP)/EXPECT -
  639. $t rm $(APP)/EXPECT
  640. $i "Check that the application was compiled correctly"
  641. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  642. ok = application:start($(APP)), \
  643. {ok, Mods = [use_v1, use_v2]} \
  644. = application:get_key($(APP), modules), \
  645. [{module, M} = code:load_file(M) || M <- Mods], \
  646. halt()"
  647. $i "Clean the application"
  648. $t $(MAKE) -C $(APP) clean $v
  649. $i "Check that source files still exist"
  650. $t test -f $(APP)/Makefile
  651. $t test -f $(APP)/erlang.mk
  652. $t test -f $(APP)/include/unrelated.hrl
  653. $t test -f $(APP)/mibs/EX1-MIB.mib
  654. $t test -f $(APP)/mibs/OTP-REG.mib
  655. ifdef LEGACY
  656. $t test -f $(APP)/src/$(APP).app.src
  657. endif
  658. $t test -f $(APP)/src/use_v1.erl
  659. $t test -f $(APP)/src/use_v2.erl
  660. $i "Check that all build artifacts are removed, including intermediates"
  661. $t test ! -e $(APP)/$(APP).d
  662. $t test ! -e $(APP)/ebin/
  663. $t test ! -e $(APP)/include/EX1-MIB.hrl
  664. $t test ! -e $(APP)/include/OTP-REG.hrl
  665. $t test ! -e $(APP)/priv/mibs/
  666. $i "Build the application again"
  667. $t $(MAKE) -C $(APP) $v
  668. $i "Check that all compiled files exist"
  669. $t test -f $(APP)/$(APP).d
  670. $t test -f $(APP)/ebin/$(APP).app
  671. $t test -f $(APP)/ebin/use_v1.beam
  672. $t test -f $(APP)/ebin/use_v2.beam
  673. $t test -f $(APP)/include/EX1-MIB.hrl
  674. $t test -f $(APP)/include/OTP-REG.hrl
  675. $t test -f $(APP)/priv/mibs/EX1-MIB.bin
  676. $t test -f $(APP)/priv/mibs/OTP-REG.bin
  677. $i "Check that the application was compiled correctly"
  678. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  679. ok = application:start($(APP)), \
  680. {ok, Mods = [use_v1, use_v2]} \
  681. = application:get_key($(APP), modules), \
  682. [{module, M} = code:load_file(M) || M <- Mods], \
  683. halt()"
  684. core-app-no-app: build clean-core-app-no-app
  685. $i "Bootstrap a project without an OTP library"
  686. $t mkdir $(APP)/
  687. $t cp ../erlang.mk $(APP)/
  688. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  689. $t rm -rf $(APP)/src
  690. $i "Build the project"
  691. $t $(MAKE) -C $(APP) $v
  692. core-app-no-makedep: build clean-core-app-no-makedep
  693. $i "Bootstrap a new OTP library named $(APP)"
  694. $t mkdir $(APP)/
  695. $t cp ../erlang.mk $(APP)/
  696. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  697. $i "Set NO_MAKEDEP ?= 1 in the Makefile"
  698. $t sed -i.bak '2i\
  699. NO_MAKEDEP ?= 1\
  700. ' $(APP)/Makefile
  701. $i "Generate .hrl files"
  702. $t mkdir $(APP)/include/
  703. $t touch $(APP)/include/blue.hrl $(APP)/include/red.hrl
  704. $i "Generate .erl files dependent from headers"
  705. $t printf "%s\n" "-module(use_blue)." "-include(\"blue.hrl\")." > $(APP)/src/use_blue.erl
  706. $t printf "%s\n" "-module(use_red)." "-include(\"red.hrl\")." > $(APP)/src/use_red.erl
  707. $i "Build the application"
  708. $t $(MAKE) -C $(APP) $v
  709. $i "Check that all compiled files exist"
  710. $t test -f $(APP)/$(APP).d
  711. $t test -f $(APP)/ebin/$(APP).app
  712. $t test -f $(APP)/ebin/use_blue.beam
  713. $t test -f $(APP)/ebin/use_red.beam
  714. $i "Check that the application was compiled correctly"
  715. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  716. ok = application:start($(APP)), \
  717. {ok, Mods = [use_blue, use_red]} \
  718. = application:get_key($(APP), modules), \
  719. [{module, M} = code:load_file(M) || M <- Mods], \
  720. halt()"
  721. $i "Touch one .hrl file; check that only required files are rebuilt"
  722. # The use_red.erl gets touched because of its dependency to red.hrl.
  723. $t printf "%s\n" \
  724. $(APP)/ebin/$(APP).app \
  725. $(APP)/ebin/use_red.beam \
  726. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  727. $t touch $(APP)/include/red.hrl
  728. $t $(MAKE) -C $(APP) $v
  729. $t find $(APP) -type f -newer $(APP)/include/red.hrl | sort | diff $(APP)/EXPECT -
  730. $t rm $(APP)/EXPECT
  731. $i "Check that the application was compiled correctly"
  732. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  733. ok = application:start($(APP)), \
  734. {ok, Mods = [use_blue, use_red]} \
  735. = application:get_key($(APP), modules), \
  736. [{module, M} = code:load_file(M) || M <- Mods], \
  737. halt()"
  738. $i "Touch one .hrl file; disable NO_MAKEDEP and check that only required files are rebuilt"
  739. # The use_red.erl gets touched because of its dependency to red.hrl.
  740. $t printf "%s\n" \
  741. $(APP)/$(APP).d \
  742. $(APP)/ebin/$(APP).app \
  743. $(APP)/ebin/use_red.beam \
  744. $(APP)/src/use_red.erl | sort > $(APP)/EXPECT
  745. $t touch $(APP)/include/red.hrl
  746. $t NO_MAKEDEP= $(MAKE) -C $(APP) $v
  747. $t find $(APP) -type f -newer $(APP)/include/red.hrl | sort | diff $(APP)/EXPECT -
  748. $t rm $(APP)/EXPECT
  749. $i "Check that the application was compiled correctly"
  750. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  751. ok = application:start($(APP)), \
  752. {ok, Mods = [use_blue, use_red]} \
  753. = application:get_key($(APP), modules), \
  754. [{module, M} = code:load_file(M) || M <- Mods], \
  755. halt()"
  756. $i "Clean the application"
  757. $t $(MAKE) -C $(APP) clean $v
  758. $i "Check that source files still exist"
  759. $t test -f $(APP)/Makefile
  760. $t test -f $(APP)/erlang.mk
  761. $t test -f $(APP)/include/blue.hrl
  762. $t test -f $(APP)/include/red.hrl
  763. ifdef LEGACY
  764. $t test -f $(APP)/src/$(APP).app.src
  765. endif
  766. $t test -f $(APP)/src/use_blue.erl
  767. $t test -f $(APP)/src/use_red.erl
  768. $i "Check that all build artifacts are removed"
  769. $t test ! -e $(APP)/$(APP).d
  770. $t test ! -e $(APP)/ebin/
  771. $i "Build the application again"
  772. $t $(MAKE) -C $(APP) $v
  773. $i "Check that all compiled files exist"
  774. $t test -f $(APP)/$(APP).d
  775. $t test -f $(APP)/ebin/$(APP).app
  776. $t test -f $(APP)/ebin/use_blue.beam
  777. $t test -f $(APP)/ebin/use_red.beam
  778. $i "Check that the application was compiled correctly"
  779. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  780. ok = application:start($(APP)), \
  781. {ok, Mods = [use_blue, use_red]} \
  782. = application:get_key($(APP), modules), \
  783. [{module, M} = code:load_file(M) || M <- Mods], \
  784. halt()"
  785. core-app-pt: build clean-core-app-pt
  786. $i "Bootstrap a new OTP library named $(APP)"
  787. $t mkdir $(APP)/
  788. $t cp ../erlang.mk $(APP)/
  789. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  790. $i "Generate a parse_transform module"
  791. $t printf "%s\n" \
  792. "-module(my_pt)." \
  793. "-export([parse_transform/2])." \
  794. "parse_transform(Forms, _) ->" \
  795. " io:format(\"*** Running my_pt parse_transform.~n\")," \
  796. " Forms." > $(APP)/src/my_pt.erl
  797. $i "Generate a .erl file that uses the my_pt parse_transform"
  798. $t printf "%s\n" \
  799. "-module(my_user)." \
  800. "-compile({parse_transform, my_pt})." > $(APP)/src/my_user.erl
  801. $i "Compile my_pt first"
  802. $t echo "COMPILE_FIRST += my_pt" >> $(APP)/Makefile
  803. $i "Build the application; confirm the parse_transform is used"
  804. $t $(MAKE) -C $(APP) | grep "*** Running my_pt parse_transform."
  805. $i "Check that the application was compiled correctly"
  806. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  807. ok = application:start($(APP)), \
  808. {ok, Mods = [my_pt, my_user]} = application:get_key($(APP), modules), \
  809. [{module, M} = code:load_file(M) || M <- Mods], \
  810. halt()"
  811. core-app-pt-erlc-opts: build clean-core-app-pt-erlc-opts
  812. $i "Bootstrap a new OTP library named $(APP)"
  813. $t mkdir $(APP)/
  814. $t cp ../erlang.mk $(APP)/
  815. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  816. $i "Bootstrap a new OTP library in $(APP)/deps/my_pt_dep"
  817. $t mkdir -p $(APP)/deps/my_pt_dep/
  818. $t cp ../erlang.mk $(APP)/deps/my_pt_dep/
  819. $t $(MAKE) -C $(APP)/deps/my_pt_dep/ -f erlang.mk bootstrap-lib $v
  820. $i "Generate a parse_transform module in my_pt_dep"
  821. $t printf "%s\n" \
  822. "-module(my_pt)." \
  823. "-export([parse_transform/2])." \
  824. "parse_transform(Forms, _) ->" \
  825. " io:format(\"*** Running my_pt parse_transform.~n\")," \
  826. " Forms." > $(APP)/deps/my_pt_dep/src/my_pt.erl
  827. $i "Add my_pt_dep to the list of dependencies"
  828. $t sed -i.bak '2i\
  829. BUILD_DEPS = my_pt_dep\
  830. ' $(APP)/Makefile
  831. $i "Generate .erl files"
  832. $t echo "-module(boy)." > $(APP)/src/boy.erl
  833. $t echo "-module(girl)." > $(APP)/src/girl.erl
  834. $i "Add the my_pt parse_transform to ERLC_OPTS"
  835. $t echo "ERLC_OPTS += +'{parse_transform, my_pt}'" >> $(APP)/Makefile
  836. $i "Build the application; confirm the parse_transform is used"
  837. $t $(MAKE) -C $(APP) | grep "*** Running my_pt parse_transform."
  838. $i "Check that the application was compiled correctly"
  839. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  840. ok = application:start($(APP)), \
  841. {ok, Mods = [boy, girl]} = application:get_key($(APP), modules), \
  842. [{module, M} = code:load_file(M) || M <- Mods], \
  843. halt()"
  844. core-app-xrl: build clean-core-app-xrl
  845. $i "Bootstrap a new OTP library named $(APP)"
  846. $t mkdir $(APP)/
  847. $t cp ../erlang.mk $(APP)/
  848. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  849. $i "Download .xrl files from Robert"
  850. $t curl -s -o $(APP)/src/erlang_scan.xrl https://raw.githubusercontent.com/rvirding/leex/master/examples/erlang_scan.xrl
  851. $t curl -s -o $(APP)/src/lfe_scan.xrl https://raw.githubusercontent.com/rvirding/leex/master/examples/lfe_scan.xrl
  852. $i "Generate unrelated .erl files"
  853. $t echo "-module(boy)." > $(APP)/src/boy.erl
  854. $t echo "-module(girl)." > $(APP)/src/girl.erl
  855. $i "Disable warnings; our test .xrl files aren't perfect"
  856. $t echo "ERLC_OPTS=+debug_info" >> $(APP)/Makefile
  857. $i "Build the application"
  858. $t $(MAKE) -C $(APP) $v
  859. $i "Check that all compiled files exist"
  860. $t test -f $(APP)/$(APP).d
  861. $t test -f $(APP)/ebin/$(APP).app
  862. $t test -f $(APP)/ebin/boy.beam
  863. $t test -f $(APP)/ebin/erlang_scan.beam
  864. $t test -f $(APP)/ebin/girl.beam
  865. $t test -f $(APP)/ebin/lfe_scan.beam
  866. $t test -f $(APP)/src/erlang_scan.erl
  867. $t test -f $(APP)/src/lfe_scan.erl
  868. $i "Check that the application was compiled correctly"
  869. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  870. ok = application:start($(APP)), \
  871. {ok, Mods = [boy, erlang_scan, girl, lfe_scan]} \
  872. = application:get_key($(APP), modules), \
  873. [{module, M} = code:load_file(M) || M <- Mods], \
  874. halt()"
  875. $i "Touch one .xrl file; check that only required files are rebuilt"
  876. $t printf "%s\n" \
  877. $(APP)/$(APP).d \
  878. $(APP)/ebin/$(APP).app \
  879. $(APP)/ebin/erlang_scan.beam \
  880. $(APP)/src/erlang_scan.erl | sort > $(APP)/EXPECT
  881. $t touch $(APP)/src/erlang_scan.xrl
  882. $t $(MAKE) -C $(APP) $v
  883. $t find $(APP) -type f -newer $(APP)/src/erlang_scan.xrl | sort | diff $(APP)/EXPECT -
  884. $t rm $(APP)/EXPECT
  885. $i "Check that the application was compiled correctly"
  886. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  887. ok = application:start($(APP)), \
  888. {ok, Mods = [boy, erlang_scan, girl, lfe_scan]} \
  889. = application:get_key($(APP), modules), \
  890. [{module, M} = code:load_file(M) || M <- Mods], \
  891. halt()"
  892. $i "Clean the application"
  893. $t $(MAKE) -C $(APP) clean $v
  894. $i "Check that source files still exist"
  895. $t test -f $(APP)/Makefile
  896. $t test -f $(APP)/erlang.mk
  897. ifdef LEGACY
  898. $t test -f $(APP)/src/$(APP).app.src
  899. endif
  900. $t test -f $(APP)/src/boy.erl
  901. $t test -f $(APP)/src/erlang_scan.xrl
  902. $t test -f $(APP)/src/girl.erl
  903. $t test -f $(APP)/src/lfe_scan.xrl
  904. $i "Check that all build artifacts are removed, including intermediates"
  905. $t test ! -e $(APP)/$(APP).d
  906. $t test ! -e $(APP)/ebin/
  907. $t test ! -e $(APP)/src/erlang_scan.erl
  908. $t test ! -e $(APP)/src/lfe_scan.erl
  909. $i "Build the application again"
  910. $t $(MAKE) -C $(APP) $v
  911. $i "Check that all compiled files exist"
  912. $t test -f $(APP)/$(APP).d
  913. $t test -f $(APP)/ebin/$(APP).app
  914. $t test -f $(APP)/ebin/boy.beam
  915. $t test -f $(APP)/ebin/erlang_scan.beam
  916. $t test -f $(APP)/ebin/girl.beam
  917. $t test -f $(APP)/ebin/lfe_scan.beam
  918. $t test -f $(APP)/src/erlang_scan.erl
  919. $t test -f $(APP)/src/lfe_scan.erl
  920. $i "Check that the application was compiled correctly"
  921. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  922. ok = application:start($(APP)), \
  923. {ok, Mods = [boy, erlang_scan, girl, lfe_scan]} \
  924. = application:get_key($(APP), modules), \
  925. [{module, M} = code:load_file(M) || M <- Mods], \
  926. halt()"
  927. core-app-xrl-include: build clean-core-app-xrl-include
  928. $i "Bootstrap a new OTP library named $(APP)"
  929. $t mkdir $(APP)/
  930. $t cp ../erlang.mk $(APP)/
  931. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  932. $i "Download a .xrl file with numerous includes from Gordon"
  933. $t curl -s -o $(APP)/src/xfl_lexer.xrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/formula_engine-1.0/priv/xfl_lexer.xrl
  934. $t curl -s -o $(APP)/src/errvals.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/errvals.hrl
  935. $t curl -s -o $(APP)/src/muin_proc_dict.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/muin_proc_dict.hrl
  936. $t curl -s -o $(APP)/src/muin_records.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/muin_records.hrl
  937. $t curl -s -o $(APP)/src/typechecks.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/typechecks.hrl
  938. $i "Generate unrelated .erl files"
  939. $t echo "-module(boy)." > $(APP)/src/boy.erl
  940. $t echo "-module(girl)." > $(APP)/src/girl.erl
  941. $i "Disable warnings; our test .xrl files aren't perfect"
  942. $t echo "ERLC_OPTS=+debug_info" >> $(APP)/Makefile
  943. $i "Build the application"
  944. $t $(MAKE) -C $(APP) $v
  945. $i "Check that all compiled files exist"
  946. $t test -f $(APP)/$(APP).d
  947. $t test -f $(APP)/ebin/$(APP).app
  948. $t test -f $(APP)/ebin/boy.beam
  949. $t test -f $(APP)/ebin/girl.beam
  950. $t test -f $(APP)/ebin/xfl_lexer.beam
  951. $t test -f $(APP)/src/xfl_lexer.erl
  952. $i "Check that the application was compiled correctly"
  953. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  954. ok = application:start($(APP)), \
  955. {ok, Mods = [boy, girl, xfl_lexer]} \
  956. = application:get_key($(APP), modules), \
  957. [{module, M} = code:load_file(M) || M <- Mods], \
  958. halt()"
  959. $i "Touch the .xrl file; check that only required files are rebuilt"
  960. $t printf "%s\n" \
  961. $(APP)/$(APP).d \
  962. $(APP)/ebin/$(APP).app \
  963. $(APP)/ebin/xfl_lexer.beam \
  964. $(APP)/src/xfl_lexer.erl | sort > $(APP)/EXPECT
  965. $t touch $(APP)/src/xfl_lexer.xrl
  966. $t $(MAKE) -C $(APP) $v
  967. $t find $(APP) -type f -newer $(APP)/src/xfl_lexer.xrl | sort | diff $(APP)/EXPECT -
  968. $t rm $(APP)/EXPECT
  969. $i "Check that the application was compiled correctly"
  970. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  971. ok = application:start($(APP)), \
  972. {ok, Mods = [boy, girl, xfl_lexer]} \
  973. = application:get_key($(APP), modules), \
  974. [{module, M} = code:load_file(M) || M <- Mods], \
  975. halt()"
  976. $i "Touch a .hrl file included directly; check that only required files are rebuilt"
  977. $t printf "%s\n" \
  978. $(APP)/$(APP).d \
  979. $(APP)/ebin/$(APP).app \
  980. $(APP)/ebin/xfl_lexer.beam \
  981. $(APP)/src/xfl_lexer.erl | sort > $(APP)/EXPECT
  982. $t touch $(APP)/src/typechecks.hrl
  983. $t $(MAKE) -C $(APP) $v
  984. $t find $(APP) -type f -newer $(APP)/src/typechecks.hrl | sort | diff $(APP)/EXPECT -
  985. $t rm $(APP)/EXPECT
  986. $i "Check that the application was compiled correctly"
  987. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  988. ok = application:start($(APP)), \
  989. {ok, Mods = [boy, girl, xfl_lexer]} \
  990. = application:get_key($(APP), modules), \
  991. [{module, M} = code:load_file(M) || M <- Mods], \
  992. halt()"
  993. $i "Touch a .hrl file included indirectly; check that only required files are rebuilt"
  994. $t printf "%s\n" \
  995. $(APP)/$(APP).d \
  996. $(APP)/ebin/$(APP).app \
  997. $(APP)/ebin/xfl_lexer.beam \
  998. $(APP)/src/xfl_lexer.erl | sort > $(APP)/EXPECT
  999. $t touch $(APP)/src/errvals.hrl
  1000. $t $(MAKE) -C $(APP) $v
  1001. $t find $(APP) -type f -newer $(APP)/src/errvals.hrl | sort | diff $(APP)/EXPECT -
  1002. $t rm $(APP)/EXPECT
  1003. $i "Check that the application was compiled correctly"
  1004. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1005. ok = application:start($(APP)), \
  1006. {ok, Mods = [boy, girl, xfl_lexer]} \
  1007. = application:get_key($(APP), modules), \
  1008. [{module, M} = code:load_file(M) || M <- Mods], \
  1009. halt()"
  1010. $i "Clean the application"
  1011. $t $(MAKE) -C $(APP) clean $v
  1012. $i "Check that source files still exist"
  1013. $t test -f $(APP)/Makefile
  1014. $t test -f $(APP)/erlang.mk
  1015. ifdef LEGACY
  1016. $t test -f $(APP)/src/$(APP).app.src
  1017. endif
  1018. $t test -f $(APP)/src/boy.erl
  1019. $t test -f $(APP)/src/girl.erl
  1020. $t test -f $(APP)/src/errvals.hrl
  1021. $t test -f $(APP)/src/muin_proc_dict.hrl
  1022. $t test -f $(APP)/src/muin_records.hrl
  1023. $t test -f $(APP)/src/typechecks.hrl
  1024. $t test -f $(APP)/src/xfl_lexer.xrl
  1025. $i "Check that all build artifacts are removed, including intermediates"
  1026. $t test ! -e $(APP)/$(APP).d
  1027. $t test ! -e $(APP)/ebin/
  1028. $t test ! -e $(APP)/src/xfl_lexer.erl
  1029. $i "Build the application again"
  1030. $t $(MAKE) -C $(APP) $v
  1031. $i "Check that all compiled files exist"
  1032. $t test -f $(APP)/$(APP).d
  1033. $t test -f $(APP)/ebin/$(APP).app
  1034. $t test -f $(APP)/ebin/boy.beam
  1035. $t test -f $(APP)/ebin/girl.beam
  1036. $t test -f $(APP)/ebin/xfl_lexer.beam
  1037. $t test -f $(APP)/src/xfl_lexer.erl
  1038. $i "Check that the application was compiled correctly"
  1039. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1040. ok = application:start($(APP)), \
  1041. {ok, Mods = [boy, girl, xfl_lexer]} \
  1042. = application:get_key($(APP), modules), \
  1043. [{module, M} = code:load_file(M) || M <- Mods], \
  1044. halt()"
  1045. core-app-yrl: build clean-core-app-yrl
  1046. $i "Bootstrap a new OTP library named $(APP)"
  1047. $t mkdir $(APP)/
  1048. $t cp ../erlang.mk $(APP)/
  1049. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1050. $i "Download .yrl files from Erlang/OTP"
  1051. $t curl -s -o $(APP)/src/xmerl_xpath_parse.yrl $(OTP_MASTER)/lib/xmerl/src/xmerl_xpath_parse.yrl
  1052. $t curl -s -o $(APP)/src/xref_parser.yrl $(OTP_MASTER)/lib/tools/src/xref_parser.yrl
  1053. $i "Generate unrelated .erl files"
  1054. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1055. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1056. $i "Build the application"
  1057. $t $(MAKE) -C $(APP) $v
  1058. $i "Check that all compiled files exist"
  1059. $t test -f $(APP)/$(APP).d
  1060. $t test -f $(APP)/ebin/$(APP).app
  1061. $t test -f $(APP)/ebin/boy.beam
  1062. $t test -f $(APP)/ebin/girl.beam
  1063. $t test -f $(APP)/ebin/xmerl_xpath_parse.beam
  1064. $t test -f $(APP)/ebin/xref_parser.beam
  1065. $t test -f $(APP)/src/xmerl_xpath_parse.erl
  1066. $t test -f $(APP)/src/xref_parser.erl
  1067. $i "Check that the application was compiled correctly"
  1068. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1069. ok = application:start($(APP)), \
  1070. {ok, Mods = [boy, girl, xmerl_xpath_parse, xref_parser]} \
  1071. = application:get_key($(APP), modules), \
  1072. [{module, M} = code:load_file(M) || M <- Mods], \
  1073. halt()"
  1074. $i "Touch one .yrl file; check that only required files are rebuilt"
  1075. $t printf "%s\n" \
  1076. $(APP)/$(APP).d \
  1077. $(APP)/ebin/$(APP).app \
  1078. $(APP)/ebin/xref_parser.beam \
  1079. $(APP)/src/xref_parser.erl | sort > $(APP)/EXPECT
  1080. $t touch $(APP)/src/xref_parser.yrl
  1081. $t $(MAKE) -C $(APP) $v
  1082. $t find $(APP) -type f -newer $(APP)/src/xref_parser.yrl | sort | diff $(APP)/EXPECT -
  1083. $t rm $(APP)/EXPECT
  1084. $i "Check that the application was compiled correctly"
  1085. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1086. ok = application:start($(APP)), \
  1087. {ok, Mods = [boy, girl, xmerl_xpath_parse, xref_parser]} \
  1088. = application:get_key($(APP), modules), \
  1089. [{module, M} = code:load_file(M) || M <- Mods], \
  1090. halt()"
  1091. $i "Clean the application"
  1092. $t $(MAKE) -C $(APP) clean $v
  1093. $i "Check that source files still exist"
  1094. $t test -f $(APP)/Makefile
  1095. $t test -f $(APP)/erlang.mk
  1096. ifdef LEGACY
  1097. $t test -f $(APP)/src/$(APP).app.src
  1098. endif
  1099. $t test -f $(APP)/src/boy.erl
  1100. $t test -f $(APP)/src/girl.erl
  1101. $t test -f $(APP)/src/xmerl_xpath_parse.yrl
  1102. $t test -f $(APP)/src/xref_parser.yrl
  1103. $i "Check that all build artifacts are removed, including intermediates"
  1104. $t test ! -e $(APP)/$(APP).d
  1105. $t test ! -e $(APP)/ebin/
  1106. $t test ! -e $(APP)/src/xmerl_xpath_parse.erl
  1107. $t test ! -e $(APP)/src/xref_parser.erl
  1108. $i "Build the application again"
  1109. $t $(MAKE) -C $(APP) $v
  1110. $i "Check that all compiled files exist"
  1111. $t test -f $(APP)/$(APP).d
  1112. $t test -f $(APP)/ebin/$(APP).app
  1113. $t test -f $(APP)/ebin/boy.beam
  1114. $t test -f $(APP)/ebin/girl.beam
  1115. $t test -f $(APP)/ebin/xmerl_xpath_parse.beam
  1116. $t test -f $(APP)/ebin/xref_parser.beam
  1117. $t test -f $(APP)/src/xmerl_xpath_parse.erl
  1118. $t test -f $(APP)/src/xref_parser.erl
  1119. $i "Check that the application was compiled correctly"
  1120. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1121. ok = application:start($(APP)), \
  1122. {ok, Mods = [boy, girl, xmerl_xpath_parse, xref_parser]} \
  1123. = application:get_key($(APP), modules), \
  1124. [{module, M} = code:load_file(M) || M <- Mods], \
  1125. halt()"
  1126. core-app-yrl-include: build clean-core-app-yrl-include
  1127. $i "Bootstrap a new OTP library named $(APP)"
  1128. $t mkdir $(APP)/
  1129. $t cp ../erlang.mk $(APP)/
  1130. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  1131. $i "Download a .yrl file with includes from Erlang/OTP"
  1132. $t curl -s -o $(APP)/src/core_parse.yrl $(OTP_MASTER)/lib/compiler/src/core_parse.yrl
  1133. $t curl -s -o $(APP)/src/core_parse.hrl $(OTP_MASTER)/lib/compiler/src/core_parse.hrl
  1134. $i "Generate unrelated .erl files"
  1135. $t echo "-module(boy)." > $(APP)/src/boy.erl
  1136. $t echo "-module(girl)." > $(APP)/src/girl.erl
  1137. $i "Build the application"
  1138. $t $(MAKE) -C $(APP) $v
  1139. $i "Check that all compiled files exist"
  1140. $t test -f $(APP)/$(APP).d
  1141. $t test -f $(APP)/ebin/$(APP).app
  1142. $t test -f $(APP)/ebin/boy.beam
  1143. $t test -f $(APP)/ebin/core_parse.beam
  1144. $t test -f $(APP)/ebin/girl.beam
  1145. $t test -f $(APP)/src/core_parse.erl
  1146. $i "Check that the application was compiled correctly"
  1147. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1148. ok = application:start($(APP)), \
  1149. {ok, Mods = [boy, core_parse, girl]} \
  1150. = application:get_key($(APP), modules), \
  1151. [{module, M} = code:load_file(M) || M <- Mods], \
  1152. halt()"
  1153. $i "Touch the .yrl file; check that only required files are rebuilt"
  1154. $t printf "%s\n" \
  1155. $(APP)/$(APP).d \
  1156. $(APP)/ebin/$(APP).app \
  1157. $(APP)/ebin/core_parse.beam \
  1158. $(APP)/src/core_parse.erl | sort > $(APP)/EXPECT
  1159. $t touch $(APP)/src/core_parse.yrl
  1160. $t $(MAKE) -C $(APP) $v
  1161. $t find $(APP) -type f -newer $(APP)/src/core_parse.yrl | sort | diff $(APP)/EXPECT -
  1162. $t rm $(APP)/EXPECT
  1163. $i "Check that the application was compiled correctly"
  1164. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1165. ok = application:start($(APP)), \
  1166. {ok, Mods = [boy, core_parse, girl]} \
  1167. = application:get_key($(APP), modules), \
  1168. [{module, M} = code:load_file(M) || M <- Mods], \
  1169. halt()"
  1170. $i "Touch the .hrl file included; check that only required files are rebuilt"
  1171. $t printf "%s\n" \
  1172. $(APP)/$(APP).d \
  1173. $(APP)/ebin/$(APP).app \
  1174. $(APP)/ebin/core_parse.beam \
  1175. $(APP)/src/core_parse.erl | sort > $(APP)/EXPECT
  1176. $t touch $(APP)/src/core_parse.hrl
  1177. $t $(MAKE) -C $(APP) $v
  1178. $t find $(APP) -type f -newer $(APP)/src/core_parse.hrl | sort | diff $(APP)/EXPECT -
  1179. $t rm $(APP)/EXPECT
  1180. $i "Check that the application was compiled correctly"
  1181. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1182. ok = application:start($(APP)), \
  1183. {ok, Mods = [boy, core_parse, girl]} \
  1184. = application:get_key($(APP), modules), \
  1185. [{module, M} = code:load_file(M) || M <- Mods], \
  1186. halt()"
  1187. $i "Clean the application"
  1188. $t $(MAKE) -C $(APP) clean $v
  1189. $i "Check that source files still exist"
  1190. $t test -f $(APP)/Makefile
  1191. $t test -f $(APP)/erlang.mk
  1192. ifdef LEGACY
  1193. $t test -f $(APP)/src/$(APP).app.src
  1194. endif
  1195. $t test -f $(APP)/src/boy.erl
  1196. $t test -f $(APP)/src/core_parse.hrl
  1197. $t test -f $(APP)/src/core_parse.yrl
  1198. $t test -f $(APP)/src/girl.erl
  1199. $i "Check that all build artifacts are removed, including intermediates"
  1200. $t test ! -e $(APP)/$(APP).d
  1201. $t test ! -e $(APP)/ebin/
  1202. $t test ! -e $(APP)/src/core_parse.erl
  1203. $i "Build the application again"
  1204. $t $(MAKE) -C $(APP) $v
  1205. $i "Check that all compiled files exist"
  1206. $t test -f $(APP)/$(APP).d
  1207. $t test -f $(APP)/ebin/$(APP).app
  1208. $t test -f $(APP)/ebin/boy.beam
  1209. $t test -f $(APP)/ebin/core_parse.beam
  1210. $t test -f $(APP)/ebin/girl.beam
  1211. $t test -f $(APP)/src/core_parse.erl
  1212. $i "Check that the application was compiled correctly"
  1213. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  1214. ok = application:start($(APP)), \
  1215. {ok, Mods = [boy, core_parse, girl]} \
  1216. = application:get_key($(APP), modules), \
  1217. [{module, M} = code:load_file(M) || M <- Mods], \
  1218. halt()"