]> git.ipfire.org Git - people/ms/dnsmasq.git/commitdiff
Makefile: support absolute paths in BUILDDIR
authorSimon Kelley <simon@thekelleys.org.uk>
Tue, 28 Feb 2012 15:20:25 +0000 (15:20 +0000)
committerSimon Kelley <simon@thekelleys.org.uk>
Tue, 28 Feb 2012 15:20:25 +0000 (15:20 +0000)
CHANGELOG
Makefile
bld/get-version

index 614eae559f5d079e8f2c3fb90bc74c704ca85593..326940689cf5516d170c58b07ef90c7538fcee78 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -45,18 +45,25 @@ version 2.60
            round-robin to multiple servers, in the same way as
            --dhcp-boot. A good suggestion from Cristiano Cumer.
 
-           Support BUILDDIR variable in the Makefile. Allows 
-           builds from multiple architectures in the same tree with eg
-           make BUILDDIR=linux
+           Support BUILDDIR variable in the Makefile. Allows builds 
+           for multiple archs from the same source tree with eg.
+           make BUILDDIR=linux             (relative to dnsmasq tree)
+           make BUILDDIR=/tmp/openbsd      (absolute path)
            If BUILDDIR is not set, compilation happens in the src
            directory, as before. Suggestion from Mark Mitchell.
 
-           First cut at supporting DHCPv6. Support is pretty much
-           there for the sort of things the existing v4 server does,
-           including tags, options, static addresses and relay
-           support. Missing is prefix delegation. This is lightly
-           tested alpha code, it is NOT YET PRODUCTION READY. Test
-           reports would be greatly valued.
+           Support DHCPv6. Support is there for the sort of things
+           the existing v4 server does, including tags, options, 
+           static addresses and relay support. Missing is prefix 
+           delegation, which is probably not required in the dnsmasq
+           niche, and an easy way to accept prefix delegations from
+           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
            simple-minded implementation, aimed at providing the
index 5fde74ddcb8b815fa70512020fd44add874d3fcd..8264794b2153b56d1d07770b230ec477dc7b16b8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -34,16 +34,21 @@ SRC = src
 PO = po
 MAN = man
 
-DBUS_CFLAGS=`echo $(COPTS) | ../bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1` 
-DBUS_LIBS=  `echo $(COPTS) | ../bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1` 
-IDN_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags libidn` 
-IDN_LIBS=   `echo $(COPTS) | ../bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn` 
-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`
-LUA_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua5.1` 
-LUA_LIBS=   `echo $(COPTS) | ../bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.1` 
+# pmake way to learn path of Makefile
+TOP != echo `pwd`/
+# GNU make way to learn path of Makefile
+TOP ?= $(shell pwd)
+
+DBUS_CFLAGS=`echo $(COPTS) | $(TOP)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1` 
+DBUS_LIBS=  `echo $(COPTS) | $(TOP)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-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`
-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 \
        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 \
        dns-protocol.h radv-protocol.h
 
-
 all : $(BUILDDIR)
        @cd $(BUILDDIR) && $(MAKE) \
+ TOP="$(TOP)" \
  BUILD_CFLAGS="$(VERSION) $(DBUS_CFLAGS) $(IDN_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS)" \
  BUILD_LIBS="$(DBUS_LIBS) $(IDN_LIBS) $(CT_LIBS) $(LUA_LIBS) $(SUNOS_LIBS)" \
- -f ../Makefile dnsmasq 
+ -f $(TOP)/Makefile dnsmasq 
 
 clean :
        rm -f *~ $(BUILDDIR)/*.mo contrib/*/*~ */*~ $(BUILDDIR)/*.pot 
@@ -73,33 +78,33 @@ install-common :
 
 all-i18n : $(BUILDDIR)
        @cd $(BUILDDIR) && $(MAKE) \
+ TOP="$(TOP)" \
  I18N=-DLOCALEDIR=\'\"$(LOCALEDIR)\"\' \
  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`"  \
- -f ../Makefile dnsmasq
-       @cd $(PO); for f in *.po; do \
-               cd ../$(BUILDDIR) && $(MAKE) \
- -f ../Makefile $${f%.po}.mo; \
+ -f $(TOP)/Makefile dnsmasq
+       for f in `cd $(PO); echo *.po`; do \
+               cd $(TOP) && cd $(BUILDDIR) && $(MAKE) TOP="$(TOP)" -f $(TOP)/Makefile $${f%.po}.mo; \
        done
 
 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)
 
-merge : $(BUILDDIR)
-       @cd $(BUILDDIR) && $(MAKE) -f ../Makefile dnsmasq.pot
-       @cd $(PO); for f in *.po; do \
-               echo -n msgmerge $$f && $(MSGMERGE) --no-wrap -U $$f ../$(BUILDDIR)/dnsmasq.pot; \
+merge : 
+       @cd $(BUILDDIR) && $(MAKE) -f $(TOP)/Makefile dnsmasq.pot
+       for f in `cd $(PO); echo *.po`; do \
+               echo -n msgmerge $(PO)/$$f && $(MSGMERGE) --no-wrap -U $(PO)/$$f $(BUILDDIR)/dnsmasq.pot; \
        done
 
 $(BUILDDIR):
-       mkdir $(BUILDDIR)
+       mkdir -p $(BUILDDIR)
 
 
 # rules below are targets in recusive makes with cwd=$(SRC)
 
 $(OBJS:.o=.c) $(HDRS):
-       ln -s ../$(SRC)/$@ .
+       ln -s $(TOP)/$(SRC)/$@ .
 
 .c.o:
        $(CC) $(CFLAGS) $(COPTS) $(I18N) $(BUILD_CFLAGS) $(RPM_OPT_FLAGS) -c $< 
@@ -110,8 +115,8 @@ dnsmasq : $(HDRS) $(OBJS)
 dnsmasq.pot : $(OBJS:.o=.c) $(HDRS)
        $(XGETTEXT) -d dnsmasq --foreign-user --omit-header --keyword=_ -o $@ -i $(OBJS:.o=.c)
 
-%.mo : ../po/%.po dnsmasq.pot
-       $(MSGMERGE) -o - ../po/$*.po dnsmasq.pot | $(MSGFMT) -o $*.mo -
+%.mo : $(TOP)/po/%.po dnsmasq.pot
+       $(MSGMERGE) -o - $(TOP)/po/$*.po dnsmasq.pot | $(MSGFMT) -o $*.mo -
 
 
 .PHONY : all clean install install-common all-i18n install-i18n merge 
index a68b96ba5b37a09b40f48f78b0945db682fda74f..3b082dc54174742c44af3449fffbe53d0245224c 100755 (executable)
@@ -9,21 +9,18 @@
 # 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.
 
-# we're called with pwd == TLD
-cd ..
-
-if which git >/dev/null 2>&1 && [ -d .git ]; then
-     git describe
-elif grep '\$Format:%d\$' VERSION >/dev/null 2>&1; then
+if which git >/dev/null 2>&1 && [ -d $1/.git ]; then
+     cd $1; git describe
+elif grep '\$Format:%d\$' $1/VERSION >/dev/null 2>&1; then
 # unsubstituted VERSION, but no git available.
     echo UNKNOWN
 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
          echo "${vers}" | head -n 1 | tail -c +2
      else
-         cat VERSION
+         cat $1/VERSION
      fi
 fi