core/build.sh in perfmonger-0.7.1 vs core/build.sh in perfmonger-0.8.0

- old
+ new

@@ -29,20 +29,56 @@ else # cross build TARGET=("linux 386" "linux amd64" "darwin amd64") fi -set -xe +set -e +GO_FILES=$(ls subsystem/*.go) + +cat <<EOF > Makefile +# DO NOT EDIT MANUALLY +# generated by build.sh + +GOSRC := $(echo ${GO_FILES}) + +.PHONY: all build clean + +all: build + +EOF + +TARGETS=() + for idx in $(seq 0 $((${#TARGET[@]}-1))); do set -- ${TARGET[$idx]} export GOOS=$1 export GOARCH=$2 - go build -o ../lib/exec/perfmonger-recorder_${GOOS}_${GOARCH} \ - perfmonger-recorder.go - go build -o ../lib/exec/perfmonger-player_${GOOS}_${GOARCH} \ - perfmonger-player.go - go build -o ../lib/exec/perfmonger-summarizer_${GOOS}_${GOARCH} \ - perfmonger-summarizer.go + for subcmd in recorder player summarizer; do + TARGETS+=(../lib/exec/perfmonger-${subcmd}_${GOOS}_${GOARCH}) + + cat <<EOF >> Makefile + +../lib/exec/perfmonger-${subcmd}_${GOOS}_${GOARCH}: perfmonger-${subcmd}.go \$(GOSRC) + go build -o \$@ perfmonger-$subcmd.go + +EOF + done + + # go build -o ../lib/exec/perfmonger-recorder_${GOOS}_${GOARCH} \ + # perfmonger-recorder.go & + # go build -o ../lib/exec/perfmonger-player_${GOOS}_${GOARCH} \ + # perfmonger-player.go & + # go build -o ../lib/exec/perfmonger-summarizer_${GOOS}_${GOARCH} \ + # perfmonger-summarizer.go & + done +cat <<EOF >> Makefile + +build: ${TARGETS[*]} + +clean: + rm -f ${TARGETS[*]} + +EOF