core_app.mk 48 KB

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