David K. Bainbridge | 528b318 | 2017-01-23 08:51:59 -0800 | [diff] [blame] | 1 | # Build, and run tests. |
| 2 | check: examples |
| 3 | go test ./... |
| 4 | |
| 5 | example_source := $(wildcard example/*.go) |
| 6 | example_binaries := $(patsubst %.go,%,$(example_source)) |
| 7 | |
| 8 | # Clean up binaries. |
| 9 | clean: |
| 10 | $(RM) $(example_binaries) |
| 11 | |
| 12 | # Reformat the source files to match our layout standards. |
| 13 | format: |
| 14 | gofmt -w . |
| 15 | |
| 16 | # Invoke gofmt's "simplify" option to streamline the source code. |
| 17 | simplify: |
| 18 | gofmt -w -s . |
| 19 | |
| 20 | # Build the examples (we have no tests for them). |
| 21 | examples: $(example_binaries) |
| 22 | |
| 23 | %: %.go |
| 24 | go build -o $@ $< |
| 25 | |
| 26 | .PHONY: check clean format examples simplify |