Subject: [PATCH links] Simple Makefile improvements

From: Peter Sanchez <[email-masked]>
Date: Tue, 22 Apr 2025 18:53:54 -0600

Changelog-updated: Makefile for more friendly experience.
---
 Makefile | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 08e6ff0..d04d249 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ ADMSRC:=$(shell find ./cmd/admin/ -name '*.go')
 all: links links-api links-short links-list
 
 links: $(LINKSRC)
-	$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(LINKSRC)
+	rm -f $@ && $(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(LINKSRC)
 
 clean:
 	rm -f ./links ./links-api ./links-short ./links-list ./links-domains ./links-admin
@@ -25,21 +25,21 @@ test:
 	$(GO) test ./... -p 1
 
 links-api:
-	$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(APISRC)
+	rm -f $@ && $(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(APISRC)
 
 links-short:
-	$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(SHORTSRC)
+	rm -f $@ && $(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(SHORTSRC)
 
 links-list:
-	$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(LISTSRC)
+	rm -f $@ && $(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(LISTSRC)
 
 links-domains:
-	$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(DOMSRC)
+	rm -f $@ && $(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(DOMSRC)
 
 links-admin:
-	$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(ADMSRC)
+	rm -f $@ && $(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $@ $(ADMSRC)
 
 schema:
 	cd api && $(GO) generate ./graph
 
-.PHONY: all api
+.PHONY: all links clean trans test links-api links-short links-list links-domains links-admin schema
-- 
2.47.2