-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
30 lines (24 loc) · 710 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
RELEASE_DIR=bin
REVISION=$(shell git rev-parse --verify HEAD | cut -c-6)
.PHONY: clean build build-amd64-windows $(DIRNAME) all
all: build-windows-amd64
build-windows-amd64:
@rm -rf bin && mkdir bin
@for v in `ls _example`; do \
$(MAKE) build DIRNAME=$$v GOOS=windows GOARCH=amd64; \
done;
build-windows-386:
@echo not supported
exit 255
build: $(DIRNAME)
$(DIRNAME):
ifndef VERSION
@echo '[ERROR] $$VERSION must be specified'
exit 255
endif
@echo "Building _example/$(DIRNAME)"
@cd _example/$(DIRNAME);\
go build -ldflags "-X main.revision=$(REVISION) -X main.version=$(VERSION)"
@mv _example/$(DIRNAME)/$(DIRNAME).exe bin/$(DIRNAME)-$(VERSION)-$(GOARCH).exe
clean:
rm -rf $(RELEASE_DIR)/*