core_deps.mk 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Core: Packages and dependencies.
  2. CORE_DEPS_CASES = 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-pkg: build clean-core-deps-pkg
  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 Cowboy to the list of dependencies"
  16. $t sed -i.bak '2i\
  17. DEPS = cowboy\
  18. ' $(APP)/Makefile
  19. ifdef LEGACY
  20. $i "Add Cowboy to the applications key in the .app.src file"
  21. $t sed -i.bak '8i\
  22. cowboy,' $(APP)/src/$(APP).app.src
  23. endif
  24. $i "Build the application"
  25. $t $(MAKE) -C $(APP) $v
  26. $i "Check that all dependencies were fetched"
  27. $t test -d $(APP)/deps/cowboy
  28. $t test -d $(APP)/deps/cowlib
  29. $t test -d $(APP)/deps/ranch
  30. $i "Check that the application was compiled correctly"
  31. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  32. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  33. {ok, Deps} = application:get_key($(APP), applications), \
  34. true = lists:member(cowboy, Deps), \
  35. halt()"
  36. core-deps-search: build clean-core-deps-search
  37. $i "Bootstrap a new OTP library named $(APP)"
  38. $t mkdir $(APP)/
  39. $t cp ../erlang.mk $(APP)/
  40. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  41. $i "Run 'make search' and check that it prints packages"
  42. $t test -n "`$(MAKE) -C $(APP) search`"
  43. $i "Run 'make search q=cowboy' and check that it prints packages"
  44. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"