diff --git a/packages/CONTRIBUTING.MD b/packages/CONTRIBUTING.MD index 0c5381a..499cff8 100644 --- a/packages/CONTRIBUTING.MD +++ b/packages/CONTRIBUTING.MD @@ -8,11 +8,11 @@ In the example of NodeJS, we would call this `node`, after the main binary. ## Creating new languages -See [deno-1.7.5/](deno-1.7.5/) or any other directory for examples. +See [deno/1.7.5/](deno/1.7.5/) or any other directory for examples. 1. Create a new branch on your fork of engineer-man/piston -2. Create a directory named `[language]-[version]`. See Naming Languages for how to determine the name for your language +2. Create directories named `[language]/[version]`. See Naming Languages for how to determine the name for your language 3. Create a file named `build.sh`, adding a shebang for bash `#!/bin/bash` on the first line. In this file put any steps to compile the specified langauge. diff --git a/packages/Makefile b/packages/Makefile index 80360f5..c0cf6fe 100644 --- a/packages/Makefile +++ b/packages/Makefile @@ -1,4 +1,4 @@ -PACKAGES=$(shell find * -maxdepth 0 -type d) +PACKAGES=$(subst /,-,$(shell find * -maxdepth 1 -mindepth 1 -type d)) BUILD_PLATFORM=$(or ${PLATFORM},baremetal-$(shell grep -oP "^ID=\K.+" /etc/os-release)) help: @@ -9,14 +9,16 @@ help: build build-all: $(addsuffix .pkg.tar.gz, ${PACKAGES}) -%.pkg.tar.gz: %/ %/pkg-info.json - cd $< && chmod +x ./build.sh && ./build.sh - rm -f $@ - tar czf $@ $* --transform='s|$*||' + +define PKG_RULE +$(1).pkg.tar.gz: $(subst -,/,$(1))/ $(subst -,/,$(1))/pkg-info.json + cd $$< && chmod +x ./build.sh && ./build.sh + rm -f $$@ + tar czf $$@ $$< --transform='s|$$<||' +endef + +$(foreach pkg,$(PACKAGES),$(eval $(call PKG_RULE,$(pkg)))) %/pkg-info.json: %/metadata.json jq '.build_platform="${BUILD_PLATFORM}"' $< > $@ - - -