~sircmpwn/abused-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH] update Makefile

Details
Message ID
<20240218210550.2952525-1-moritz@poldrack.dev>
DKIM signature
pass
Download raw message
Patch: +22 -7
From: Moritz Poldrack <git@moritz.sh>

Signed-off-by: Moritz Poldrack <git@moritz.sh>
---

- leverage make for generating source files automatically
- make using alternative go compilers easier (for example go-gcc)
- add GO_FLAGS to allow for supplying additional flags to go build

 Makefile | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index ed9a7a4..8305cff 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,31 @@
GO := $(shell which go || echo go)
GO_FLAGS := -trimpath
go_src := $(shell $(GO) list -f '{{$$Dir := .Dir}}{{range .GoFiles}}{{$$Dir}}/{{.}} {{end}}' ./...)
go_src += go.mod go.sum graph client

all: abused abused-keygen abused-bootstrap

abused:
	go build -o abused ./cmd/abused/
abused: $(go_src)
	$(GO) build $(GO_FLAGS) -o $@ ./cmd/$@

abused-bootstrap:
	go build -o abused-bootstrap ./cmd/abused-bootstrap/
abused-keygen: $(go_src)
	$(GO) build $(GO_FLAGS) -o $@ ./cmd/$@

abused-keygen:
	go build -o abused-keygen ./cmd/abused-keygen/
abused-bootstrap: $(go_src)
	$(GO) build $(GO_FLAGS) -o $@ ./cmd/$@

server: abused
	./abused

.PHONY: abused abused-keygen abused-bootstrap
graph: gqlgen.yml graph/schema.graphqls
	$(GO) run github.com/99designs/gqlgen generate --config gqlgen.yml
	@touch graph

client: client/queries.graphql graph/schema.graphqls
	$(GO) run git.sr.ht/~emersion/gqlclient/cmd/gqlclientgen \
		-s ../graph/schema.graphqls \
		-q queries.graphql \
		-o $@
	@touch client

.PHONY: all server
-- 
2.43.2
Details
Message ID
<CZGNIM3O8EXI.2R92WAXKUV8KI@cmpwn.com>
In-Reply-To
<20240218210550.2952525-1-moritz@poldrack.dev> (view parent)
DKIM signature
pass
Download raw message
Are these features supported outside of GNU make?
Details
Message ID
<CZGUHO9QF0VR.12AEYKF4WN54O@poldrack.dev>
In-Reply-To
<CZGNIM3O8EXI.2R92WAXKUV8KI@cmpwn.com> (view parent)
DKIM signature
pass
Download raw message
On Wed 28 Feb 2024 11:48:15, Drew DeVault wrote:
> Are these features supported outside of GNU make?

For GNU make, := $(shell) has to be changed to !=, but overall this
isn't using any occult macro magic :)

I'll give it a try to make sure though.

-- 
Moritz Poldrack
https://moritz.sh

> May explode if improperly recharged.
Reply to thread Export thread (mbox)