* [committed] Add configure
@ 2019-01-01 0:00 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-01-01 0:00 UTC (permalink / raw)
To: dwz, jakub, Mark Wielaard
Hi,
This allows dwz to be build and tested in a build directory rather than the
source directory, like this:
...
$ mkdir build
$ cd build
$ ../src/configure
$ make
$ make check
...
Committed to trunk.
[ This leaves us with two ways to build. I suppose it would be nice if the
buildbots whould use the 'preferred' build method, but I'm not sure which one
that is. ]
Thanks,
- Tom
Add configure
2019-04-12 Tom de Vries <tdevries@suse.de>
* configure: New file.
* Makefile: Handle srcdir.
* testsuite/dwz.tests/dwz-tests.exp: Use srcdir. Handle absolute
srcdir.
---
Makefile | 13 +++++++++----
configure | 11 +++++++++++
testsuite/dwz.tests/dwz-tests.exp | 4 ++--
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 69058a9..a9eae7d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,10 @@
+ifneq ($(srcdir),)
+VPATH = $(srcdir)
+else
+srcdir=$(shell pwd)
+endif
CFLAGS = -O2 -g
-DWZ_VERSION := $(shell cat VERSION)
+DWZ_VERSION := $(shell cat $(srcdir)/VERSION)
override CFLAGS += -Wall -W -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"$(DWZ_VERSION)"'
prefix = /usr
exec_prefix = $(prefix)
@@ -17,7 +22,7 @@ clean:
PWD:=$(shell pwd -P)
-TEST_SRC = $(PWD)/testsuite/dwz.tests
+TEST_SRC = $(srcdir)/testsuite/dwz.tests
TEST_EXECS = hello dw2-restrict py-section-script dwz-for-test min two-typedef
hello:
@@ -36,7 +41,7 @@ DWZ_TEST_SOURCES := $(patsubst %.o,%-for-test.c,$(OBJECTS))
dwz-for-test: $(DWZ_TEST_SOURCES)
$(CC) $(DWZ_TEST_SOURCES) -O2 -g -lelf -o $@ -Wall -W -DDEVEL \
- -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"for-test"'
+ -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"for-test"' -I$(srcdir)
min:
$(CC) $(TEST_SRC)/min.c $(TEST_SRC)/min-2.c -o $@ -g
@@ -54,5 +59,5 @@ check: dwz $(TEST_EXECS)
cd testsuite-bin; ln -sf $(PWD)/dwz .
export DEJAGNU=$(DEJAGNU); \
export PATH=$(PWD)/testsuite-bin:$$PATH; export LC_ALL=C; \
- runtest --tool=dwz -srcdir testsuite $(RUNTESTFLAGS)
+ runtest --tool=dwz -srcdir $(srcdir)/testsuite $(RUNTESTFLAGS)
rm -Rf testsuite-bin $(TEST_EXECS) $(DWZ_TEST_SOURCES)
diff --git a/configure b/configure
new file mode 100755
index 0000000..92a02e7
--- /dev/null
+++ b/configure
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+cat > Makefile <<EOF
+srcdir:=\$(shell pwd -P)/../src
+
+default:
+ \$(MAKE) -f \$(srcdir)/Makefile srcdir=\$(srcdir)
+
+%:
+ \$(MAKE) -f \$(srcdir)/Makefile srcdir=\$(srcdir) \$*
+EOF
diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp
index 3ef8690..a20002f 100644
--- a/testsuite/dwz.tests/dwz-tests.exp
+++ b/testsuite/dwz.tests/dwz-tests.exp
@@ -2,7 +2,7 @@ set tests [find $srcdir/$subdir *.sh]
set pwd [pwd]
-set env(PATH) $pwd/$srcdir/scripts:$::env(PATH)
+set env(PATH) $srcdir/scripts:$::env(PATH)
set env(execs) $pwd
foreach test $tests {
@@ -49,7 +49,7 @@ foreach test $tests {
exec mkdir $dir
cd $dir
- if { [catch { exec sh -e ../$test } msg] } {
+ if { [catch { exec sh -e $test } msg] } {
puts "$msg"
fail "$test"
} else {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-12 8:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01 0:00 [committed] Add configure Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).