Makefile: support absolute paths in BUILDDIR

This commit is contained in:
Simon Kelley
2012-02-28 15:20:25 +00:00
parent 0d5d35d052
commit fdacfb0119
3 changed files with 50 additions and 41 deletions

View File

@@ -45,18 +45,25 @@ version 2.60
round-robin to multiple servers, in the same way as round-robin to multiple servers, in the same way as
--dhcp-boot. A good suggestion from Cristiano Cumer. --dhcp-boot. A good suggestion from Cristiano Cumer.
Support BUILDDIR variable in the Makefile. Allows Support BUILDDIR variable in the Makefile. Allows builds
builds from multiple architectures in the same tree with eg for multiple archs from the same source tree with eg.
make BUILDDIR=linux make BUILDDIR=linux (relative to dnsmasq tree)
make BUILDDIR=/tmp/openbsd (absolute path)
If BUILDDIR is not set, compilation happens in the src If BUILDDIR is not set, compilation happens in the src
directory, as before. Suggestion from Mark Mitchell. directory, as before. Suggestion from Mark Mitchell.
First cut at supporting DHCPv6. Support is pretty much Support DHCPv6. Support is there for the sort of things
there for the sort of things the existing v4 server does, the existing v4 server does, including tags, options,
including tags, options, static addresses and relay static addresses and relay support. Missing is prefix
support. Missing is prefix delegation. This is lightly delegation, which is probably not required in the dnsmasq
tested alpha code, it is NOT YET PRODUCTION READY. Test niche, and an easy way to accept prefix delegations from
reports would be greatly valued. an upstream DHCPv6 server, which is. Future plans include
support for DHCPv6 router option and MAC address option
(to make selecting clients by MAC address work like IPv4).
These will be added as the standards mature.
This code has been tested, but this is the first release,
so don't bet the farm on it just yet. Many thanks to all
testers who have got it this far.
Support IPv6 router advertisements. This is a Support IPv6 router advertisements. This is a
simple-minded implementation, aimed at providing the simple-minded implementation, aimed at providing the

View File

