forked from rokett/Citrix-NetScaler-Exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.bat
48 lines (32 loc) · 843 Bytes
/
make.bat
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
@echo off
SETLOCAL
set _TARGETS=build
set APP=Citrix-NetScaler-Exporter
set VERSION=2.0.0
set BINARY-X86=%APP%_%VERSION%_Windows_32bit.exe
set BINARY-X64=%APP%_%VERSION%_Windows_64bit.exe
REM Set build number from git commit hash
for /f %%i in ('git rev-parse HEAD') do set BUILD=%%i
if [%1]==[] goto usage
REM *** CHECK THAT VALID ARG IS PASSED ***
set LDFLAGS=-ldflags "-X main.version=%VERSION% -X main.build=%BUILD%"
goto %1
:build
set GOOS=windows
echo "=== Building x86 ==="
set GOARCH=386
go build -o %BINARY-X86% %LDFLAGS%
echo "=== Building x64 ==="
set GOARCH=amd64
go build -o %BINARY-X64% %LDFLAGS%
goto :finalise
:usage
echo usage: make [target]
echo.
echo target is one of {%_TARGETS%}.
exit /b 2
goto :eof
:finalise
set GOOS=
set GOARCH=
goto :EOF