-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
67 lines (49 loc) · 2.05 KB
/
Makefile
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
BUILD_FOLDER = $(shell pwd)/build
ASSETS_FOLDER = $(shell pwd)/assets
FLAGS_LINUX = GOOS=linux GOARCH=amd64
FLAGS_DARWIN = GOOS=darwin
FLAGS_WINDOWS = GOOS=windows GOARCH=amd64 CC=i686-w64-mingw32-gcc CGO_ENABLED=1
WINPMEM_URL = https://github.com/Velocidex/WinPmem/releases/download/v4.0.rc1/winpmem_mini_x86.exe
LOCAL_WINPMEM_FILE = "winpmem.exe"
LOCAL_OSXPMEM_FILE = "osxpmem.zip"
lint:
@echo "[lint] Running linter on codebase"
@golint ./...
clean:
rm -f ./modules/windows/bindata.go
rm -f rsrc.syso
rm -rf $(ASSETS_FOLDER)
rm -rf $(BUILD_FOLDER)
mkdirs:
@echo "[mkdirs] Creating build folders..."
@mkdir -p $(BUILD_FOLDER)
@mkdir -p $(ASSETS_FOLDER)
deps:
@echo "[deps] Installing dependencies..."
go mod download
go get -u github.com/akavel/rsrc/...
go get -u github.com/go-bindata/go-bindata/v3/...
go mod tidy
@echo "[deps] Dependencies installed."
windows: deps mkdirs
@find $(ASSETS_FOLDER) -type f ! -name $(LOCAL_WINPMEM_FILE) -exec rm -f {} \;
@if [ ! -f $(ASSETS_FOLDER)/$(LOCAL_WINPMEM_FILE) ]; then \
echo "[builder] Downloading WinPmem"; \
wget $(WINPMEM_URL) -O $(ASSETS_FOLDER)/$(LOCAL_WINPMEM_FILE); \
fi
@echo "[builder] Preparing assets"
@go-bindata -pkg windows -o ./modules/windows/bindata.go -prefix $(ASSETS_FOLDER) $(ASSETS_FOLDER)/
@rsrc -manifest pcqf.manifest -o rsrc.syso
@echo "[builder] Building Windows executable"
@$(FLAGS_WINDOWS) go build --ldflags '-s -w -extldflags "-static"' -o $(BUILD_FOLDER)/pcqf_windows_amd64.exe ./cmd/
@echo "[builder] Done!"
darwin: deps mkdirs
@echo "[builder] Building Darwin amd64 executable"
@$(FLAGS_DARWIN) GOARCH=amd64 go build --ldflags '-s -w' -o $(BUILD_FOLDER)/pcqf_darwin_amd64 ./cmd/
@echo "[builder] Building Darwin arm64 executable"
@$(FLAGS_DARWIN) GOARCH=arm64 go build --ldflags '-s -w' -o $(BUILD_FOLDER)/pcqf_darwin_arm64 ./cmd/
@echo "[builder] Done!"
linux: deps mkdirs
@echo "[builder] Building Linux executable"
@$(FLAGS_LINUX) go build --ldflags '-s -w' -o $(BUILD_FOLDER)/pcqf_linux_amd64 ./cmd/
@echo "[builder] Done!"