File tree Expand file tree Collapse file tree 3 files changed +46
-24
lines changed Expand file tree Collapse file tree 3 files changed +46
-24
lines changed Original file line number Diff line number Diff line change 1
- M := .cache/.makes
2
- $(shell [ -d $M ] || git clone -q https ://github.com/makeplus/makes $M)
3
- include $M/init.mk
4
- include $M/go.mk
5
- include $M/ys.mk
1
+ # Auto-install https://github.com/makeplus/makes at specific commit:
2
+ MAKES := .cache/makes
3
+ MAKES-LOCAL := .cache/local
4
+ MAKES-COMMIT ?= 74a4d03223cdaf39140613d48d3f1d8c0a0840e5
5
+ $(shell [ -d $(MAKES) ] || ( \
6
+ git clone -q https ://github.com/makeplus/makes $(MAKES ) && \
7
+ git -C $(MAKES) reset -q --hard $(MAKES-COMMIT)))
8
+ ifneq ($(shell git -C $(MAKES ) rev-parse HEAD) , \
9
+ $(shell git -C $(MAKES) rev-parse $(MAKES-COMMIT)))
10
+ $(error $(MAKES ) is not at the correct commit : $(MAKES-COMMIT ) )
11
+ endif
12
+ include $(MAKES ) /init.mk
6
13
7
- # Print Makefile targets summary
8
- default ::
14
+ # Only auto-install go if no go exists or GO-VERSION specified:
15
+ ifeq (,$(shell which go) )
16
+ GO-VERSION ?= 1.24.0
17
+ endif
18
+ GO-VERSION-NEEDED := $(GO-VERSION )
9
19
10
- $(GO-CMDS ) :: $(GO )
11
- go $@ $A
20
+ # Setup and include go.mk and shell.mk:
21
+ GO-CMDS-SKIP := test
22
+ ifndef GO-VERSION-NEEDED
23
+ GO-NO-DEP-GO := true
24
+ endif
25
+ include $(MAKES ) /go.mk
26
+ ifdef GO-VERSION-NEEDED
27
+ TEST-DEPS += $(GO )
28
+ else
29
+ SHELL-DEPS := $(filter-out $(GO ) ,$(SHELL-DEPS ) )
30
+ endif
31
+ SHELL-NAME := makes go-yaml
32
+ include $(MAKES ) /shell.mk
12
33
13
- ys-test : $(YS )
14
- prove -v test/
34
+ v ?=
15
35
16
- distclean :
17
- $(RM ) -r .cache
36
+
37
+ # Test rules:
38
+ test : $(TEST-DEPS )
39
+ go test$(if $v, -v)
40
+
41
+
42
+ # Clean rules:
43
+ realclean :
44
+
45
+ distclean : realclean
46
+ $(RM ) -r $(ROOT ) /.cache
Original file line number Diff line number Diff line change 168
168
## Testing with ` make `
169
169
170
170
Running ` make test ` in this directory should just work.
171
- You don't need to have ` go ` installed and even if you do the Makefile will
171
+ You don't need to have ` go ` installed and even if you do the ` GNUmakefile ` will
172
172
ignore it and setup / cache its own version under ` .cache/ ` .
173
173
174
174
The only things you need are:
@@ -182,7 +182,9 @@ Some `make` commands are:
182
182
183
183
* ` make test `
184
184
* ` make test GO-VERSION=1.2.34 `
185
- * ` make distclean ` - Remove ` .cache/ `
185
+ * ` make shell ` Start a shell with the local ` go ` environment
186
+ * ` make shell GO-VERSION=1.2.34 `
187
+ * ` make distclean ` - Removes ` .cache/ `
186
188
187
189
188
190
## License
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments