-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (45 loc) · 1.69 KB
/
Makefile
File metadata and controls
61 lines (45 loc) · 1.69 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
PREFIX=/usr/local
DESTDIR=
GOFLAGS=-ldflags "-s -w -X github.com/pcelvng/task-tools.Version=${version} -X github.com/pcelvng/task-tools.BuildTimeUTC=`date -u '+%Y-%m-%d_%I:%M:%S%p'`"
BINDIR=${PREFIX}/bin
BLDDIR = build
ifeq ("${version}", "")
version=$(shell git describe --tags --always)
endif
EXT=
ifeq (${GOOS},windows)
EXT=.exe
endif
APPS = sort2file deduper filecopy json2csv csv2json sql-load sql-readx bigquery transform db-check
TOOLS = filewatcher logger nsq-monitor recap
ALL = $(APPS) $(TOOLS) flowlord
all:
rm -rf ${BLDDIR}
@mkdir -p ${BLDDIR}
CGO_ENABLED=0 go build ${GOFLAGS} -o ${BLDDIR} $(addprefix ./apps/utils/, $(TOOLS)) $(addprefix ./apps/workers/, $(APPS)) ./apps/flowlord
linux_build:
@mkdir -p ${BLDDIR}/linux
CGO_ENABLED=0 GOOS=linux go build ${GOFLAGS} -o ${BLDDIR}/linux/ $(addprefix ./apps/utils/, $(TOOLS)) $(addprefix ./apps/workers/, $(APPS)) ./apps/flowlord
$(APPS): %: $(BLDDIR)/%
$(TOOLS): %: $(BLDDIR)/%
$(BLDDIR)/%: clean
@mkdir -p $(dir $@)
CGO_ENABLED=0 GOOS=linux go build ${GOFLAGS} -o ${BLDDIR}/linux/$(@F) ./apps/*/$* ; \
go build ${GOFLAGS} -o ${BLDDIR}/$(@F) ./apps/*/$*
install/%:
go install ${GOFLAGS} ./apps/*/$*
flowlord:
CGO_ENABLED=0 GOOS=linux go build ${GOFLAGS} -o build/linux/flowlord ./apps/flowlord/ ; \
go build ${GOFLAGS} -o build/flowlord ./apps/flowlord
clean:
rm -rf $(BLDDIR)
install:
go install ${GOFLAGS} $(addprefix ./apps/utils/, $(TOOLS)) $(addprefix ./apps/workers/, $(APPS)) ./apps/flowlord
docker: linux_build
docker build -t hydronica/task-tools:${version} .
docker push hydronica/task-tools:${version}
# run unit tests
test:
go test ./... ./apps/...
.PHONY: install clean docker all flowlord
.PHONY: $(APPS) $(TOOLS)