-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (50 loc) · 1.58 KB
/
Makefile
File metadata and controls
63 lines (50 loc) · 1.58 KB
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
VERSION := $(shell git describe --tags --always --dirty)
COMMIT := $(shell git rev-parse HEAD)
DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
EXT :=
MOVE := mv
RM_RF := rm -rf ./static
UNAME_S := $(shell uname -s)
ifeq ($(OS),Windows_NT)
EXT := .exe
MOVE := move
RM_RF := if exist static ( rmdir /s /q static )
endif
.PHONY: test_release run_docker update_depends update_frontend_depends build
test_release:
@echo "<<< Starting test release"
@goreleaser release --snapshot --clean
@echo "<<< Test release complete"
run_docker:
@echo "<<< Starting Docker containers"
@docker-compose up -d
@echo "<<< Docker containers are up"
update_depends:
@echo "<<< Updating Go dependencies"
@go get all
@go mod tidy
@echo "<<< Go dependencies updated"
update_frontend_depends:
@echo "<<< Updating frontend dependencies"
@cd Frontend && bun update
@echo "<<< Frontend dependencies updated"
build:
@echo "<<< Building React Frontend"
@(cd Frontend && bun install && bun run build)
@echo "<<< Cleaning static folder"
@$(RM_RF)
@echo "<<< Moving new static files"
@$(MOVE) Frontend/static .
@echo "<<< Building Go Backend"
@go build \
-mod=readonly \
-trimpath \
-tags="mysql postgres sqlite sqlserver" \
-o=QuicKNote$(EXT) \
-ldflags="-s -w -buildid= -extldflags=-static \
-X github.com/Sn0wo2/QuickNote/pkg/version.version=$(VERSION) \
-X github.com/Sn0wo2/QuickNote/pkg/version.commit=$(COMMIT) \
-X github.com/Sn0wo2/QuickNote/pkg/version.date=$(DATE)" \
-gcflags="all=-d=ssa/check_bce/debug=0" \
-asmflags="-trimpath" main.go
@echo "<<< Build complete: ./QuicKNote$(EXT)"