diff --git a/Makefile b/Makefile index 36e1eb363..9c008a1d8 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build realize dep spec protobuf qa qa.test qa.vet +.PHONY: build realize dep spec protobuf qa qa.test qa.vet codegen PKG = "github.com/$(shell cat .project)" @@ -28,9 +28,8 @@ dep.update: dep: dep ensure -v -spec: $(SPEC) - cd sam/docs/src && $(SPEC) - cd sam/ && ./_gen.sh +codegen: $(SPEC) + ./codegen.sh protobuf: $(PROTOC) # @todo this needs work (it hangs and outputs nothing) diff --git a/codegen.sh b/codegen.sh index f39f8bf33..693f16d8c 100755 --- a/codegen.sh +++ b/codegen.sh @@ -1,14 +1,15 @@ #!/bin/bash set -e +set -x _PWD=$PWD SPECS=$(find $PWD -name 'spec.json' | xargs -n1 dirname) for SPEC in $SPECS; do echo "=== spec $SPEC ===" - cd $SPEC && rm -rf spec && spec && cd $_PWD + cd $SPEC && rm -rf spec && ${GOPATH}/bin/spec && cd $_PWD SRC=$(dirname $(dirname $SPEC)) echo "=== codegen $SRC ===" - GOPATHS=$(codegen/codegen.php $(basename $SRC) | tee -a /dev/stderr | xargs --no-run-if-empty -n1 dirname | sort | uniq) + GOPATHS=$(codegen/codegen.php $(basename $SRC) | tee -a /dev/stderr | xargs -n1 dirname | sort | uniq) for FOLDER in $GOPATHS; do if [[ $FOLDER != "." ]]; then echo "== go fmt $FOLDER =="