Skip to content

Commit d8be724

Browse files
committed
Merge in the build script branch
2 parents 523e5e1 + 17b7c78 commit d8be724

File tree

6 files changed

+132
-13
lines changed

6 files changed

+132
-13
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ _testmain.go
2525
*.txt
2626
*.swp
2727

28-
gobuster
28+
gobuster
29+
build

Makefile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
TARGET=./build
2+
OSES=darwin linux windows
3+
ARCHS=amd64 386
4+
5+
current: outputdir
6+
@go build -o ./gobuster; \
7+
echo "Done."
8+
9+
outputdir:
10+
@mkdir -p ${TARGET}
11+
12+
windows: outputdir
13+
@for GOARCH in ${ARCHS}; do \
14+
echo "Building for windows $${GOARCH} ..." ; \
15+
GOOS=windows GARCH=$${GOARCH} go build -o ${TARGET}/gobuster-$${GOARCH}.exe ; \
16+
done; \
17+
echo "Done."
18+
19+
linux: outputdir
20+
@for GOARCH in ${ARCHS}; do \
21+
echo "Building for linux $${GOARCH} ..." ; \
22+
GOOS=linux GARCH=$${GOARCH} go build -o ${TARGET}/gobuster-linux-$${GOARCH} ; \
23+
done; \
24+
echo "Done."
25+
26+
darwin: outputdir
27+
@for GOARCH in ${ARCHS}; do \
28+
echo "Building for darwin $${GOARCH} ..." ; \
29+
GOOS=darwin GARCH=$${GOARCH} go build -o ${TARGET}/gobuster-darwin-$${GOARCH} ; \
30+
done; \
31+
echo "Done."
32+
33+
34+
all: darwin linux windows
35+
36+
test:
37+
@go test -v -race ./... ; \
38+
echo "Done."
39+
40+
clean:
41+
@rm -rf ${TARGET}/* ; \
42+
echo "Done."

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ This will create a `gobuster` binary for you. If you want to install it in the `
7878
```
7979
gobuster $ go install
8080
```
81+
If you have all the dependencies already, you can make use of the build scripts:
82+
* `make` - builds for the current Go configuration (ie. runs `go build`).
83+
* `make windows` - builds 32 and 64 bit binaries for windows, and writes them to the `build` subfolder.
84+
* `make linux` - builds 32 and 64 bit binaries for linux, and writes them to the `build` subfolder.
85+
* `make darwin` - builds 32 and 64 bit binaries for darwin, and writes them to the `build` subfolder.
86+
* `make all` - builds for all platforms and architectures, and writes the resulting binaries to the `build` subfolder.
87+
* `make clean` - clears out the `build` subfolder.
88+
* `make test` - runs the tests (requires you to `go get githubcom/h2non/gock` first).
8189

8290
#### Running as a script
8391
```

make.bat

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
@echo off
2+
3+
SET ARG=%1
4+
SET TARGET=.\build
5+
6+
IF "%ARG%"=="test" (
7+
go test -v -race ./...
8+
echo Done.
9+
GOTO Done
10+
)
11+
12+
IF "%ARG%"=="clean" (
13+
del /F /Q %TARGET%\*.*
14+
echo Done.
15+
GOTO Done
16+
)
17+
18+
IF "%ARG%"=="windows" (
19+
CALL :Windows
20+
GOTO Done
21+
)
22+
23+
IF "%ARG%"=="darwin" (
24+
CALL :Darwin
25+
GOTO Done
26+
)
27+
28+
IF "%ARG%"=="linux" (
29+
CALL :Linux
30+
GOTO Done
31+
)
32+
33+
IF "%ARG%"=="all" (
34+
CALL :Darwin
35+
CALL :Linux
36+
CALL :Windows
37+
GOTO Done
38+
)
39+
40+
IF "%ARG%"=="" (
41+
go build -o .\gobuster.exe
42+
GOTO Done
43+
)
44+
45+
GOTO Done
46+
47+
:Darwin
48+
set GOOS=darwin
49+
set GOARCH=amd64
50+
echo Building for %GOOS% %GOARCH% ...
51+
go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
52+
set GOARCH=386
53+
echo Building for %GOOS% %GOARCH% ...
54+
go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
55+
echo Done.
56+
EXIT /B 0
57+
58+
:Linux
59+
set GOOS=linux
60+
set GOARCH=amd64
61+
echo Building for %GOOS% %GOARCH% ...
62+
go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
63+
set GOARCH=386
64+
echo Building for %GOOS% %GOARCH% ...
65+
go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
66+
echo Done.
67+
EXIT /B 0
68+
69+
:Windows
70+
set GOOS=windows
71+
set GOARCH=amd64
72+
echo Building for %GOOS% %GOARCH% ...
73+
go build -o %TARGET%\gobuster-%GOARCH%.exe
74+
set GOARCH=386
75+
echo Building for %GOOS% %GOARCH% ...
76+
go build -o %TARGET%\gobuster-%GOARCH%.exe
77+
echo Done.
78+
EXIT /B 0
79+
80+
:Done

make_linux.bat

-6
This file was deleted.

make_windows.bat

-6
This file was deleted.

0 commit comments

Comments
 (0)