-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
40 lines (30 loc) · 774 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
35
36
37
38
39
40
GOCMD=go
GOTEST=$(GOCMD) test
.PHONY: test build dep
# Project output directory.
PWD := $(shell pwd)
OUTPUT_DIR := $(PWD)/bin
TARGETS := $(shell basename -s .go ./cli/*.go)
echo:
@echo $(TARGETS)
build: dep
@for target in $(TARGETS); do \
cd $(PWD)/cli; $(GOCMD) build -o ../bin/$$target ./$$target.go ; \
done
web: dep
@mkdir -p ./bin
@cd $(PWD)/web; $(GOCMD) build -o ../bin/www web.go
dep:
@cd ./internal; $(GOCMD) mod tidy
@cd ./task; $(GOCMD) mod tidy
@cd ./cli; $(GOCMD) mod tidy
@cd ./task; $(GOCMD) mod tidy
clean:
@rm -f $(OUTPUT_DIR)/*
@cd ./internal; $(GOCMD) clean -modcache
@cd ./task; $(GOCMD) clean -modcache
@cd ./cli; $(GOCMD) clean -modcache
@cd ./test; $(GOCMD) clean -modcache
@$(GOCMD) clean
test:
@cd ./test; $(GOTEST)