-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
50 lines (39 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
41
42
43
44
45
46
47
48
49
50
SOURCES = affixes.go affixes_test.go completer.go config.go fwew.go fwew_test.go lib.go lib_test.go numbers.go numbers_test.go txt.go version.go word.go
TAG = build
OS = nix
ifeq ($(OS),nix)
CP = sudo cp
RM = sudo rm
BINDEST = /usr/local/bin
else ifeq ($(OS),termux)
CP = cp
RM = rm
BINDEST = /data/data/com.termux/files/usr/bin
endif
fwew: format compile
all: test docker cross-compile
format:
gofmt -w $(SOURCES)
compile:
go build -o bin/fwew ./...
cross-compile:
GOOS=darwin go build -o bin/mac/fwew ./...
GOOS=linux go build -o bin/linux/fwew ./...
GOOS=windows go build -o bin/windows/fwew.exe ./...
test: install
go test -v -cover
docker:
docker build -t tirea/fwew:$(TAG) .
docker run -it --rm tirea/fwew:$(TAG) -v -r test
copy:
@test -n "$(BIN)" || (echo "Error: BIN variable not set. BIN must be set to one of the following:" ; ls bin | grep -v fwew ; exit 1)
$(CP) bin/$(BIN)/fwew $(BINDEST)/
cp -r .fwew ~/
install: fwew
$(CP) bin/fwew $(BINDEST)/
cp -r .fwew ~/
uninstall:
$(RM) $(BINDEST)/fwew
rm -rf ~/.fwew
clean:
rm -f bin/fwew