piston/packages/Makefile

30 lines
857 B
Makefile
Raw Normal View History

2021-03-05 10:16:17 +01:00
PACKAGES=$(shell find * -maxdepth 0 -type d)
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})
clean clean-all: $(addprefix clean-, ${PACKAGES})
2021-03-05 10:16:17 +01:00
clean-%: %/
rm -rf $</build $</output
2021-02-27 06:28:08 +01:00
2021-03-05 10:16:17 +01:00
%.pkg.tar.gz: %/output %/run %/environment %/pkg-info.json
rm -f $@
tar czf $@ -C $* $(patsubst $*/%,%,output run environment pkg-info.json $(shell find $*/compile)) --transform='s|output|$*|;s|environment|$*/environment|'
2021-03-05 10:16:17 +01:00
%/pkg-info.json: %/metadata.json
jq '.build_platform="${BUILD_PLATFORM}"' $< > $@
2021-03-05 10:16:17 +01:00
%/output: %/ %/build.sh
cd $< && chmod +x ./build.sh && ./build.sh
2021-02-27 06:28:08 +01:00
2021-02-27 06:28:08 +01:00