forked from aws-samples/serverless-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
29 lines (24 loc) · 805 Bytes
/
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
FUNCTIONS := handler
ARCH := aarch64-unknown-linux-gnu
ARCH_SPLIT = $(subst -, ,$(ARCH))
build:
ifeq ("$(shell zig targets | jq -r .native.cpu.arch)-$(shell zig targets | jq -r .native.os)-$(shell zig targets | jq -r .native.abi)", "$(word 1,$(ARCH_SPLIT))-$(word 3,$(ARCH_SPLIT))-$(word 4,$(ARCH_SPLIT))")
@echo "Same host and target. Using native build"
cargo build --release --target $(ARCH)
else
@echo "Different host and target. Using zigbuild"
cargo zigbuild --release --target $(ARCH)
endif
rm -rf ./build
mkdir -p ./build
${MAKE} ${MAKEOPTS} $(foreach function,${FUNCTIONS}, build-${function})
build-%:
mkdir -p ./build/$*
cp -v ./target/$(ARCH)/release/$* ./build/$*/bootstrap
deploy:
if [ -f samconfig.toml ]; \
then sam deploy; \
else sam deploy -g; \
fi
delete:
sam delete