Skip to content

Commit 17b7c78

Browse files
committed
Fixed up build files some more
1 parent 7586929 commit 17b7c78

File tree

3 files changed

+106
-37
lines changed

3 files changed

+106
-37
lines changed

Diff for: Makefile

+29-11
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,40 @@ TARGET=./build
22
OSES=darwin linux windows
33
ARCHS=amd64 386
44

5-
all:
5+
current: outputdir
6+
@go build -o ./gobuster; \
7+
echo "Done."
8+
9+
outputdir:
610
@mkdir -p ${TARGET}
7-
@for GOOS in ${OSES}; do \
8-
for GOARCH in ${ARCHS}; do \
9-
echo "Building for $${GOOS} $${GOARCH} ..." ; \
10-
if [ "$${GOOS}" == "windows" ]; then \
11-
GOOS=$${GOOS} GARCH=$${GOARCH} go build -o ${TARGET}/gobuster-$${GOARCH}.exe ; \
12-
else \
13-
GOOS=$${GOOS} GARCH=$${GOARCH} go build -o ${TARGET}/gobuster-$${GOOS}-$${GOARCH} ; \
14-
fi; \
15-
done; \
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} ; \
1623
done; \
1724
echo "Done."
1825

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+
1936
test:
20-
@go test -v -race ./...
37+
@go test -v -race ./... ; \
38+
echo "Done."
2139

2240
clean:
2341
@rm -rf ${TARGET}/* ; \

Diff for: 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
```

Diff for: make.bat

+69-26
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,80 @@
11
@echo off
22

3+
SET ARG=%1
34
SET TARGET=.\build
45

5-
IF %1=="test" (
6+
IF "%ARG%"=="test" (
67
go test -v -race ./...
8+
echo Done.
9+
GOTO Done
710
)
811

9-
IF %1=="clean" (
10-
del /F %TARGET%\*.*
12+
IF "%ARG%"=="clean" (
13+
del /F /Q %TARGET%\*.*
14+
echo Done.
15+
GOTO Done
1116
)
1217

13-
IF %1=="" (
14-
echo "Building for windows ..."
15-
set GOOS=windows
16-
set GOARCH=amd64
17-
go build -o %TARGET%\gobuster-%GOARCH%.exe
18-
set GOARCH=386
19-
go build -o %TARGET%\gobuster-%GOARCH%.exe
20-
21-
echo "Building for osx ..."
22-
set GOOS=osx
23-
set GOARCH=amd64
24-
go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
25-
set GOARCH=386
26-
go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
27-
28-
echo "Building for linux ..."
29-
set GOOS=osx
30-
set GOARCH=amd64
31-
go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
32-
set GOARCH=386
33-
go build -o %TARGET%\gobuster-%GOOS%-%GOARCH%
34-
35-
echo "Done."
18+
IF "%ARG%"=="windows" (
19+
CALL :Windows
20+
GOTO Done
3621
)
3722

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

0 commit comments

Comments
 (0)