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