@@ -2,44 +2,38 @@ BINARY_NAME := ldrgen
2
2
SRC_FOLDER := src
3
3
BIN_FOLDER := bin
4
4
5
- GO_BUILD_CMD := GOOS=$(GOOS ) GOARCH=$(GOARCH ) go build -o
6
-
7
5
.PHONY : all windows linux clean win64 win32 x64 x86
8
6
9
7
all :
10
- @echo " [*] No default target specified, available targets: 'win64', 'win32', 'x64', 'x86'."
11
- @echo " [*] Alternatively, you can run 'make windows' or 'make linux' to compile for both platforms."
8
+ @echo " [*] Specify a target: windows, linux"
9
+
10
+ build : windows linux
12
11
13
- windows : GOOS=windows
14
12
windows : win64 win32
15
- @echo " [*] Done compiling for Windows x64 and x86, binaries are located at: $( BIN_FOLDER) "
16
13
17
- linux : GOOS=linux
18
14
linux : x64 x86
19
- @echo " [*] Done compiling for Linux x64 and x86, binaries are located at : $( BIN_FOLDER) "
15
+ @echo " [*] Done compiling for Linux x64 and x86, binaries are located in : $( BIN_FOLDER) "
20
16
21
- win64 : GOARCH=amd64
22
- win64 : binary
23
- @echo " [*] Done compiling for Windows x64, binary is located at: $( BIN_FOLDER) "
17
+ win64 :
18
+ @echo " [*] Compiling for Windows x64"
19
+ @GOOS=windows GOARCH=amd64 go build -o $(BIN_FOLDER ) /win/$(BINARY_NAME ) _win64.exe $(SRC_FOLDER ) /main.go
20
+ @echo " [*] Done compiling for Windows x64, binary is located in: $( BIN_FOLDER) "
24
21
25
- win32 : GOARCH=386
26
- win32 : binary
27
- @echo " [*] Done compiling for Windows x86, binary is located at: $( BIN_FOLDER) "
22
+ win32 :
23
+ @echo " [*] Compiling for Windows x86"
24
+ @GOOS=windows GOARCH=386 go build -o $(BIN_FOLDER ) /win/$(BINARY_NAME ) _win32.exe $(SRC_FOLDER ) /main.go
25
+ @echo " [*] Done compiling for Windows x86, binary is located in: $( BIN_FOLDER) "
28
26
29
- x64 : GOARCH=amd64
30
- x64 : binary
31
- @echo " [*] Done compiling for Linux x64, binary is located at: $( BIN_FOLDER) "
27
+ x64 :
28
+ @echo " [*] Compiling for Linux x64 "
29
+ @GOOS=linux GOARCH=amd64 go build -o $(BIN_FOLDER ) /nix/ $( BINARY_NAME ) _x64 $( SRC_FOLDER ) /main.go
32
30
33
- x86 : GOARCH=386
34
- x86 : binary
35
- @echo " [*] Done compiling for Linux x86, binary is located at: $( BIN_FOLDER) "
31
+ x86 :
32
+ @echo " [*] Compiling for Linux x86 "
33
+ @GOOS=linux GOARCH=386 go build -o $(BIN_FOLDER ) /nix/ $( BINARY_NAME ) _x86 $( SRC_FOLDER ) /main.go
36
34
37
- binary :
38
- @echo " [*] Compiling for $( GOOS) $( GOARCH) "
39
- @mkdir -p $(BIN_FOLDER )
40
- @$(GO_BUILD_CMD ) $(BIN_FOLDER ) /$(BINARY_NAME ) _$(GOOS ) _$(GOARCH ) $(SRC_FOLDER ) /main.go
41
35
42
36
clean :
43
37
@echo " [*] Cleaning up"
44
- @rm -rf $(BIN_FOLDER )
38
+ @rm -rf $(BIN_FOLDER ) / *
45
39
@echo " [*] Done cleaning up"
0 commit comments