go-org-orgwiki/Makefile
Niklas Fasching e5ae608865 Improve Makefile: Only install dependencies and rebuild when required
By getting rid of the PHONY install and bundling the go get with its uses we
can prevent unnecessary go gets in `make build` - this speeds up development as
I run `make generate-fixtures` a lot and fetching dependencies takes
comparatively long.

We also add the `-d` flag to go get to get rid of the deprecation warning
```
go get: installing executables with 'go get' in module mode is deprecated.
	To adjust and download dependencies of the current module, use 'go get -d'.
	To install using requirements of the current module, use 'go install'.
	To install ignoring the current module, use 'go install' with a version,
	like 'go install example.com/cmd@latest'.
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.
```
2021-04-17 15:48:41 +02:00

43 lines
861 B
Makefile

.PHONY: default
default: test
go-org: *.go */*.go go.mod go.sum
go get -d ./...
go build .
.PHONY: build
build: go-org
.PHONY: test
test:
go get -d -t ./...
go test ./... -v
.PHONY: setup
setup:
git config core.hooksPath etc/githooks
.PHONY: preview
preview: generate
xdg-open gh-pages/index.html
.PHONY: generate
generate: generate-gh-pages generate-fixtures
.PHONY: generate-gh-pages
generate-gh-pages: build
./etc/generate-gh-pages
.PHONY: generate-fixtures
generate-fixtures: build
./etc/generate-fixtures
.PHONY: fuzz
fuzz: build
@echo also see "http://lcamtuf.coredump.cx/afl/README.txt"
go get github.com/dvyukov/go-fuzz/go-fuzz
go get github.com/dvyukov/go-fuzz/go-fuzz-build
mkdir -p fuzz fuzz/corpus
cp org/testdata/*.org fuzz/corpus
go-fuzz-build github.com/niklasfasching/go-org/org
go-fuzz -bin=./org-fuzz.zip -workdir=fuzz