22EXECUTABLE := oauth-cli
33GOFILES := $(shell find . -type f -name "* .go")
44TAGS ?=
5- TEMPL_VERSION ?= latest
65
76ifneq ($(shell uname) , Darwin)
87 EXTLDFLAGS = -extldflags "-static" $(null)
@@ -19,27 +18,17 @@ COMMIT ?= $(shell git rev-parse --short HEAD)
1918
2019LDFLAGS ?=
2120# # build: build the authgate binary
22- build : generate $(EXECUTABLE )
21+ build : $(EXECUTABLE )
2322
2423$(EXECUTABLE ) : $(GOFILES )
2524 $(GO ) build -v -tags ' $(TAGS)' -ldflags ' $(EXTLDFLAGS)-s -w $(LDFLAGS)' -o bin/$@ .
2625
27- # # air: Install air for hot reload.
28- air :
29- @hash air > /dev/null 2>&1 ; if [ $$ ? -ne 0 ]; then \
30- $(GO ) install github.com/air-verse/air@latest; \
31- fi
32-
33- # # dev: Run the application with hot reload.
34- dev : air
35- air
36-
3726# # install: install the authgate binary
3827install : $(GOFILES )
3928 $(GO ) install -v -tags ' $(TAGS)' -ldflags ' $(EXTLDFLAGS)-s -w $(LDFLAGS)'
4029
4130# # test: run tests
42- test : generate
31+ test :
4332 @$(GO ) test -v -cover -coverprofile coverage.txt ./... && echo " \n==>\033[32m Ok\033[m\n" || exit 1
4433
4534# # coverage: view test coverage in browser
@@ -59,38 +48,23 @@ lint: install-golangci-lint
5948 golangci-lint run
6049
6150# # build_linux_amd64: build the authgate binary for linux amd64
62- build_linux_amd64 : generate
51+ build_linux_amd64 :
6352 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO ) build -a -tags ' $(TAGS)' -ldflags ' $(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/amd64/$(EXECUTABLE ) .
6453
6554# # build_linux_arm64: build the authgate binary for linux arm64
66- build_linux_arm64 : generate
55+ build_linux_arm64 :
6756 CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO ) build -a -tags ' $(TAGS)' -ldflags ' $(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm64/$(EXECUTABLE ) .
6857
6958# # clean: remove build artifacts and test coverage
7059clean :
7160 rm -rf bin/ release/ coverage.txt
72- find internal/templates -name " *_templ.go" -delete
7361
7462# # rebuild: clean and build
7563rebuild : clean build
7664
7765.PHONY : help build install test coverage fmt lint clean rebuild
7866.PHONY : build_linux_amd64 build_linux_arm64
79- .PHONY : install-templ generate watch air dev
8067.PHONY : install-golangci-lint mod-download mod-tidy mod-verify check-tools version
81- .PHONY : docker-build docker-run
82-
83- # # install-templ: install templ CLI if not installed
84- install-templ :
85- @command -v templ > /dev/null 2>&1 || $(GO ) install github.com/a-h/templ/cmd/templ@$(TEMPL_VERSION )
86-
87- # # generate: run templ generate to compile .templ files
88- generate : install-templ
89- templ generate
90-
91- # # watch: watch mode for automatic regeneration
92- watch : install-templ
93- templ generate --watch
9468
9569# # help: print this help message
9670help :
@@ -112,20 +86,10 @@ mod-verify:
11286# # check-tools: verify required tools are installed
11387check-tools :
11488 @command -v $(GO ) > /dev/null 2>&1 || (echo " Go not found" && exit 1)
115- @command -v templ > /dev/null 2>&1 || echo " templ not installed (run: make install-templ)"
11689 @command -v golangci-lint > /dev/null 2>&1 || echo " golangci-lint not installed (run: make install-golangci-lint)"
11790
11891# # version: display version information
11992version :
12093 @echo " Version: $( VERSION) "
12194 @echo " Commit: $( COMMIT) "
12295 @echo " Go Version: $( shell $( GO) version) "
123-
124- # # docker-build: build docker image
125- docker-build :
126- docker build -t authgate:$(VERSION ) -f Dockerfile .
127-
128- # # docker-run: run docker container
129- docker-run :
130- docker run -p 8080:8080 --env-file .env authgate:$(VERSION )
131-
0 commit comments