@@ -34,16 +34,21 @@ SRC = src
PO = po PO = po
MAN = man MAN = man
DBUS_CFLAGS=`echo $(COPTS) | ../bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1` # pmake way to learn path of Makefile
DBUS_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1` TOP != echo `pwd`/
IDN_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags libidn` # GNU make way to learn path of Makefile
IDN_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn` TOP ?= $(shell pwd)
CT_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --cflags libnetfilter_conntrack`
CT_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --libs libnetfilter_conntrack` DBUS_CFLAGS=`echo $(COPTS) | $(TOP)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1`
LUA_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua5.1` DBUS_LIBS= `echo $(COPTS) | $(TOP)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1`
LUA_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.1` IDN_CFLAGS= `echo $(COPTS) | $(TOP)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags libidn`
IDN_LIBS= `echo $(COPTS) | $(TOP)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn`
CT_CFLAGS= `echo $(COPTS) | $(TOP)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --cflags libnetfilter_conntrack`
CT_LIBS= `echo $(COPTS) | $(TOP)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --libs libnetfilter_conntrack`
LUA_CFLAGS= `echo $(COPTS) | $(TOP)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua5.1`
LUA_LIBS= `echo $(COPTS) | $(TOP)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.1`
SUNOS_LIBS= `if uname | grep SunOS 2>&1 >/dev/null; then echo -lsocket -lnsl -lposix4; fi` SUNOS_LIBS= `if uname | grep SunOS 2>&1 >/dev/null; then echo -lsocket -lnsl -lposix4; fi`
VERSION= -DVERSION='\"`../bld/get-version`\"' VERSION= -DVERSION='\"`$(TOP)/bld/get-version $(TOP)`\"'
OBJS = cache.o rfc1035.o util.o option.o forward.o network.o \ OBJS = cache.o rfc1035.o util.o option.o forward.o network.o \
dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o \ dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o \
@@ -53,12 +58,12 @@ OBJS = cache.o rfc1035.o util.o option.o forward.o network.o \
HDRS = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \ HDRS = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
dns-protocol.h radv-protocol.h dns-protocol.h radv-protocol.h
all : $(BUILDDIR) all : $(BUILDDIR)
@cd $(BUILDDIR) && $(MAKE) \ @cd $(BUILDDIR) && $(MAKE) \
TOP="$(TOP)" \
BUILD_CFLAGS="$(VERSION) $(DBUS_CFLAGS) $(IDN_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS)" \ BUILD_CFLAGS="$(VERSION) $(DBUS_CFLAGS) $(IDN_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS)" \
BUILD_LIBS="$(DBUS_LIBS) $(IDN_LIBS) $(CT_LIBS) $(LUA_LIBS) $(SUNOS_LIBS)" \ BUILD_LIBS="$(DBUS_LIBS) $(IDN_LIBS) $(CT_LIBS) $(LUA_LIBS) $(SUNOS_LIBS)" \
-f ../Makefile dnsmasq -f $(TOP)/Makefile dnsmasq
clean : clean :
rm -f *~ $(BUILDDIR)/*.mo contrib/*/*~ */*~ $(BUILDDIR)/*.pot rm -f *~ $(BUILDDIR)/*.mo contrib/*/*~ */*~ $(BUILDDIR)/*.pot
@@ -73,33 +78,33 @@ install-common :
all-i18n : $(BUILDDIR) all-i18n : $(BUILDDIR)
@cd $(BUILDDIR) && $(MAKE) \ @cd $(BUILDDIR) && $(MAKE) \
TOP="$(TOP)" \
I18N=-DLOCALEDIR=\'\"$(LOCALEDIR)\"\' \ I18N=-DLOCALEDIR=\'\"$(LOCALEDIR)\"\' \
BUILD_CFLAGS="$(VERSION) $(DBUS_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS) `$(PKG_CONFIG) --cflags libidn`" \ BUILD_CFLAGS="$(VERSION) $(DBUS_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS) `$(PKG_CONFIG) --cflags libidn`" \
BUILD_LIBS="$(DBUS_LIBS) $(CT_LIBS) $(LUA_LIBS) $(SUNOS_LIBS) `$(PKG_CONFIG) --libs libidn`" \ BUILD_LIBS="$(DBUS_LIBS) $(CT_LIBS) $(LUA_LIBS) $(SUNOS_LIBS) `$(PKG_CONFIG) --libs libidn`" \
-f ../Makefile dnsmasq -f $(TOP)/Makefile dnsmasq
@cd $(PO); for f in *.po; do \ for f in `cd $(PO); echo *.po`; do \
cd ../$(BUILDDIR) && $(MAKE) \ cd $(TOP) && cd $(BUILDDIR) && $(MAKE) TOP="$(TOP)" -f $(TOP)/Makefile $${f%.po}.mo; \
-f ../Makefile $${f%.po}.mo; \
done done
install-i18n : all-i18n install-common install-i18n : all-i18n install-common
cd $(BUILDDIR); ../bld/install-mo $(DESTDIR)$(LOCALEDIR) $(INSTALL) cd $(BUILDDIR); $(TOP)/bld/install-mo $(DESTDIR)$(LOCALEDIR) $(INSTALL)
cd $(MAN); ../bld/install-man $(DESTDIR)$(MANDIR) $(INSTALL) cd $(MAN); ../bld/install-man $(DESTDIR)$(MANDIR) $(INSTALL)
merge : $(BUILDDIR) merge :
@cd $(BUILDDIR) && $(MAKE) -f ../Makefile dnsmasq.pot @cd $(BUILDDIR) && $(MAKE) -f $(TOP)/Makefile dnsmasq.pot
@cd $(PO); for f in *.po; do \ for f in `cd $(PO); echo *.po`; do \
echo -n msgmerge $$f && $(MSGMERGE) --no-wrap -U $$f ../$(BUILDDIR)/dnsmasq.pot; \ echo -n msgmerge $(PO)/$$f && $(MSGMERGE) --no-wrap -U $(PO)/$$f $(BUILDDIR)/dnsmasq.pot; \
done done
$(BUILDDIR): $(BUILDDIR):
mkdir $(BUILDDIR) mkdir -p $(BUILDDIR)
# rules below are targets in recusive makes with cwd=$(SRC) # rules below are targets in recusive makes with cwd=$(SRC)
$(OBJS:.o=.c) $(HDRS): $(OBJS:.o=.c) $(HDRS):
ln -s ../$(SRC)/$@ . ln -s $(TOP)/$(SRC)/$@ .
.c.o: .c.o:
$(CC) $(CFLAGS) $(COPTS) $(I18N) $(BUILD_CFLAGS) $(RPM_OPT_FLAGS) -c $< $(CC) $(CFLAGS) $(COPTS) $(I18N) $(BUILD_CFLAGS) $(RPM_OPT_FLAGS) -c $<
@@ -110,8 +115,8 @@ dnsmasq : $(HDRS) $(OBJS)
dnsmasq.pot : $(OBJS:.o=.c) $(HDRS) dnsmasq.pot : $(OBJS:.o=.c) $(HDRS)
$(XGETTEXT) -d dnsmasq --foreign-user --omit-header --keyword=_ -o $@ -i $(OBJS:.o=.c) $(XGETTEXT) -d dnsmasq --foreign-user --omit-header --keyword=_ -o $@ -i $(OBJS:.o=.c)
%.mo : ../po/%.po dnsmasq.pot %.mo : $(TOP)/po/%.po dnsmasq.pot
$(MSGMERGE) -o - ../po/$*.po dnsmasq.pot | $(MSGFMT) -o $*.mo - $(MSGMERGE) -o - $(TOP)/po/$*.po dnsmasq.pot | $(MSGFMT) -o $*.mo -
.PHONY : all clean install install-common all-i18n install-i18n merge .PHONY : all clean install install-common all-i18n install-i18n merge

View File

@@ -9,21 +9,18 @@
# If we can find one which matches $v[0-9].* then we assume it's # If we can find one which matches $v[0-9].* then we assume it's
# a version-number tag, else we just use the whole string. # a version-number tag, else we just use the whole string.
# we're called with pwd == TLD if which git >/dev/null 2>&1 && [ -d $1/.git ]; then
cd .. cd $1; git describe
elif grep '\$Format:%d\$' $1/VERSION >/dev/null 2>&1; then
if which git >/dev/null 2>&1 && [ -d .git ]; then
git describe
elif grep '\$Format:%d\$' VERSION >/dev/null 2>&1; then
# unsubstituted VERSION, but no git available. # unsubstituted VERSION, but no git available.
echo UNKNOWN echo UNKNOWN
else else
vers=`cat VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep $v[0-9]` vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep $v[0-9]`
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "${vers}" | head -n 1 | tail -c +2 echo "${vers}" | head -n 1 | tail -c +2
else else
cat VERSION cat $1/VERSION
fi fi
fi fi