Commit 61f83b56 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner

Fix separate build directory

Make the build & tests work when we are in a separate build directory
mode. Build the „check“ testing framework in separate directory by
default, so we can explain what to ignore to .gitignore (so it doesn't
say there are untracked files in the submodule).
parent 7a1b21a4
......@@ -10,4 +10,6 @@
/src/opkg-trans/opkg-trans
# Stuff dump core all over the place.
core
# Test stuff
tests/check-compiled
tests/arguments
......@@ -2,12 +2,13 @@
.PHONY: check-compile check-clean test valgrind check
check-compile:
cd $(S)/tests/check && cmake .
+make -C $(S)/tests/check
mkdir -p $(O)/tests/check-compiled
cd $(O)/tests/check-compiled && cmake $(abspath $(S))/tests/check
+make -C $(O)/tests/check-compiled
clean: check-clean
check-clean:
+make -C $(S)/tests/check clean
rm -rf $(O)/tests/check-compiled
C_TESTS := arguments
......@@ -16,20 +17,21 @@ BINARIES += $(patsubst %,tests/%,$(TESTS))
define DO_C_TEST
BINARIES_NOTARGET += tests/$(1)
$(1)_MODULES += $(1)
$$(patsubst %,$(O)/.objs/tests/%.o,$$($(1)_MODULES)): check-compile
$(1)_SYSTEM_LIBS += check m rt
$(1)_LOCAL_LIBS += updater
$(S)/bin/$(1): EXTRA_LIBDIRS := $(S)/tests/check/src/
$(S)/bin/$(1): EXTRA_INCLUDES := $(S)/tests/check/src/ $(S)/tests/check/
$(S)/bin/$(1): check-compile
$(O)/bin/$(1): EXTRA_LIBDIRS := $(O)/tests/check-compiled/src/
$(O)/bin/$(1): EXTRA_INCLUDES := $(O)/tests/check-compiled/src $(S)/tests/check/src/ $(S)/tests/check-compiled/
$(O)/bin/$(1): check-compile
test: test-$(1)
valgrind: valgrind-$(1)
.PHONY: test-$(1) valgrind-$(1)
test-$(1): $(S)/bin/$(1)
$(S)/bin/$(1)
test-$(1): $(O)/bin/$(1)
$(O)/bin/$(1)
valgrind-$(1): $(S)/bin/$(1)
valgrind $(S)/bin/$(1)
valgrind-$(1): $(O)/bin/$(1)
valgrind $(O)/bin/$(1)
endef
$(eval $(foreach TEST,$(C_TESTS),$(call DO_C_TEST,$(TEST))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment