core_plugins.mk 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Core: External plugins.
  2. CORE_PLUGINS_CASES = all one
  3. CORE_PLUGINS_TARGETS = $(addprefix core-plugins-,$(CORE_PLUGINS_CASES))
  4. CORE_PLUGINS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_PLUGINS_TARGETS))
  5. .PHONY: core-plugins $(CORE_PLUGINS_TARGETS) clean-core-plugins $(CORE_PLUGINS_CLEAN_TARGETS)
  6. clean-core-plugins: $(CORE_PLUGINS_CLEAN_TARGETS)
  7. $(CORE_PLUGINS_CLEAN_TARGETS):
  8. $t rm -rf $(APP_TO_CLEAN)/
  9. core-plugins: $(CORE_PLUGINS_TARGETS)
  10. core-plugins-all: build clean-core-plugins-all
  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 "Create a local git repository with two plugins"
  16. $t mkdir -p $(APP)/plugin_dep/mk
  17. $t echo "plugin1: ; @echo \$$@" > $(APP)/plugin_dep/mk/plugin1.mk
  18. $t echo "plugin2: ; @echo \$$@" > $(APP)/plugin_dep/mk/plugin2.mk
  19. $t echo "THIS := \$$(dir \$$(realpath \$$(lastword \$$(MAKEFILE_LIST))))" > $(APP)/plugin_dep/plugins.mk
  20. $t printf "%s\n" "include \$$(THIS)/mk/plugin1.mk" >> $(APP)/plugin_dep/plugins.mk
  21. $t printf "%s\n" "include \$$(THIS)/mk/plugin2.mk" >> $(APP)/plugin_dep/plugins.mk
  22. # We check that overriding THIS doesn't cause an error.
  23. $t echo "THIS :=" >> $(APP)/plugin_dep/plugins.mk
  24. $t cd $(APP)/plugin_dep && \
  25. git init -q && \
  26. git config user.email "testsuite@erlang.mk" && \
  27. git config user.name "test suite" && \
  28. git add . && \
  29. git commit -q -m "Tests"
  30. $i "Add dependency and plugins to the Makefile"
  31. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = plugin_dep\ndep_plugin_dep = git file://$(abspath $(APP)/plugin_dep) master\nDEP_PLUGINS = plugin_dep\n"}' $(APP)/Makefile
  32. $i "Run 'make plugin1' and check that it prints plugin1"
  33. $t test -n "`$(MAKE) -C $(APP) plugin1 | grep plugin1`"
  34. $i "Run 'make plugin2' and check that it prints plugin2"
  35. $t test -n "`$(MAKE) -C $(APP) plugin2 | grep plugin2`"
  36. core-plugins-one: build clean-core-plugins-one
  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 "Create a local git repository with two plugins"
  42. $t mkdir -p $(APP)/plugin_dep/mk
  43. $t echo "plugin1: ; @echo \$$@" > $(APP)/plugin_dep/mk/plugin1.mk
  44. $t echo "plugin2: ; @echo \$$@" > $(APP)/plugin_dep/mk/plugin2.mk
  45. $t echo "THIS := \$$(dir \$$(realpath \$$(lastword \$$(MAKEFILE_LIST))))" > $(APP)/plugin_dep/plugins.mk
  46. $t printf "%s\n" "include \$$(THIS)/mk/plugin1.mk" >> $(APP)/plugin_dep/plugins.mk
  47. $t printf "%s\n" "include \$$(THIS)/mk/plugin2.mk" >> $(APP)/plugin_dep/plugins.mk
  48. # We check that overriding THIS doesn't cause an error.
  49. $t echo "THIS :=" >> $(APP)/plugin_dep/plugins.mk
  50. $t cd $(APP)/plugin_dep && \
  51. git init -q && \
  52. git config user.email "testsuite@erlang.mk" && \
  53. git config user.name "test suite" && \
  54. git add . && \
  55. git commit -q -m "Tests"
  56. $i "Add dependency and plugins to the Makefile"
  57. $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = plugin_dep\ndep_plugin_dep = git file://$(abspath $(APP)/plugin_dep) master\nDEP_PLUGINS = plugin_dep/mk/plugin1.mk\n"}' $(APP)/Makefile
  58. $i "Run 'make plugin1' and check that it prints plugin1"
  59. $t test -n "`$(MAKE) -C $(APP) plugin1 | grep plugin1`"
  60. $i "Run 'make plugin2' and confirm the target doesn't exist"
  61. $t if `$(MAKE) -C $(APP) plugin2`; then false; fi