-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
52 lines (38 loc) · 1.26 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
41
42
43
44
45
46
47
48
49
50
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 = filewatcher sort2file deduper recap filecopy logger json2csv csv2json sql-load sql-readx bigquery transform db-check
all: $(APPS) flowlord
$(APPS): %: $(BLDDIR)/%
$(BLDDIR)/%: clean
@mkdir -p $(dir $@)
cd apps; \
CGO_ENABLED=0 GOOS=linux go build ${GOFLAGS} -o ${BLDDIR}/linux/$(@F) ./*/$* ; \
go build ${GOFLAGS} -o ${BLDDIR}/$(@F) ./*/$*
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: $(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: all
docker build -t hydronica/task-tools:${version} .
docker push hydronica/task-tools:${version}
# run unit tests
test:
go test -cover ./...
go test -cover ./apps/...
.PHONY: install clean docker all flowlord
.PHONY: $(APPS)