From 604cfdaefee60a89d5ca05ce5afa984835386318 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L. de Mello" Date: Thu, 23 May 2024 10:45:27 -0300 Subject: [PATCH] chore: make makefile --- makefile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 makefile diff --git a/makefile b/makefile new file mode 100644 index 0000000..e0ef018 --- /dev/null +++ b/makefile @@ -0,0 +1,35 @@ +all: run + +dev: + air + +run: bin/www + ./bin/www + +run-vercel: bin/vercel + ./bin/vercel + +build-static: templ + go run ./cmd/build/main.go + +build-vercel: build-static + +bin/www: main.go templ + go build -o ./bin/www ./main.go + +bin/vercel: cmd/vercel/main.go templ build-vercel + go build -o ./bin/vercel ./cmd/vercel/main.go + +# For some reason "templ generate" does not detect the files, so this is a +# workaround. +TEMPL_FILES=$(patsubst %.templ, %_templ.go, $(wildcard **/*.templ)) +templ: $(TEMPL_FILES) + @echo Generating templ files +%_templ.go: %.templ + templ generate -f $^ > /dev/null + +clean: + if [[ -d "dist" ]]; then rm -r ./dist; fi + if [[ -d "tmp" ]]; then rm -r ./tmp; fi + if [[ -d "bin" ]]; then rm -r ./bin; fi + rm $(TEMPL_FILES)