Skip to content

Commit af32c4f

Browse files
dumbbellessen
authored andcommittedDec 19, 2016
plugins/escript.mk: Remove $(ESCRIPT_FILE) in distclean-escript
... not $(ESCRIPT_NAME), which can be set to another value. While here, add a testcase for `make distclean`.
1 parent 25704cc commit af32c4f

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed
 

‎plugins/escript.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ escript:: escript-zip
4545
$(verbose) chmod +x $(ESCRIPT_FILE)
4646

4747
distclean-escript:
48-
$(gen_verbose) rm -f $(ESCRIPT_NAME)
48+
$(gen_verbose) rm -f $(ESCRIPT_FILE)

‎test/plugin_escript.mk

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Escript plugin.
22

3-
ESCRIPT_CASES = build deps extra
3+
ESCRIPT_CASES = build deps distclean extra
44
ESCRIPT_TARGETS = $(addprefix escript-,$(ESCRIPT_CASES))
55

66
.PHONY: escript $(ESCRIPT_TARGETS)
@@ -60,6 +60,34 @@ escript-deps: build clean
6060
$i "Check that the escript contains the dependency"
6161
$t zipinfo $(APP)/$(APP) 2> /dev/null | grep -q ranch
6262

63+
escript-distclean: build clean
64+
65+
$i "Bootstrap a new OTP library named $(APP)"
66+
$t mkdir $(APP)/
67+
$t cp ../erlang.mk $(APP)/
68+
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
69+
70+
$i "Use a non-standard name for the escript"
71+
$t perl -ni.bak -e 'print;if ($$.==1) {print "ESCRIPT_FILE = real-escript\n"}' $(APP)/Makefile
72+
73+
$i "Generate a module containing a function main/1"
74+
$t printf "%s\n" \
75+
"-module($(APP))." \
76+
"-export([main/1])." \
77+
'main(_) -> io:format("good~n").' > $(APP)/src/$(APP).erl
78+
79+
$i "Build the escript"
80+
$t $(MAKE) -C $(APP) escript $v
81+
82+
$i "Check that the escript runs"
83+
$t test ! -f $(APP)/$(APP)
84+
$t $(APP)/real-escript | grep -q good
85+
86+
$i "Check that make distclean removes the generated escript"
87+
$t $(MAKE) -C $(APP) distclean $v
88+
$t test ! -f $(APP)/$(APP)
89+
$t test ! -f $(APP)/real-escript
90+
6391
escript-extra: build clean
6492

6593
$i "Bootstrap a new OTP library named $(APP)"

0 commit comments

Comments
 (0)
Please sign in to comment.