|
1 | 1 | # Escript plugin.
|
2 | 2 |
|
3 |
| -ESCRIPT_CASES = build deps extra |
| 3 | +ESCRIPT_CASES = build deps distclean extra |
4 | 4 | ESCRIPT_TARGETS = $(addprefix escript-,$(ESCRIPT_CASES))
|
5 | 5 |
|
6 | 6 | .PHONY: escript $(ESCRIPT_TARGETS)
|
@@ -60,6 +60,34 @@ escript-deps: build clean
|
60 | 60 | $i "Check that the escript contains the dependency"
|
61 | 61 | $t zipinfo $(APP)/$(APP) 2> /dev/null | grep -q ranch
|
62 | 62 |
|
| 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 | + |
63 | 91 | escript-extra: build clean
|
64 | 92 |
|
65 | 93 | $i "Bootstrap a new OTP library named $(APP)"
|
|
0 commit comments