core_deps.mk 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Core: Packages and dependencies.
  2. CORE_DEPS_CASES = build-c pkg search
  3. CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
  4. CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS))
  5. .PHONY: core-deps $(CORE_DEPS_TARGETS) clean-core-deps $(CORE_DEPS_CLEAN_TARGETS)
  6. clean-core-deps: $(CORE_DEPS_CLEAN_TARGETS)
  7. $(CORE_DEPS_CLEAN_TARGETS):
  8. $t rm -rf $(APP_TO_CLEAN)/
  9. core-deps: $(CORE_DEPS_TARGETS)
  10. core-deps-build-c: build clean-core-deps-build-c
  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 "Add 8cc to the list of build dependencies"
  16. $t sed -i.bak '2i\
  17. BUILD_DEPS = 8cc\
  18. dep_8cc = git https://github.com/rui314/8cc master\
  19. ' $(APP)/Makefile
  20. $i "Build the application"
  21. $t $(MAKE) -C $(APP) $v
  22. $i "Check that all dependencies were fetched"
  23. $t test -d $(APP)/deps/8cc
  24. $i "Check that 8cc can be started"
  25. $t $(APP)/deps/8cc/8cc -h $v
  26. $i "Check that the application was compiled correctly"
  27. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  28. [ok = application:load(App) || App <- [$(APP)]], \
  29. {ok, Deps} = application:get_key($(APP), applications), \
  30. false = lists:member('8cc', Deps), \
  31. halt()"
  32. core-deps-pkg: build clean-core-deps-pkg
  33. $i "Bootstrap a new OTP library named $(APP)"
  34. $t mkdir $(APP)/
  35. $t cp ../erlang.mk $(APP)/
  36. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  37. $i "Add Cowboy to the list of dependencies"
  38. $t sed -i.bak '2i\
  39. DEPS = cowboy\
  40. ' $(APP)/Makefile
  41. ifdef LEGACY
  42. $i "Add Cowboy to the applications key in the .app.src file"
  43. $t sed -i.bak '8i\
  44. cowboy,' $(APP)/src/$(APP).app.src
  45. endif
  46. $i "Build the application"
  47. $t $(MAKE) -C $(APP) $v
  48. $i "Check that all dependencies were fetched"
  49. $t test -d $(APP)/deps/cowboy
  50. $t test -d $(APP)/deps/cowlib
  51. $t test -d $(APP)/deps/ranch
  52. $i "Check that the application was compiled correctly"
  53. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  54. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  55. {ok, Deps} = application:get_key($(APP), applications), \
  56. true = lists:member(cowboy, Deps), \
  57. halt()"
  58. core-deps-search: build clean-core-deps-search
  59. $i "Bootstrap a new OTP library named $(APP)"
  60. $t mkdir $(APP)/
  61. $t cp ../erlang.mk $(APP)/
  62. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  63. $i "Run 'make search' and check that it prints packages"
  64. $t test -n "`$(MAKE) -C $(APP) search`"
  65. $i "Run 'make search q=cowboy' and check that it prints packages"
  66. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"