2021-03-13 07:50:05 +01:00
|
|
|
PACKAGES=$(subst /,-,$(shell find * -maxdepth 1 -mindepth 1 -type d))
|
2021-03-05 10:16:17 +01:00
|
|
|
BUILD_PLATFORM=$(or ${PLATFORM},baremetal-$(shell grep -oP "^ID=\K.+" /etc/os-release))
|
2021-02-27 06:28:08 +01:00
|
|
|
|
2021-03-05 10:16:17 +01:00
|
|
|
help:
|
|
|
|
@echo "You probably don't want to build all package"
|
|
|
|
@echo "If you do run $`make build-all$`"
|
|
|
|
@echo
|
|
|
|
@echo "Run $`make [language]-[version].pkg.tar.gz$` to build a specific language"
|
2021-02-27 06:28:08 +01:00
|
|
|
|
2021-03-05 10:16:17 +01:00
|
|
|
build build-all: $(addsuffix .pkg.tar.gz, ${PACKAGES})
|
2021-02-28 06:20:41 +01:00
|
|
|
|
|
|
|
|
2021-03-13 07:50:05 +01:00
|
|
|
define PKG_RULE
|
2021-03-15 10:55:42 +01:00
|
|
|
$(1).pkg.tar.gz: $(subst -,/,$(1)) $(subst -,/,$(1))/pkg-info.json
|
2021-03-13 07:50:05 +01:00
|
|
|
cd $$< && chmod +x ./build.sh && ./build.sh
|
|
|
|
rm -f $$@
|
2021-03-15 10:55:42 +01:00
|
|
|
|
|
|
|
tar czf $$@ -C $$< .
|
2021-03-13 07:50:05 +01:00
|
|
|
endef
|
2021-02-27 06:28:08 +01:00
|
|
|
|
2021-03-13 07:50:05 +01:00
|
|
|
$(foreach pkg,$(PACKAGES),$(eval $(call PKG_RULE,$(pkg))))
|
2021-02-28 06:20:41 +01:00
|
|
|
|
2021-03-13 07:50:05 +01:00
|
|
|
%/pkg-info.json: %/metadata.json
|
|
|
|
jq '.build_platform="${BUILD_PLATFORM}"' $< > $@
|
2021-02-28 06:20:41 +01:00
|
|
|
|