summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile15
2 files changed, 14 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index b4af105..746aaf5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
/aerc2
/aerc
/aerc.debug
+/.aerc.d
log
raw.log
*.1
diff --git a/Makefile b/Makefile
index 58ffc16..df8a0c0 100644
--- a/Makefile
+++ b/Makefile
@@ -30,8 +30,19 @@ DOCS := \
all: aerc $(DOCS)
-aerc: $(GOSRC)
- $(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@
+build_cmd:=$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o aerc
+
+# 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
fmt: