33 lines
1.0 KiB
Makefile
33 lines
1.0 KiB
Makefile
LANG_NAME=$(or ${NAME},none)
|
|
LANG_VERSION=$(or ${VERSION},0.0.0)
|
|
LANG_AUTHOR=$(or ${AUTHOR},HexF <thomas@hexf.me>)
|
|
LANG_DEPS=$(or ${DEPS})
|
|
LANG_COMPILED=$(or ${COMPILED}, false)
|
|
|
|
LANG_PKG_TARGETS=pkg-info.json ${LANG_NAME}-${LANG_VERSION}/ ${LANG_NAME}-${LANG_VERSION}/environment run
|
|
|
|
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)
|
|
tar czvf $@ $?
|
|
|
|
%.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
|
|
$(foreach dep, ${LANG_DEPS}, echo '.dependencies.$(word 1,$(subst =, ,${dep}))="$(word 2,$(subst =, ,${dep}))"' >> pkg-info.jq)
|
|
|
|
%.asc: %
|
|
gpg --detach-sig --armor --output $@ $<
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf $(filter-out Makefile, $(wildcard *))
|
|
|
|
.PHONY: sign
|
|
sign: ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz.asc |