aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--bitlbee.h2
-rwxr-xr-xconfigure24
-rw-r--r--doc/Makefile3
-rw-r--r--doc/user-guide/Makefile4
-rw-r--r--lib/Makefile5
-rw-r--r--protocols/Makefile5
-rw-r--r--protocols/jabber/Makefile5
-rw-r--r--protocols/msn/Makefile5
-rw-r--r--protocols/oscar/Makefile6
-rw-r--r--protocols/purple/Makefile5
-rw-r--r--protocols/twitter/Makefile5
-rw-r--r--protocols/yahoo/Makefile5
-rw-r--r--tests/Makefile5
14 files changed, 69 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 916f551a..2bbafc57 100644
--- a/Makefile
+++ b/Makefile
@@ -109,7 +109,7 @@ tar:
$(subdirs):
@$(MAKE) -C $@ $(MAKECMDGOALS)
-$(objects): %.o: %.c
+$(objects): %.o: $(SRCDIR)%.c
@echo '*' Compiling $<
@$(CC) -c $(CFLAGS) $< -o $@
diff --git a/bitlbee.h b/bitlbee.h
index f4e03d76..1dc434ec 100644
--- a/bitlbee.h
+++ b/bitlbee.h
@@ -42,7 +42,7 @@
#define MAX_STRING 511
#if HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#include <fcntl.h>
diff --git a/configure b/configure
index e0cf6f18..54156a61 100755
--- a/configure
+++ b/configure
@@ -123,6 +123,28 @@ LFLAGS=
EFLAGS=
EOF
+srcdir="$(dirname $0)"
+if [ "$srcdir" != "." ]; then
+ echo
+ echo "configure script run from a different directory. Will create some symlinks..."
+ if [ ! -e Makefile -o -L Makefile ]; then
+ mkdir -p $(cd "$srcdir"; find . -type d)
+ find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null
+ dst="$PWD"
+ cd "$srcdir"
+ for i in $(find . -name Makefile); do
+ ln -s "$PWD${i#.}" "$dst/$i";
+ done
+ cd "$dst"
+ rm -rf .bzr
+ fi
+
+ echo "SRCDIR=$srcdir/" >> Makefile.settings
+ CFLAGS="$CFLAGS -I${dst}"
+else
+ srcdir=$PWD
+fi
+
cat<<EOF>config.h
/* BitlBee settings, generated by configure
@@ -160,7 +182,7 @@ else
fi
echo CFLAGS=$CFLAGS >> Makefile.settings
-echo CFLAGS+=-I`pwd` -I`pwd`/lib -I`pwd`/protocols -I. >> Makefile.settings
+echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings
echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
diff --git a/doc/Makefile b/doc/Makefile
index 9b473df3..aeebd901 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,4 +1,7 @@
-include ../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)doc/
+endif
all:
# Only build the docs if this is a bzr checkout
diff --git a/doc/user-guide/Makefile b/doc/user-guide/Makefile
index 9841de8d..eaf2a5ff 100644
--- a/doc/user-guide/Makefile
+++ b/doc/user-guide/Makefile
@@ -1,4 +1,8 @@
-include ../../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)doc/user-guide/
+endif
+
EXTRAPARANEWLINE = 1
# EXTRAPARANEWLINE = 0
diff --git a/lib/Makefile b/lib/Makefile
index b686f886..8fd9b19e 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -7,6 +7,9 @@
### DEFINITIONS
-include ../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)lib/
+endif
# [SH] Program variables
objects = arc.o base64.o $(EVENT_HANDLER) ftutil.o http_client.o ini.o md5.o misc.o oauth.o proxy.o sha1.o $(SSL_CLIENT) url.o xmltree.o
@@ -36,6 +39,6 @@ lib.o: $(objects) $(subdirs)
$(objects): ../Makefile.settings Makefile
-$(objects): %.o: %.c
+$(objects): %.o: $(SRCDIR)%.c
@echo '*' Compiling $<
@$(CC) -c $(CFLAGS) $< -o $@
diff --git a/protocols/Makefile b/protocols/Makefile
index 18d79e8d..57fcd7eb 100644
--- a/protocols/Makefile
+++ b/protocols/Makefile
@@ -7,6 +7,9 @@
### DEFINITIONS
-include ../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)protocols/
+endif
# [SH] Program variables
objects = nogaim.o
@@ -48,6 +51,6 @@ protocols.o: $(objects) $(subdirs)
$(objects): ../Makefile.settings Makefile
-$(objects): %.o: %.c
+$(objects): %.o: $(SRCDIR)%.c
@echo '*' Compiling $<
@$(CC) -c $(CFLAGS) $< -o $@
diff --git a/protocols/jabber/Makefile b/protocols/jabber/Makefile
index 78a02696..912ea702 100644
--- a/protocols/jabber/Makefile
+++ b/protocols/jabber/Makefile
@@ -7,6 +7,9 @@
### DEFINITIONS
-include ../../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)protocols/jabber/
+endif
# [SH] Program variables
objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o s5bytestream.o sasl.o si.o
@@ -32,7 +35,7 @@ distclean: clean
$(objects): ../../Makefile.settings Makefile
-$(objects): %.o: %.c
+$(objects): %.o: $(SRCDIR)%.c
@echo '*' Compiling $<
@$(CC) -c $(CFLAGS) $< -o $@
diff --git a/protocols/msn/Makefile b/protocols/msn/Makefile
index 5d199b9e..1de755a8 100644
--- a/protocols/msn/Makefile
+++ b/protocols/msn/Makefile
@@ -7,6 +7,9 @@
### DEFINITIONS
-include ../../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)protocols/msn/
+endif
# [SH] Program variables
objects = invitation.o msn.o msn_util.o ns.o passport.o sb.o tables.o
@@ -32,7 +35,7 @@ distclean: clean
$(objects): ../../Makefile.settings Makefile
-$(objects): %.o: %.c
+$(objects): %.o: $(SRCDIR)%.c
@echo '*' Compiling $<
@$(CC) -c $(CFLAGS) $< -o $@
diff --git a/protocols/oscar/Makefile b/protocols/oscar/Makefile
index 2792f22a..0ec7436b 100644
--- a/protocols/oscar/Makefile
+++ b/protocols/oscar/Makefile
@@ -7,6 +7,10 @@
### DEFINITIONS
-include ../../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)protocols/oscar/
+CFLAGS += -I$(SRCDIR)
+endif
# [SH] Program variables
objects = admin.o auth.o bos.o buddylist.o chat.o chatnav.o conn.o icq.o im.o info.o misc.o msgcookie.o rxhandlers.o rxqueue.o search.o service.o snac.o ssi.o stats.o tlv.o txqueue.o oscar_util.o oscar.o
@@ -32,7 +36,7 @@ distclean: clean
$(objects): ../../Makefile.settings Makefile
-$(objects): %.o: %.c
+$(objects): %.o: $(SRCDIR)%.c
@echo '*' Compiling $<
@$(CC) -c $(CFLAGS) $< -o $@
diff --git a/protocols/purple/Makefile b/protocols/purple/Makefile
index 403db799..97a5bb6a 100644
--- a/protocols/purple/Makefile
+++ b/protocols/purple/Makefile
@@ -7,6 +7,9 @@
### DEFINITIONS
-include ../../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)protocols/purple/
+endif
# [SH] Program variables
objects = ft.o purple.o
@@ -32,7 +35,7 @@ distclean: clean
$(objects): ../../Makefile.settings Makefile
-$(objects): %.o: %.c
+$(objects): %.o: $(SRCDIR)%.c
@echo '*' Compiling $<
@$(CC) -c $(CFLAGS) $< -o $@
diff --git a/protocols/twitter/Makefile b/protocols/twitter/Makefile
index ca1e4695..8a4b97f9 100644
--- a/protocols/twitter/Makefile
+++ b/protocols/twitter/Makefile
@@ -7,6 +7,9 @@
### DEFINITIONS
-include ../../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)protocols/twitter/
+endif
# [SH] Program variables
objects = twitter.o twitter_http.o twitter_lib.o
@@ -32,7 +35,7 @@ distclean: clean
$(objects): ../../Makefile.settings Makefile
-$(objects): %.o: %.c
+$(objects): %.o: $(SRCDIR)%.c
@echo '*' Compiling $<
@$(CC) -c $(CFLAGS) $< -o $@
diff --git a/protocols/yahoo/Makefile b/protocols/yahoo/Makefile
index b4fe56e2..20ecce71 100644
--- a/protocols/yahoo/Makefile
+++ b/protocols/yahoo/Makefile
@@ -7,6 +7,9 @@
### DEFINITIONS
-include ../../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)protocols/yahoo/
+endif
# [SH] Program variables
objects = yahoo.o crypt.o libyahoo2.o yahoo_fn.o yahoo_httplib.o yahoo_util.o
@@ -32,7 +35,7 @@ distclean: clean
$(objects): ../../Makefile.settings Makefile
-$(objects): %.o: %.c
+$(objects): %.o: $(SRCDIR)%.c
@echo '*' Compiling $<
@$(CC) -c $(CFLAGS) $< -o $@
diff --git a/tests/Makefile b/tests/Makefile
index 1bcf8f72..7c876cec 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,4 +1,7 @@
-include ../Makefile.settings
+ifdef SRCDIR
+SRCDIR := $(SRCDIR)tests/
+endif
LFLAGS +=-lcheck
@@ -18,6 +21,6 @@ check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o ../l
@echo '*' Linking $@
@$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) $(EFLAGS)
-%.o: %.c
+%.o: $(SRCDIR)%.c
@echo '*' Compiling $<
@$(CC) -c $(CFLAGS) $< -o $@