Files
filebrowser/Makefile
T

81 lines
2.3 KiB
Makefile
Raw Normal View History

2021-12-20 23:16:35 +01:00
include common.mk
include tools.mk
LDFLAGS += -X "$(MODULE)/version.Version=$(VERSION)" -X "$(MODULE)/version.CommitSHA=$(VERSION_HASH)"
2025-06-29 09:51:44 +02:00
SITE_DOCKER_FLAGS = \
-v $(CURDIR)/www:/docs \
-v $(CURDIR)/LICENSE:/docs/docs/LICENSE \
-v $(CURDIR)/SECURITY.md:/docs/docs/security.md \
-v $(CURDIR)/CHANGELOG.md:/docs/docs/changelog.md \
-v $(CURDIR)/CODE-OF-CONDUCT.md:/docs/docs/code-of-conduct.md \
-v $(CURDIR)/CONTRIBUTING.md:/docs/docs/contributing.md
2021-12-20 23:16:35 +01:00
## Build:
.PHONY: build
2021-12-20 23:16:35 +01:00
build: | build-frontend build-backend ## Build binary
.PHONY: build-frontend
2021-12-20 23:16:35 +01:00
build-frontend: ## Build frontend
2024-12-09 12:27:18 +01:00
$Q cd frontend && pnpm install --frozen-lockfile && pnpm run build
.PHONY: build-backend
2021-12-20 23:16:35 +01:00
build-backend: ## Build backend
$Q $(go) build -ldflags '$(LDFLAGS)' -o .
.PHONY: test
2021-12-20 23:16:35 +01:00
test: | test-frontend test-backend ## Run all tests
.PHONY: test-frontend
2021-12-20 23:16:35 +01:00
test-frontend: ## Run frontend tests
2024-12-09 12:27:18 +01:00
$Q cd frontend && pnpm install --frozen-lockfile && pnpm run typecheck
.PHONY: test-backend
2021-12-20 23:16:35 +01:00
test-backend: ## Run backend tests
$Q $(go) test -v ./...
.PHONY: lint
2024-04-24 22:51:37 +02:00
lint: lint-frontend lint-backend ## Run all linters
.PHONY: lint-frontend
2021-12-20 23:16:35 +01:00
lint-frontend: ## Run frontend linters
2024-12-09 12:27:18 +01:00
$Q cd frontend && pnpm install --frozen-lockfile && pnpm run lint
.PHONY: lint-backend
2021-12-20 23:16:35 +01:00
lint-backend: | $(golangci-lint) ## Run backend linters
$Q $(golangci-lint) run -v
2021-12-20 23:16:35 +01:00
fmt: $(goimports) ## Format source files
$Q $(goimports) -local $(MODULE) -w $$(find . -type f -name '*.go' -not -path "./vendor/*")
clean: clean-tools ## Clean
## Release:
2021-12-20 22:36:35 +01:00
.PHONY: site
site: ## Build site
@rm -rf www/public
docker build -f www/Dockerfile --progress=plain -t filebrowser.site www
2025-06-29 09:51:44 +02:00
docker run --rm $(SITE_DOCKER_FLAGS) filebrowser.site build -d "public"
.PHONY: site-serve
site-serve: ## Serve site for development
docker build -f www/Dockerfile --progress=plain -t filebrowser.site www
2025-06-29 09:51:44 +02:00
docker run --rm -it -p 8000:8000 $(SITE_DOCKER_FLAGS) filebrowser.site
2021-12-20 23:16:35 +01:00
## Help:
help: ## Show this help
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target> [options]${RESET}'
@echo ''
@echo 'Options:'
@$(call global_option, "V [0|1]", "enable verbose mode (default:0)")
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} { \
if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n", $$1, $$2} \
else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \
2024-12-09 12:27:18 +01:00
}' $(MAKEFILE_LIST)