~hristoast/wem

wem/Makefile -rw-r--r-- 1.1 KiB
173cf260Hristos N. Triantafillou Do pre run with exec 4 months 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
proj_dir := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))

.DEFAULT_GOAL:= rebuild

build:
	GOPATH=$$HOME/.local/go go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags="-linkmode=external -s -w -X 'git.sr.ht/~hristoast/wem/cfg.WemVersion=$$(git describe --tags)'" -o $(proj_dir)/wem $(proj_dir)/cmd/wem/main.go

clean:
	rm -frv $(proj_dir)/wem rm -frv $(proj_dir)/wem.tar.bz2 $(proj_dir)/wem.6
	cd $(proj_dir)/test && make clean

install: rebuild
	install -D wem /opt/wem/bin

manpage:
	cd $(proj_dir) && md2man-roff manpage.md > wem.6

rebuild: clean test

pkg: rebuild
	$(proj_dir)/package.sh

# The build target is a requirement for test because the
# tests themselves depend on having a usable WEM executable.
test: clean build test-exes
	cd $(proj_dir) && GOPATH=$$HOME/.local/go go test -cover ./...

test-exes:
	cd $(proj_dir)/test && make

docker-build-image:
	cd $(proj_dir) && command sudo docker build -t wem:$$(git describe --tags) .

docker-build-wem:
	cd $(proj_dir) && command sudo docker run -v $(proj_dir):/mnt -it --rm wem:$$(git describe --tags)

docker-pkg: docker-build-image docker-build-wem