mk: rebuild if goflags or ldflags have changed
Running make with different values for GOFLAGS or VERSION does not cause aerc to be rebuilt whereas it should. Write the go build command line into a file and force aerc to be rebuilt if the command line has changed. Use the BSD make compatible != operator to run the command. This operator is also available in GNU make since version 4.0. Link: https://git.savannah.gnu.org/cgit/make.git/commit/?id=b34438bee83ee Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
This commit is contained in:
parent
115dabb634
commit
e7e22aba60
2 changed files with 14 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@
|
||||||
/aerc2
|
/aerc2
|
||||||
/aerc
|
/aerc
|
||||||
/aerc.debug
|
/aerc.debug
|
||||||
|
/.aerc.d
|
||||||
log
|
log
|
||||||
raw.log
|
raw.log
|
||||||
*.1
|
*.1
|
||||||
|
|
15
Makefile
15
Makefile
|
@ -30,8 +30,19 @@ DOCS := \
|
||||||
|
|
||||||
all: aerc $(DOCS)
|
all: aerc $(DOCS)
|
||||||
|
|
||||||
aerc: $(GOSRC)
|
build_cmd:=$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o aerc
|
||||||
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@
|
|
||||||
|
# the following command outputs nothing, we only want to execute it once
|
||||||
|
# and force .aerc.d to be regenerated when build_cmd has changed
|
||||||
|
_!=echo '$(build_cmd)' > .aerc.tmp; \
|
||||||
|
cmp -s .aerc.d .aerc.tmp || rm -f .aerc.d; \
|
||||||
|
rm -f .aerc.tmp
|
||||||
|
|
||||||
|
.aerc.d:
|
||||||
|
@echo '$(build_cmd)' > $@
|
||||||
|
|
||||||
|
aerc: $(GOSRC) .aerc.d
|
||||||
|
$(build_cmd)
|
||||||
|
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
fmt:
|
fmt:
|
||||||
|
|
Loading…
Reference in a new issue