-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (39 loc) · 1.1 KB
/
Makefile
File metadata and controls
49 lines (39 loc) · 1.1 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
.PHONY: all clean build build-arm64
all: build
build: handler.zip handler-arm64.zip
clean:
-rm -f handler.zip handler-arm64.zip bootstrap bootstrap-arm64
export CGO_ENABLED := 0
export GOOS := linux
ifdef BUILDKITE_BUILD_NUMBER
LD_FLAGS := -s -w -X version.Build=$(BUILDKITE_BUILD_NUMBER)
BUILDVCS_FLAG := false
USER := 0:0
else
LD_FLAGS := -s -w
BUILDVCS_FLAG := true
USER := "$(shell id -u):$(shell id -g)"
endif
build-arm64: handler-arm64.zip
# handler.zip is x86_64 (default/existing architecture)
handler.zip: bootstrap
zip -9 -v -j $@ "$<"
handler-arm64.zip: bootstrap-arm64
@rm -f bootstrap
@cp bootstrap-arm64 bootstrap
@zip -9 -v -j $@ bootstrap
@rm -f bootstrap
bootstrap: lambda/main.go
GOARCH=amd64 mise exec -- go build \
-ldflags="$(LD_FLAGS)" \
-buildvcs="$(BUILDVCS_FLAG)" \
-tags lambda.norpc \
-o bootstrap \
./lambda
bootstrap-arm64: lambda/main.go
GOARCH=arm64 mise exec -- go build \
-ldflags="$(LD_FLAGS)" \
-buildvcs="$(BUILDVCS_FLAG)" \
-tags lambda.norpc \
-o bootstrap-arm64 \
./lambda