-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04d02fd
commit c5d5b43
Showing
5 changed files
with
250 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
build | ||
|
||
coverage.txt | ||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
TARGET=./build | ||
ARCHS=amd64 386 | ||
LDFLAGS="-s -w" | ||
GCFLAGS="all=-trimpath=$(shell pwd)" | ||
ASMFLAGS="all=-trimpath=$(shell pwd)" | ||
|
||
current: | ||
@go build -o ./scilla; \ | ||
echo "Done." | ||
|
||
fmt: | ||
@gofmt -s ./*; \ | ||
echo "Done." | ||
|
||
remod: | ||
rm -rf go.* | ||
go mod init github.com/edoardottt/scilla | ||
go get | ||
|
||
update: | ||
@go get -u; \ | ||
go mod tidy -v; \ | ||
echo "Done." | ||
|
||
windows: | ||
@for GOARCH in ${ARCHS}; do \ | ||
echo "Building for windows $${GOARCH} ..." ; \ | ||
mkdir -p ${TARGET}/scilla-windows-$${GOARCH} ; \ | ||
GOOS=windows GOARCH=$${GOARCH} GO111MODULE=on CGO_ENABLED=0 go build -ldflags=${LDFLAGS} -gcflags=${GCFLAGS} -asmflags=${ASMFLAGS} -o ${TARGET}/scilla-windows-$${GOARCH}/scilla.exe ; \ | ||
done; \ | ||
echo "Done." | ||
|
||
linux: | ||
@for GOARCH in ${ARCHS}; do \ | ||
echo "Building for linux $${GOARCH} ..." ; \ | ||
mkdir -p ${TARGET}/scilla-linux-$${GOARCH} ; \ | ||
GOOS=linux GOARCH=$${GOARCH} GO111MODULE=on CGO_ENABLED=0 go build -ldflags=${LDFLAGS} -gcflags=${GCFLAGS} -asmflags=${ASMFLAGS} -o ${TARGET}/scilla-linux-$${GOARCH}/scilla ; \ | ||
done; \ | ||
echo "Done." | ||
|
||
all: clean fmt update test linux windows | ||
|
||
test: | ||
@go test -v -race ./... ; \ | ||
echo "Done." | ||
|
||
clean: | ||
@rm -rf ${TARGET}/* ; \ | ||
go clean ./... ; \ | ||
echo "Done." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
@echo off | ||
|
||
SET ARG=%1 | ||
SET TARGET=.\build | ||
SET BUILDARGS=-ldflags="-s -w" -gcflags="all=-trimpath=%GOPATH%\src" -asmflags="all=-trimpath=%GOPATH%\src" | ||
|
||
IF "%ARG%"=="" ( | ||
go build -o .\scilla.exe | ||
GOTO Done | ||
) | ||
|
||
IF "%ARG%"=="windows" ( | ||
CALL :Windows | ||
GOTO Done | ||
) | ||
|
||
IF "%ARG%"=="linux" ( | ||
CALL :Linux | ||
GOTO Done | ||
) | ||
|
||
IF "%ARG%"=="update" ( | ||
CALL :Update | ||
GOTO Done | ||
) | ||
|
||
IF "%ARG%"=="fmt" ( | ||
CALL :Fmt | ||
GOTO Done | ||
) | ||
|
||
IF "%ARG%"=="remod" ( | ||
del go.mod | ||
del go.sum | ||
go mod init github.com/edoardottt/scilla | ||
go get | ||
GOTO Done | ||
) | ||
|
||
IF "%ARG%"=="all" ( | ||
CALL :Fmt | ||
CALL :Update | ||
CALL :Remod | ||
CALL :Test | ||
CALL :Linux | ||
CALL :Windows | ||
GOTO Done | ||
) | ||
|
||
IF "%ARG%"=="clean" ( | ||
del /F /Q %TARGET%\*.* | ||
go clean ./... | ||
echo Done. | ||
GOTO Done | ||
) | ||
|
||
IF "%ARG%"=="test" ( | ||
CALL :Test | ||
GOTO Done | ||
) | ||
|
||
GOTO Done | ||
|
||
:Test | ||
set GO111MODULE=on | ||
set CGO_ENABLED=0 | ||
echo Testing ... | ||
go test -v ./... | ||
echo Done | ||
EXIT /B 0 | ||
|
||
:Fmt | ||
set GO111MODULE=on | ||
echo Formatting ... | ||
go fmt ./... | ||
echo Done. | ||
EXIT /B 0 | ||
|
||
:Update | ||
set GO111MODULE=on | ||
echo Updating ... | ||
go get -u | ||
go mod tidy -v | ||
echo Done. | ||
EXIT /B 0 | ||
|
||
:Linux | ||
set GOOS=linux | ||
set GOARCH=amd64 | ||
set GO111MODULE=on | ||
set CGO_ENABLED=0 | ||
echo Building for %GOOS% %GOARCH% ... | ||
set DIR=%TARGET%\scilla-%GOOS%-%GOARCH% | ||
mkdir %DIR% 2> NUL | ||
go build %BUILDARGS% -o %DIR%\scilla | ||
set GOARCH=386 | ||
echo Building for %GOOS% %GOARCH% ... | ||
set DIR=%TARGET%\scilla-%GOOS%-%GOARCH% | ||
mkdir %DIR% 2> NUL | ||
go build %BUILDARGS% -o %DIR%\scilla | ||
echo Done. | ||
EXIT /B 0 | ||
|
||
:Windows | ||
set GOOS=windows | ||
set GOARCH=amd64 | ||
set GO111MODULE=on | ||
set CGO_ENABLED=0 | ||
echo Building for %GOOS% %GOARCH% ... | ||
set DIR=%TARGET%\scilla-%GOOS%-%GOARCH% | ||
mkdir %DIR% 2> NUL | ||
go build %BUILDARGS% -o %DIR%\scilla.exe | ||
set GOARCH=386 | ||
echo Building for %GOOS% %GOARCH% ... | ||
set DIR=%TARGET%\scilla-%GOOS%-%GOARCH% | ||
mkdir %DIR% 2> NUL | ||
go build %BUILDARGS% -o %DIR%\scilla.exe | ||
echo Done. | ||
EXIT /B 0 | ||
|
||
:Done |