forked from pcelvng/task-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (30 loc) · 1.05 KB
/
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
35
36
37
38
39
40
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 = backloader crontask files retry filewatcher sort2file deduper batcher http recap filecopy logger stats json2csv flowlord csv2json sql-load sql-readx bq-load transform
all: $(APPS)
$(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/*/$*
$(APPS): %: $(BLDDIR)/%
clean:
rm -rf $(BLDDIR)
.PHONY: install clean all
.PHONY: $(APPS)
install: $(APPS)
install -m 755 -d ${DESTDIR}${BINDIR}
for APP in $^ ; do install -m 755 ${BLDDIR}/$$APP ${DESTDIR}${BINDIR}/$$APP${EXT} ; done
rm -rf build
docker: $(APPS)
docker build -t hydronica/task-tools:${version} .
docker push hydronica/task-tools:${version}