diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 35 |
1 files changed, 28 insertions, 7 deletions
@@ -1,10 +1,31 @@ -forge: .version.ha .templates.ha *.ha - hare build $(HAREFLAGS) -o $@ . +# SPDX-License-Identifier: AGPL-3.0-only +# SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org> +# +# TODO: This Makefile utilizes a lot of GNU extensions. Some of them are +# unfortunately difficult to avoid as POSIX Make's pattern rules are not +# sufficiently expressive. This needs to be fixed sometime (or we might move to +# some other build system). +# -.templates.ha: templates/*.htmpl - htmplgen -o $@ $^ +.PHONY: clean all -.version.ha: - printf 'def VERSION="%s";\n' $(shell git describe --tags --always --dirty) > $@ +CFLAGS = -Wall -Wextra -pedantic -std=c99 -D_GNU_SOURCE + +all: dist/forged dist/git2d dist/hookc + +dist/forged: $(shell git ls-files forged) + mkdir -p dist + sqlc -f forged/sqlc.yaml generate + CGO_ENABLED=0 go build -o dist/forged -ldflags '-extldflags "-f no-PIC -static"' -tags 'osusergo netgo static_build' ./forged + +dist/git2d: $(wildcard git2d/*.c) + mkdir -p dist + $(CC) $(CFLAGS) -o dist/git2d $^ $(shell pkg-config --cflags --libs libgit2) -lpthread + +dist/hookc: $(wildcard hookc/*.c) + mkdir -p dist + $(CC) $(CFLAGS) -o dist/hookc $^ + +clean: + rm -rf dist -.PHONY: version.ha |