flush
[m6w6/btr] / lib / btr / build / pecl.mk
index 0eaa17b6ff80f69f95ecf5c1a52d3740bfee31d0..c27b23a2c18e477f6d9f5d93a2953e632f4768eb 100644 (file)
@@ -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