summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 610053269fdf3d380c2799ef1696ef6c22c9634b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
.PHONY: lint lint-html lint-css lint-go lint-js build build-all clean deps verify

help:
	@echo "Available commands:"
	@echo "  make deps      - Download and verify Go dependencies"
	@echo "  make build     - Build for multiple architectures (amd64, arm64)"
	@echo "  make clean     - Remove build artifacts"
	@echo "  make verify    - Verify Go module checksums"
	@echo "  make lint      - Run all linters"
	@echo "  make lint-html - Lint HTML files (html-validate)"
	@echo "  make lint-css  - Lint CSS files (stylelint)"
	@echo "  make lint-go   - Lint Go files (go vet + golangci-lint)"
	@echo "  make lint-js   - Lint JavaScript files (eslint)"

lint-html:
	@echo "Linting HTML files..."
	npx html-validate templates/*.html

lint-css:
	@echo "Linting CSS files..."
	npx stylelint static/css/*.css

lint-go:
	@echo "Linting Go files..."
	go vet ./...
	golangci-lint run

lint-js:
	@echo "Linting JavaScript files..."
	npx eslint static/js/*.js

deps:
	@echo "Downloading Go dependencies..."
	go mod download
	@echo "Verifying Go module checksums..."
	go mod verify
	@echo "Cleaning up unused dependencies..."
	go mod tidy
	@echo "Dependencies ready!"

verify:
	@echo "Verifying Go module checksums..."
	go mod verify

build: deps
	@echo "Building for multiple Linux architectures..."
	@mkdir -p dist
	@echo "Building for Linux amd64..."
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o dist/wg-portal-linux-amd64 main.go
	@echo "Building for Linux arm64..."
	CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o dist/wg-portal-linux-arm64 main.go
	@echo "Building for Linux arm..."
	CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w" -o dist/wg-portal-linux-arm main.go
	@echo "Generating checksums..."
	@cd dist && sha256sum * > checksums.txt
	@echo "All builds complete! Check the dist/ directory."

clean:
	@echo "Cleaning build artifacts..."
	rm -rf dist/
	@echo "Clean complete!"

lint: lint-go lint-js lint-html lint-css
	@echo "All linting complete!"