summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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