-BUILD_CLEAN=false
-BUILD_ARGS= --enable-debug
-TEST_ARGS= -q
+BTR_BUILD_CLEAN=false
+BTR_BUILD_ARGS= --enable-debug
+BTR_TEST_ARGS= -q
.PHONY: all clean
.SUFFIXES:
-CONFIGS=$(wildcard $(BRANCH_DIR)/ext/*/config*.m4)
+CONFIGS=$(wildcard $(BTR_BRANCH_DIR)/ext/*/config*.m4)
-all: clean $(REPORT)
- $(SAY) "Result: $$(cat $(REPORT))"
+all: clean $(BTR_REPORT)
+ $(SAY) "Result: $$(cat $(BTR_REPORT))"
-clean: $(CONFIG_REPORT)
- if $(BUILD_CLEAN); \
+clean: $(BTR_CONFIG_REPORT)
+ if $(BTR_BUILD_CLEAN); \
then \
- cd $(BUILD_DIR) && \
- make $(SILENT_FLAG) clean; \
+ cd $(BTR_BUILD_DIR) && \
+ make $(BTR_SILENT_FLAG) clean; \
fi;
-$(REPORT): $(TEST_REPORT)
+$(BTR_REPORT): $(BTR_TEST_REPORT)
@(\
- TESTS_PASSED=$$(awk '/^Tests passed/{print $$4}' < $(TEST_REPORT)); \
- TESTS_FAILED=$$(awk '/^Tests failed/{print $$4}' < $(TEST_REPORT)); \
+ TESTS_PASSED=$$(awk '/^Tests passed/{print $$4}' < $(BTR_TEST_REPORT)); \
+ TESTS_FAILED=$$(awk '/^Tests failed/{print $$4}' < $(BTR_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)); \
+ if test -s "$(BTR_LAST_REPORT)"; then \
+ LAST_PASSED=$$(awk '/^Tests passed/{print $$4}' < $(BTR_LAST_REPORT)); \
+ LAST_FAILED=$$(awk '/^Tests failed/{print $$4}' < $(BTR_LAST_REPORT)); \
DIFF_PASSED=$$(bc <<<"$$TESTS_PASSED - $$LAST_PASSED"); \
DIFF_FAILED=$$(bc <<<"$$TESTS_FAILED - $$LAST_FAILED"); \
printf " %+d/%+d" $$DIFF_PASSED $$DIFF_FAILED >>$@; \
printf "\n" >>$@; \
)
-$(TEST_REPORT): $(BUILD_REPORT)
+$(BTR_TEST_REPORT): $(BTR_BUILD_REPORT)
$(SAY) "Running tests... "
- cd $(BUILD_DIR) && \
- make test TESTS="$(TEST_ARGS) -s ../$@"
+ cd $(BTR_BUILD_DIR) && \
+ make test TESTS="$(BTR_TEST_ARGS) -s ../../$@"
-$(BUILD_REPORT): $(CONFIG_REPORT)
+$(BTR_BUILD_REPORT): $(BTR_CONFIG_REPORT)
$(SAY) "Making build..."
- cd $(BUILD_DIR) && \
- make -j $(CPUS) >../$@ 2>&1
+ (cd $(BTR_BUILD_DIR) && \
+ make -j $(BTR_CPUS) \
+ ) >$@ 2>&1
-$(CONFIG_REPORT): $(BRANCH_DIR)/configure $(BUILD_DIR)
+$(BTR_CONFIG_REPORT): $(BTR_BRANCH_DIR)/configure | $(BTR_BUILD_DIR) $(BTR_LOG_DIR)
$(SAY) "Running 'configure'..."
- cd $(BUILD_DIR) && \
- ../$(BRANCH_DIR)/configure -C $(BUILD_ARGS) >../$@ 2>&1
+ (cd $(BTR_BUILD_DIR) && \
+ ../../$(BTR_BRANCH_DIR)/configure -C $(BTR_BUILD_ARGS) \
+ ) >$@ 2>&1
-$(BUILD_DIR):
+$(BTR_BUILD_DIR):
+ mkdir -p $@
+
+$(BTR_LOG_DIR):
mkdir -p $@
-$(BRANCH_DIR)/configure: $(BRANCH_DIR)/buildconf $(CONFIGS)
+$(BTR_BRANCH_DIR)/configure: $(BTR_BRANCH_DIR)/buildconf $(CONFIGS)
$(SAY) "Building configure..."
- cd $(BRANCH_DIR) && \
+ cd $(BTR_BRANCH_DIR) && \
./buildconf >/dev/null
# vim: noet