diff --git a/Makefile b/Makefile index 62be2a261..65f08a054 100644 --- a/Makefile +++ b/Makefile @@ -273,20 +273,24 @@ help: @echo " - test[\#TestSpecificName] run unit test" @echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite" +### +# Check system and environment requirements +### + .PHONY: go-check go-check: $(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9]+' go.mod | cut -d' ' -f2)) $(eval MIN_GO_VERSION := $(shell printf "%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' '))) $(eval GO_VERSION := $(shell printf "%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9]+' | tr '.' ' ');)) @if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \ - echo "Gitea requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \ + echo "Forgejo requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \ exit 1; \ fi .PHONY: git-check git-check: @if git lfs >/dev/null 2>&1 ; then : ; else \ - echo "Gitea requires git with lfs support to run tests." ; \ + echo "Forgejo requires git with lfs support to run tests." ; \ exit 1; \ fi @@ -297,10 +301,14 @@ node-check: $(eval NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v | cut -c2- | tr '.' ' ');)) $(eval NPM_MISSING := $(shell hash npm > /dev/null 2>&1 || echo 1)) @if [ "$(NODE_VERSION)" -lt "$(MIN_NODE_VERSION)" -o "$(NPM_MISSING)" = "1" ]; then \ - echo "Gitea requires Node.js $(MIN_NODE_VERSION_STR) or greater and npm to build. You can get it at https://nodejs.org/en/download/"; \ + echo "Forgejo requires Node.js $(MIN_NODE_VERSION_STR) or greater and npm to build. You can get it at https://nodejs.org/en/download/"; \ exit 1; \ fi +### +# Basic maintenance, check and lint targets +### + .PHONY: clean-all clean-all: clean rm -rf $(WEBPACK_DEST_ENTRIES) node_modules @@ -500,6 +508,14 @@ lint-templates: .venv node_modules lint-yaml: .venv @poetry run yamllint . +.PHONY: security-check +security-check: + go run $(GOVULNCHECK_PACKAGE) ./... + +### +# Development and testing targets +### + .PHONY: watch watch: @bash tools/watch.sh @@ -782,6 +798,10 @@ e2e.sqlite.test: $(GO_SOURCES) .PHONY: check check: test +### +# Production / build targets +### + .PHONY: install $(TAGS_PREREQ) install: $(wildcard *.go) CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' @@ -811,10 +831,6 @@ generate-go: $(TAGS_PREREQ) merge-locales: @echo "NOT NEEDED: THIS IS A NOOP AS OF Forgejo 7.0 BUT KEPT FOR BACKWARD COMPATIBILITY" -.PHONY: security-check -security-check: - go run $(GOVULNCHECK_PACKAGE) ./... - $(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ) CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ @@ -878,6 +894,15 @@ release-sources: | $(DIST_DIRS) release-docs: | $(DIST_DIRS) docs tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs . +.PHONY: docker +docker: + docker build --disable-content-trust=false -t $(DOCKER_REF) . +# support also build args docker build --build-arg GITEA_VERSION=v1.2.3 --build-arg TAGS="bindata sqlite sqlite_unlock_notify" . + +### +# Dependency management +### + .PHONY: deps deps: deps-frontend deps-backend deps-tools deps-py @@ -979,11 +1004,6 @@ generate-manpage: @gzip -9 man/man1/gitea.1 && echo man/man1/gitea.1.gz created @#TODO A small script that formats config-cheat-sheet.en-us.md nicely for use as a config man page -.PHONY: docker -docker: - docker build --disable-content-trust=false -t $(DOCKER_REF) . -# support also build args docker build --build-arg GITEA_VERSION=v1.2.3 --build-arg TAGS="bindata sqlite sqlite_unlock_notify" . - # This endif closes the if at the top of the file endif