2021-02-19 04:09:56 +01:00
|
|
|
LANG_NAME=$(or ${NAME},none)
|
|
|
|
LANG_VERSION=$(or ${VERSION},0.0.0)
|
|
|
|
LANG_AUTHOR=$(or ${AUTHOR},HexF <thomas@hexf.me>)
|
|
|
|
LANG_DEPS=$(or ${DEPS})
|
2021-02-19 05:32:35 +01:00
|
|
|
LANG_COMPILED=$(or ${COMPILED}, false)
|
2021-02-19 04:09:56 +01:00
|
|
|
|
2021-02-19 05:32:35 +01:00
|
|
|
LANG_PKG_TARGETS=pkg-info.json ${LANG_NAME}-${LANG_VERSION}/ ${LANG_NAME}-${LANG_VERSION}/environment run
|
2021-02-19 04:09:56 +01:00
|
|
|
|
2021-02-19 09:05:37 +01:00
|
|
|
BUILD_PLATFORM=$(or ${PLATFORM}, baremetal-$(shell grep -oP "^ID=\K\w+" /etc/os-release ))
|
|
|
|
|
2021-02-19 05:32:35 +01:00
|
|
|
ifeq (${LANG_COMPILED}, true)
|
|
|
|
${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: $(LANG_PKG_TARGETS) compile
|
|
|
|
endif
|
|
|
|
${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: $(LANG_PKG_TARGETS)
|
2021-02-19 06:53:26 +01:00
|
|
|
tar czf $@ $?
|
2021-02-19 04:09:56 +01:00
|
|
|
|
|
|
|
%.json: %.jq
|
|
|
|
jq '$(shell tr '\n' '|' < $<).' <<< "{}" > $@
|
|
|
|
|
|
|
|
pkg-info.jq:
|
|
|
|
echo '.language="${LANG_NAME}"' > pkg-info.jq
|
|
|
|
echo '.version="${LANG_VERSION}"' >> pkg-info.jq
|
|
|
|
echo '.author="${LANG_AUTHOR}"' >> pkg-info.jq
|
|
|
|
echo '.dependencies={}' >> pkg-info.jq
|
2021-02-19 09:28:59 +01:00
|
|
|
echo '.build_platform="${BUILD_PLATFORM}"' >> pkg-info.jq
|
2021-02-19 04:09:56 +01:00
|
|
|
$(foreach dep, ${LANG_DEPS}, echo '.dependencies.$(word 1,$(subst =, ,${dep}))="$(word 2,$(subst =, ,${dep}))"' >> pkg-info.jq)
|
|
|
|
|
2021-02-19 06:06:07 +01:00
|
|
|
%.asc: %
|
2021-02-20 23:39:03 +01:00
|
|
|
gpg --detach-sig --armor --batch --output $@ $<
|
2021-02-19 06:06:07 +01:00
|
|
|
|
2021-02-19 06:53:26 +01:00
|
|
|
%/: %.tgz
|
|
|
|
tar xzf $<
|
|
|
|
|
2021-02-20 15:29:47 +01:00
|
|
|
%/: %.tar.gz
|
|
|
|
tar xzf $<
|
|
|
|
|
2021-02-19 04:48:46 +01:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf $(filter-out Makefile, $(wildcard *))
|
2021-02-19 06:53:26 +01:00
|
|
|
|
|
|
|
,PHONY: cleanup
|
|
|
|
cleanup:
|
|
|
|
rm -rf $(filter-out ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz.asc, $(filter-out ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz, $(filter-out Makefile, $(wildcard *))))
|
2021-02-19 06:06:07 +01:00
|
|
|
|
|
|
|
.PHONY: sign
|
|
|
|
sign: ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz.asc
|