core_plugins.mk 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Core: External plugins.
  2. CORE_PLUGINS_CASES = all one
  3. CORE_PLUGINS_TARGETS = $(addprefix core-plugins-,$(CORE_PLUGINS_CASES))
  4. .PHONY: core-plugins $(CORE_PLUGINS_TARGETS)
  5. core-plugins: $(CORE_PLUGINS_TARGETS)
  6. core-plugins-all: build clean
  7. $i "Bootstrap a new OTP library named $(APP)"
  8. $t mkdir $(APP)/
  9. $t cp ../erlang.mk $(APP)/
  10. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  11. $i "Create a local git repository with two plugins"
  12. $t mkdir -p $(APP)/plugin_dep/mk
  13. $t echo "plugin1: ; @echo \$$@" > $(APP)/plugin_dep/mk/plugin1.mk
  14. $t echo "plugin2: ; @echo \$$@" > $(APP)/plugin_dep/mk/plugin2.mk
  15. $t echo "THIS := \$$(dir \$$(realpath \$$(lastword \$$(MAKEFILE_LIST))))" > $(APP)/plugin_dep/plugins.mk
  16. $t printf "%s\n" "include \$$(THIS)/mk/plugin1.mk" >> $(APP)/plugin_dep/plugins.mk
  17. $t printf "%s\n" "include \$$(THIS)/mk/plugin2.mk" >> $(APP)/plugin_dep/plugins.mk
  18. # We check that overriding THIS doesn't cause an error.
  19. $t echo "THIS :=" >> $(APP)/plugin_dep/plugins.mk
  20. $t cd $(APP)/plugin_dep && \
  21. git init -q && \
  22. git config user.email "testsuite@erlang.mk" && \
  23. git config user.name "test suite" && \
  24. git add . && \
  25. git commit -q -m "Tests"
  26. $i "Add dependency and plugins to the Makefile"
  27. $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
  28. $i "Run 'make plugin1' and check that it prints plugin1"
  29. $t test -n "`$(MAKE) -C $(APP) plugin1 | grep plugin1`"
  30. $i "Run 'make plugin2' and check that it prints plugin2"
  31. $t test -n "`$(MAKE) -C $(APP) plugin2 | grep plugin2`"
  32. core-plugins-one: build clean
  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 "Create a local git repository with two plugins"
  38. $t mkdir -p $(APP)/plugin_dep/mk
  39. $t echo "plugin1: ; @echo \$$@" > $(APP)/plugin_dep/mk/plugin1.mk
  40. $t echo "plugin2: ; @echo \$$@" > $(APP)/plugin_dep/mk/plugin2.mk
  41. $t echo "THIS := \$$(dir \$$(realpath \$$(lastword \$$(MAKEFILE_LIST))))" > $(APP)/plugin_dep/plugins.mk
  42. $t printf "%s\n" "include \$$(THIS)/mk/plugin1.mk" >> $(APP)/plugin_dep/plugins.mk
  43. $t printf "%s\n" "include \$$(THIS)/mk/plugin2.mk" >> $(APP)/plugin_dep/plugins.mk
  44. # We check that overriding THIS doesn't cause an error.
  45. $t echo "THIS :=" >> $(APP)/plugin_dep/plugins.mk
  46. $t cd $(APP)/plugin_dep && \
  47. git init -q && \
  48. git config user.email "testsuite@erlang.mk" && \
  49. git config user.name "test suite" && \
  50. git add . && \
  51. git commit -q -m "Tests"
  52. $i "Add dependency and plugins to the Makefile"
  53. $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
  54. $i "Run 'make plugin1' and check that it prints plugin1"
  55. $t $(MAKE) --no-print-directory -C $(APP) plugin1 | grep -qw plugin1
  56. $i "Run 'make plugin2' and confirm the target doesn't exist"
  57. $t ! $(MAKE) --no-print-directory -C $(APP) plugin2