X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fbtr;a=blobdiff_plain;f=lib%2Fbtr%2Fbuild%2Fpecl.mk;fp=lib%2Fbtr%2Fbuild%2Fpecl.mk;h=c27b23a2c18e477f6d9f5d93a2953e632f4768eb;hp=0eaa17b6ff80f69f95ecf5c1a52d3740bfee31d0;hb=f5fd15396636986e7447993a66b8a4084a93dabb;hpb=5735fce9818606a36ff3ebbbf902030bcd46c506 diff --git a/lib/btr/build/pecl.mk b/lib/btr/build/pecl.mk index 0eaa17b..c27b23a 100644 --- a/lib/btr/build/pecl.mk +++ b/lib/btr/build/pecl.mk @@ -1,38 +1,58 @@ -.PHONY: all +BUILD_CLEAN=false +BUILD_ARGS= +TEST_ARGS= -q + +.PHONY: all clean .SUFFIXES: CONFIGS=$(wildcard $(BRANCH_DIR)/config*.m4 $(BRANCH_DIR)/*/config*.m4) -all: $(TEST_REPORT) - TESTS_PASSED=$$(awk '/^Tests passed/{print $$4}' < $(TEST_REPORT)); \ - TESTS_FAILED=$$(awk '/^Tests failed/{print $$4}' < $(TEST_REPORT)); \ - if test -z "$(LAST_REPORT)"; then \ - printf "%d/%d\n" $$TESTS_PASSED $$TESTS_FAILED; \ - else \ - LAST_PASSED=$$(awk '/^Tests passed/{print $$4}' < $(LAST_REPORT)); \ - LAST_FAILED=$$(awk '/^Tests failed/{print $$4}' < $(LAST_REPORT)); \ - DIFF_PASSED=$$(bc <<<"$$TESTS_PASSED - $$LAST_PASSED"); \ - DIFF_FAILED=$$(bc <<<"$$TESTS_FAILED - $$LAST_FAILED"); \ - printf "+%d/+%d\n" $$DIFF_PASSED $$DIFF_FAILED; \ +all: clean $(REPORT) + $(SAY) "Result: $$(cat $(REPORT))" + +clean: $(CONFIG_REPORT) + if $(BUILD_CLEAN); \ + then \ + cd $(BUILD_DIR) && \ + make $(SILENT_FLAG) clean; \ fi; +$(REPORT): $(TEST_REPORT) + @(\ + TESTS_PASSED=$$(awk '/^Tests passed/{print $$4}' < $(TEST_REPORT)); \ + TESTS_FAILED=$$(awk '/^Tests failed/{print $$4}' < $(TEST_REPORT)); \ + printf "%d/%d" $$TESTS_PASSED $$TESTS_FAILED >$@; \ + if test -s "$(LAST_REPORT)"; then \ + LAST_PASSED=$$(awk '/^Tests passed/{print $$4}' < $(LAST_REPORT)); \ + LAST_FAILED=$$(awk '/^Tests failed/{print $$4}' < $(LAST_REPORT)); \ + DIFF_PASSED=$$(bc <<<"$$TESTS_PASSED - $$LAST_PASSED"); \ + DIFF_FAILED=$$(bc <<<"$$TESTS_FAILED - $$LAST_FAILED"); \ + printf " %+d/%+d" $$DIFF_PASSED $$DIFF_FAILED >>$@; \ + fi; \ + printf "\n" >>$@; \ + ) + $(TEST_REPORT): $(BUILD_REPORT) + $(SAY) "Running tests... " cd $(BUILD_DIR) && \ - make test TESTS=../$(BRANCH_DIR)/$(TESTS) > ../$@ + make test TESTS="$(TEST_ARGS) -s ../$@" >/dev/null $(BUILD_REPORT): $(CONFIG_REPORT) + $(SAY) "Making build..." cd $(BUILD_DIR) && \ - make -j $(CPUS) > ../$@ + make -j $(CPUS) >../$@ 2>&1 $(CONFIG_REPORT): $(BRANCH_DIR)/configure $(BUILD_DIR) + $(SAY) "Running 'configure'..." cd $(BUILD_DIR) && \ - ../$(BRANCH_DIR)/configure -C $(CONFIGURE) > ../$@ + ../$(BRANCH_DIR)/configure -C $(BUILD_ARGS) >../$@ 2>&1 $(BUILD_DIR): mkdir -p $@ $(BRANCH_DIR)/configure: $(CONFIGS) + $(SAY) "Running phpize..." cd $(BRANCH_DIR) && \ - phpize > /dev/null + phpize >/dev/null # vim: noet