-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
39 lines (29 loc) · 1.16 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
LDFLAGS = "-X main.Buildstamp=`date -u '+%Y-%m-%d_%I:%M:%S%p'` -X main.Githash=`git rev-parse HEAD`"
SRC := $(shell find ./ -type f -regex ".*\.go")
RELEASE_DIR = $(shell echo "releases/release_`git rev-parse HEAD`")
all: archive_redditor
release: target-darwin-amd64 target-linux-amd64 target-windows-amd64
test:
go test -v .
archive_redditor:
go build -v .
install:
go install -v .
target-darwin-amd64: $(SRC)
mkdir -p $(RELEASE_DIR)
GOOS=darwin GOARCH=amd64 go build -o archive_redditor -ldflags $(LDFLAGS) .
zip $(RELEASE_DIR)/archive_redditor_darwin_amd64.zip archive_redditor
rm -f archive_redditor
target-linux-amd64: $(SRC)
mkdir -p $(RELEASE_DIR)
GOOS=linux GOARCH=amd64 go build -o archive_redditor -ldflags $(LDFLAGS) .
zip $(RELEASE_DIR)/archive_redditor_linux_amd64.zip archive_redditor
rm -f archive_redditor
target-windows-amd64: $(SRC)
mkdir -p $(RELEASE_DIR)
GOOS=windows GOARCH=amd64 go build -o archive_redditor.exe -ldflags $(LDFLAGS) .
zip $(RELEASE_DIR)/archive_redditor_windows_amd64.zip archive_redditor.exe
rm -f archive_redditor.exe
clean:
rm -rf archive_redditor archive_redditor.exe $(RELEASE_DIR)
.PHONY: $(release) clean install test