-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (53 loc) · 2.26 KB
/
Makefile
File metadata and controls
69 lines (53 loc) · 2.26 KB
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
67
68
69
CURRENT_PATH := $(shell pwd)
PARENT_PATH := $(shell dirname $(CURRENT_PATH))
DOWNLOAD_FOLDER := $(CURRENT_PATH)/downloads
UNPACK_FOLDER := $(CURRENT_PATH)/unpacked
BIN_FOLDER := $(CURRENT_PATH)/unpacked/go/bin
BUILD_FOLDER := $(CURRENT_PATH)/build
GO := $(BIN_FOLDER)/go
ASSET ?= go1.26.linux-amd64.tar.gz
SOURCES := $(shell find $(PARENT_PATH) -path $(dirname $(pwd))/windows -prune -o -name "*.go" -print) \
$(PARENT_PATH)/go.mod \
$(PARENT_PATH)/go.sum
SYNC_BIN := split_sync_windows.exe
PROXY_BIN := split_proxy_windows.exe
.PHONY: clean setup_ms_go
default: help
## remove all downloaded/unpacked/generated files
clean:
rm -Rf downloads unpacked build
## download and setup a ms-patched version of go which is fips-compliant for windows
setup_ms_go: $(UNPACK_FOLDER)/go
## build fips-compliant split-proxy && split-sync
binaries: $(BUILD_FOLDER)/$(SYNC_BIN) $(BUILD_FOLDER)/$(PROXY_BIN)
# --------
$(DOWNLOAD_FOLDER)/$(ASSET):
mkdir -p $(DOWNLOAD_FOLDER)
wget https://aka.ms/golang/release/latest/$(ASSET) --directory-prefix $(DOWNLOAD_FOLDER)
# wget https://aka.ms/golang/release/latest/$(ASSET).sha256 --directory-prefix $(DOWNLOAD_FOLDER)
# TODO(mredolatti): validate sha256
$(UNPACK_FOLDER)/go: $(DOWNLOAD_FOLDER)/$(ASSET)
mkdir -p $(UNPACK_FOLDER)
tar xvzf $(DOWNLOAD_FOLDER)/$(ASSET) --directory $(UNPACK_FOLDER)
$(BUILD_FOLDER)/$(PROXY_BIN): $(GO) $(SOURCES)
mkdir -p $(BUILD_FOLDER)
GOOS=windows GOEXPERIMENT=cngcrypto $(GO) build -tags=enforce_fips -o $@ $(PARENT_PATH)/cmd/proxy/main.go
$(BUILD_FOLDER)/$(SYNC_BIN): $(GO) $(SOURCES)
mkdir -p $(BUILD_FOLDER)
GOOS=windows GOEXPERIMENT=cngcrypto $(GO) build -tags=enforce_fips -o $@ $(PARENT_PATH)/cmd/synchronizer/main.go
# Help target borrowed from: https://docs.cloudposse.com/reference/best-practices/make-best-practices/
## This help screen
help:
@printf "Available targets:\n\n"
@awk '/^[a-zA-Z\-\_0-9%:\\]+/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = $$1; \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
gsub("\\\\", "", helpCommand); \
gsub(":+$$", "", helpCommand); \
printf " \x1b[32;01m%-35s\x1b[0m %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST) | sort -u
@printf "\n"