-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (25 loc) · 945 Bytes
/
Makefile
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
VERSION ?= $(shell git describe --tags --always --dirty --match=v* 2> /dev/null || cat $(CURDIR)/.version 2> /dev/null || echo v0)
BLDVER = module:$(MODULE),version:$(VERSION),build:$(shell date +"%Y%m%d.%H%M%S.%N.%z")
BASE = $(CURDIR)
MODULE = oceand
.PHONY: all $(MODULE) debug
all: version $(MODULE)
$(MODULE):| $(BASE)
@GO111MODULE=on GOFLAGS=-mod=vendor go build -v -o $(BASE)/bin/$@
$(BASE):
@mkdir -p $(dir $@)
debug: $(BASE)
@go build -gcflags="-N -l" -v -o $(BASE)/bin/$(MODULE)
# misc
prune:
@docker system prune -f
.PHONY: clean version list
clean:
@rm -rfv bin;
$(MAKE) dockerclean
dockerclean:
@docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
version:
@echo "Version: $(VERSION)"
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs