From 933967016ff0c5c676ff90de03a06aeb2476a3c6 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 16 Sep 2022 23:38:46 +0000 Subject: [PATCH] [SKIP CI] misc: makefile refactoring (#100) Mainly making it so that it doesn't always run tests when making coverage Also, making it more cross platform and less splintered is nice. Co-authored-by: Sam Therapy Reviewed-on: https://git.froth.zone/sam/awl/pulls/100 --- GNUmakefile | 7 ------- Makefile | 6 ------ mkfile | 2 +- template.mk | 22 ++++++++++++++++------ 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 66aacd1..5e7fab3 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -9,13 +9,6 @@ else EXE := $(PROG) endif -doc/$(PROG).1: doc/$(PROG).1.scd - $(SCDOC) <$< >$@ - -doc/wiki/$(PROG).1.md: doc/$(PROG).1 - pandoc --from man --to gfm -o $@ $< - - ## install: installs awl .PHONY: install ifeq ($(OS),Windows_NT) diff --git a/Makefile b/Makefile index b5483dd..d8d8c68 100644 --- a/Makefile +++ b/Makefile @@ -5,12 +5,6 @@ include template.mk EXE := $(PROG) -doc/$(PROG).1: doc/$(PROG).1.scd - $(SCDOC) $@ - -doc/wiki/$(PROG).1.md: doc/$(PROG).1 - pandoc --from man --to gfm -o $@ doc/$(PROG).1 - ## install: installs awl .PHONY: install install: all diff --git a/mkfile b/mkfile index 4c17538..48bc1d3 100644 --- a/mkfile +++ b/mkfile @@ -15,7 +15,7 @@ $PROG: install:V: $GO install $GOFLAGS . - cp doc/$PROG.1 /sys/man/1/$PROG + # cp doc/$PROG.1 /sys/man/1/$PROG test:V: $GO test -v -cover ./... diff --git a/template.mk b/template.mk index 41e441e..742a3f5 100644 --- a/template.mk +++ b/template.mk @@ -28,6 +28,12 @@ all: $(PROG) doc/$(PROG).1 $(PROG): $(SOURCES) $(GO) build -o $(EXE) $(GOFLAGS) . +doc/$(PROG).1: doc/$(PROG).1.scd + $(SCDOC) <$? >$@ + +doc/wiki/$(PROG).1.md: doc/$(PROG).1 + pandoc --from man --to gfm -o $@ $? + ## update_doc: update documentation (requires pandoc) update_doc: doc/wiki/$(PROG).1.md @@ -44,9 +50,12 @@ vet: lint: fmt vet golangci-lint run --fix +coverage/coverage.out: $(TEST_SOURCES) + $(TEST) -coverprofile=$@ ./... + +.PHONY: test ## test: run go test -test: $(TEST_SOURCES) - $(TEST) -v -coverprofile=coverage/coverage.out ./... +test: coverage/coverage.out .PHONY: test-ci test-ci: @@ -66,12 +75,12 @@ fuzz-ci: $(TEST_SOURCES) .PHONY: full_test full_test: test fuzz -coverage/coverage.out: test - $(COVER) -func=$@ - $(COVER) -html=$@ -o coverage/cover.html +coverage/cover.html: coverage/coverage.out + $(COVER) -func=$? + $(COVER) -html=$? -o $@ ## cover: generates test coverage, output as HTML -cover: coverage/coverage.out +cover: coverage/cover.html ## clean: clean the build files .PHONY: clean @@ -79,6 +88,7 @@ clean: $(GO) clean # Ignore errors if you remove something that doesn't exist rm -f doc/$(PROG).1 + rm -f coverage/cover* ## help: Prints this help message .PHONY: help