summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2012-08-07 23:04:43 +0200
committerThomas Schwinge <thomas@codesourcery.com>2012-08-07 23:04:43 +0200
commit640cfa0a4af3dc399bff496fd94081a99dbbcdd2 (patch)
tree5462314cd475ea706cf7140c5804683f82665b48 /tests
parentaf7d78e726cb0d3248c461cfee27fe15121dacd1 (diff)
tests/Makefile: Support INSTALL_ROOT environment variable.
* tests/Makefile [ifdef INSTALL_ROOT] (INSTALL_ROOT_CPPFLAGS) (INSTALL_ROOT_LDFLAGS): New variables. (%.o: %.c, %: %.o): New rules. (%-static: %.o): Update rule. * tests/README: Update.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile13
-rw-r--r--tests/README6
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 5ebc01d..7177ad1 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,3 +1,8 @@
+ifdef INSTALL_ROOT
+INSTALL_ROOT_CPPFLAGS = -isystem $(INSTALL_ROOT)/include
+INSTALL_ROOT_LDFLAGS = -L$(INSTALL_ROOT)/lib -Wl,-rpath,$(INSTALL_ROOT)/lib
+endif
+
CFLAGS=-Wall -g
LDLIBS = -lpthread
@@ -10,8 +15,14 @@ CHECK_OBJS := $(addsuffix .o,$(basename $(notdir $(CHECK_SRC))))
CHECK_PROGS := $(basename $(notdir $(CHECK_SRC))) \
$(addsuffix -static, $(basename $(CHECK_SRC)))
+%.o: %.c
+ $(CC) $(INSTALL_ROOT_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $< -c -o $@
+
+%: %.o
+ $(CC) $(INSTALL_ROOT_LDFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
+
%-static: %.o
- $(CC) -static $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
+ $(CC) -static $(INSTALL_ROOT_LDFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
check: $(CHECK_OBJS) $(CHECK_PROGS)
for i in $(CHECK_PROGS); do \
diff --git a/tests/README b/tests/README
new file mode 100644
index 0000000..230f1b2
--- /dev/null
+++ b/tests/README
@@ -0,0 +1,6 @@
+Testing of installed package:
+
+ $ [libpthread]/configure --prefix=[install_root]
+ $ make
+ $ make install
+ $ make -C [libpthread]/tests/ INSTALL_ROOT=[install_root] clean check