~hristoast/mousikofidi

ref: a5bab91b0e79c71dbbdebbe9a0c25b275ada8077 mousikofidi/Makefile -rw-r--r-- 2.8 KiB
a5bab91bHristos N. Triantafillou Better packaing a month ago
                                                                                
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
proj_dir := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))

.DEFAULT_GOAL:= pkg

build: build-cli-all build-server-all

build-cli-all: build-cli-linux-amd64 build-cli-linux-arm64 build-cli-windows-amd64

build-server-all: build-server-linux-amd64 build-server-linux-arm64 build-server-windows-amd64

build-cli-linux-amd64:
	cd $(proj_dir) && GOPATH=$$HOME/.local/go GOOS=linux GOARCH=amd64 go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags="-linkmode=external -s -w -X 'git.sr.ht/~hristoast/mousikofidi/cfg.Version=$$(git describe --tags)'" -o ./mousikofidi-cli-linux-amd64 ./cmd/mousikofidi-cli

build-cli-linux-arm64:
	cd $(proj_dir) && GOPATH=$$HOME/.local/go GOOS=linux GOARCH=arm64 go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags="-s -w -X 'git.sr.ht/~hristoast/mousikofidi/cfg.Version=$$(git describe --tags)'" -o ./mousikofidi-cli-linux-arm64 ./cmd/mousikofidi-cli

build-cli-windows-amd64:
	cd $(proj_dir) && GOPATH=$$HOME/.local/go GOOS=windows GOARCH=amd64 go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags="-s -w -X 'git.sr.ht/~hristoast/mousikofidi/cfg.Version=$$(git describe --tags)'" -o ./mousikofidi-cli.exe ./cmd/mousikofidi-cli

build-server-linux-amd64:
	cd $(proj_dir) && GOPATH=$$HOME/.local/go GOOS=linux GOARCH=amd64 go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags="-linkmode=external -s -w -X 'git.sr.ht/~hristoast/mousikofidi/cfg.Version=$$(git describe --tags)'" -o ./mousikofidi-server-linux-amd64 ./cmd/mousikofidi

build-server-linux-arm64:
	cd $(proj_dir) && GOPATH=$$HOME/.local/go GOOS=linux GOARCH=arm64 go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags="-s -w -X 'git.sr.ht/~hristoast/mousikofidi/cfg.Version=$$(git describe --tags)'" -o ./mousikofidi-server-linux-arm64 ./cmd/mousikofidi

build-server-windows-amd64:
	cd $(proj_dir) && GOPATH=$$HOME/.local/go GOOS=windows GOARCH=amd64 go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags="-s -w -X 'git.sr.ht/~hristoast/mousikofidi/cfg.Version=$$(git describe --tags)'" -o ./mousikofidi-server.exe ./cmd/mousikofidi

clean: clean-cli clean-server

clean-cli:
	cd $(proj_dir) && rm -f mousikofidi-cli-*-* mousikofidi-cli.*

clean-server:
	cd $(proj_dir) && rm -f mousikofidi-server-*-* mousikofidi-server.*

pkg: clean build
	cd $(proj_dir) && ./package.sh

run:
	cd $(proj_dir) && GOPATH=$$HOME/.local/go go run ./cmd/mousikofidi

# test:
# 	cd $(proj_dir) && GOPATH=$$HOME/.local/go go test -coverage -v ./cmd/mousikofidi

podman-build-image:
	cd $(proj_dir) && podman build -t mousikofidi:$$(git describe --tags) .

podman-build-mousikofidi:
	cd $(proj_dir) && command podman run -v $(proj_dir):/mnt -it --rm mousikofidi:$$(git describe --tags)

podman-build: clean podman-build-image podman-build-mousikofidi