core_plugins.mk 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 sed -i.bak '2i\
  32. DEPS = plugin_dep\
  33. dep_plugin_dep = git file://$(abspath $(APP)/plugin_dep) master\
  34. DEP_PLUGINS = plugin_dep\
  35. ' $(APP)/Makefile
  36. $i "Run 'make plugin1' and check that it prints plugin1"
  37. $t test -n "`$(MAKE) -C $(APP) plugin1 | grep plugin1`"
  38. $i "Run 'make plugin2' and check that it prints plugin2"
  39. $t test -n "`$(MAKE) -C $(APP) plugin2 | grep plugin2`"
  40. core-plugins-one: build clean-core-plugins-one
  41. $i "Bootstrap a new OTP library named $(APP)"
  42. $t mkdir $(APP)/
  43. $t cp ../erlang.mk $(APP)/
  44. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  45. $i "Create a local git repository with two plugins"
  46. $t mkdir -p $(APP)/plugin_dep/mk
  47. $t echo "plugin1: ; @echo \$$@" > $(APP)/plugin_dep/mk/plugin1.mk
  48. $t echo "plugin2: ; @echo \$$@" > $(APP)/plugin_dep/mk/plugin2.mk
  49. $t echo "THIS := \$$(dir \$$(realpath \$$(lastword \$$(MAKEFILE_LIST))))" > $(APP)/plugin_dep/plugins.mk
  50. $t printf "%s\n" "include \$$(THIS)/mk/plugin1.mk" >> $(APP)/plugin_dep/plugins.mk
  51. $t printf "%s\n" "include \$$(THIS)/mk/plugin2.mk" >> $(APP)/plugin_dep/plugins.mk
  52. # We check that overriding THIS doesn't cause an error.
  53. $t echo "THIS :=" >> $(APP)/plugin_dep/plugins.mk
  54. $t cd $(APP)/plugin_dep && \
  55. git init -q && \
  56. git config user.email "testsuite@erlang.mk" && \
  57. git config user.name "test suite" && \
  58. git add . && \
  59. git commit -q -m "Tests"
  60. $i "Add dependency and plugins to the Makefile"
  61. $t sed -i.bak '2i\
  62. DEPS = plugin_dep\
  63. dep_plugin_dep = git file://$(abspath $(APP)/plugin_dep) master\
  64. DEP_PLUGINS = plugin_dep/mk/plugin1.mk\
  65. ' $(APP)/Makefile
  66. $i "Run 'make plugin1' and check that it prints plugin1"
  67. $t test -n "`$(MAKE) -C $(APP) plugin1 | grep plugin1`"
  68. $i "Run 'make plugin2' and confirm the target doesn't exist"
  69. $t if `$(MAKE) -C $(APP) plugin2`; then false; fi