Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 1 | #!/usr/bin/make -f |
| 2 | # debian/rules file - for dnsmasq. |
| 3 | # Copyright 2001-2011 by Simon Kelley |
| 4 | # Based on the sample in the debian hello package which carries the following: |
| 5 | # Copyright 1994,1995 by Ian Jackson. |
| 6 | # I hereby give you perpetual unlimited permission to copy, |
| 7 | # modify and relicense this file, provided that you do not remove |
| 8 | # my name from the file itself. (I assert my moral right of |
| 9 | # paternity under the Copyright, Designs and Patents Act 1988.) |
| 10 | # This file may have to be extensively modified |
| 11 | |
| 12 | package=dnsmasq-base |
| 13 | |
Simon Kelley | 97c83bb | 2012-05-28 18:21:59 +0100 | [diff] [blame] | 14 | CFLAGS = $(shell export DEB_BUILD_OPTIONS=$(DEB_BUILD_OPTIONS); dpkg-buildflags --get CFLAGS) |
| 15 | CFLAGS += $(shell dpkg-buildflags --get CPPFLAGS) |
| 16 | CFLAGS += -Wall -W |
| 17 | |
| 18 | LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 19 | |
| 20 | COPTS = |
Simon Kelley | 97c83bb | 2012-05-28 18:21:59 +0100 | [diff] [blame] | 21 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 22 | TARGET = install-i18n |
| 23 | |
| 24 | DEB_BUILD_ARCH_OS := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) |
| 25 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 26 | ifeq (,$(filter nodbus,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 27 | COPTS += -DHAVE_DBUS |
| 28 | endif |
| 29 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 30 | ifeq (,$(filter noconntrack,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 31 | ifeq ($(DEB_BUILD_ARCH_OS),linux) |
| 32 | COPTS += -DHAVE_CONNTRACK |
| 33 | endif |
| 34 | endif |
| 35 | |
Simon Kelley | 3ddad24 | 2013-03-21 17:56:06 +0000 | [diff] [blame] | 36 | ifneq (,$(filter noipset,$(DEB_BUILD_OPTIONS))) |
| 37 | COPTS += -DNO_IPSET |
Simon Kelley | 3b323bd | 2013-02-22 21:55:29 +0000 | [diff] [blame] | 38 | endif |
| 39 | |
Simon Kelley | 96c3879 | 2012-02-16 20:07:17 +0000 | [diff] [blame] | 40 | ifneq (,$(filter nodhcp6,$(DEB_BUILD_OPTIONS))) |
| 41 | COPTS += -DNO_DHCP6 |
Simon Kelley | 127ea40 | 2012-02-11 22:14:52 +0000 | [diff] [blame] | 42 | endif |
| 43 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 44 | ifneq (,$(filter noipv6,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 45 | COPTS += -DNO_IPV6 |
| 46 | endif |
| 47 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 48 | ifneq (,$(filter notftp,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 49 | COPTS += -DNO_TFTP |
| 50 | endif |
| 51 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 52 | ifneq (,$(filter nodhcp,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 53 | COPTS += -DNO_DHCP |
| 54 | endif |
| 55 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 56 | ifneq (,$(filter noscript,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 57 | COPTS += -DNO_SCRIPT |
| 58 | endif |
| 59 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 60 | ifneq (,$(filter nortc,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 61 | COPTS += -DHAVE_BROKEN_RTC |
| 62 | endif |
| 63 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 64 | ifneq (,$(filter noi18n,$(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 65 | TARGET = install |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 66 | ifeq (,$(filter noidn, $(DEB_BUILD_OPTIONS))) |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 67 | COPTS += -DHAVE_IDN |
| 68 | endif |
| 69 | endif |
| 70 | |
Simon Kelley | 6277978 | 2012-02-10 21:19:25 +0000 | [diff] [blame] | 71 | ifneq (,$(filter uselua,$(DEB_BUILD_OPTIONS))) |
| 72 | COPTS += -DHAVE_LUASCRIPT |
| 73 | endif |
| 74 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 75 | clean: |
| 76 | $(checkdir) |
| 77 | rm -rf debian/daemon debian/base debian/utils debian/*~ debian/files debian/substvars debian/utils-substvars |
| 78 | make clean |
| 79 | make -C contrib/wrt clean |
| 80 | |
| 81 | binary-indep: checkroot |
| 82 | $(checkdir) |
| 83 | rm -rf debian/daemon |
| 84 | install -m 755 \ |
| 85 | -d debian/daemon/DEBIAN \ |
| 86 | -d debian/daemon/usr/share/doc \ |
| 87 | -d debian/daemon/etc/init.d \ |
| 88 | -d debian/daemon/etc/dnsmasq.d \ |
| 89 | -d debian/daemon/etc/resolvconf/update.d \ |
| 90 | -d debian/daemon/usr/lib/resolvconf/dpkg-event.d \ |
| 91 | -d debian/daemon/etc/default \ |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 92 | -d debian/daemon/lib/systemd/system \ |
| 93 | -d debian/daemon/etc/insserv.conf.d |
| 94 | install -m 644 debian/conffiles debian/daemon/DEBIAN |
| 95 | install -m 755 debian/postinst debian/postrm debian/prerm debian/daemon/DEBIAN |
| 96 | install -m 755 debian/init debian/daemon/etc/init.d/dnsmasq |
| 97 | install -m 755 debian/resolvconf debian/daemon/etc/resolvconf/update.d/dnsmasq |
| 98 | install -m 755 debian/resolvconf-package debian/daemon/usr/lib/resolvconf/dpkg-event.d/dnsmasq |
| 99 | install -m 644 debian/default debian/daemon/etc/default/dnsmasq |
| 100 | install -m 644 dnsmasq.conf.example debian/daemon/etc/dnsmasq.conf |
| 101 | install -m 644 debian/readme.dnsmasq.d debian/daemon/etc/dnsmasq.d/README |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 102 | install -m 644 debian/systemd.service debian/daemon/lib/systemd/system/dnsmasq.service |
| 103 | install -m 644 debian/insserv debian/daemon/etc/insserv.conf.d/dnsmasq |
| 104 | ln -s $(package) debian/daemon/usr/share/doc/dnsmasq |
| 105 | cd debian/daemon && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums |
| 106 | dpkg-gencontrol -pdnsmasq -Pdebian/daemon |
| 107 | chown -R root.root debian/daemon |
| 108 | chmod -R g-ws debian/daemon |
| 109 | dpkg --build debian/daemon .. |
| 110 | |
| 111 | binary-arch: checkroot |
| 112 | $(checkdir) |
| 113 | rm -rf debian/base |
| 114 | install -m 755 \ |
| 115 | -d debian/base/DEBIAN \ |
Simon Kelley | 4ba9b38 | 2012-07-29 17:07:48 +0100 | [diff] [blame] | 116 | -d debian/base/etc/dbus-1/system.d \ |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 117 | -d debian/base/usr/share/doc/$(package) \ |
| 118 | -d debian/base/usr/share/doc/$(package)/examples \ |
| 119 | -d debian/base/var/run \ |
| 120 | -d debian/base/var/lib/misc |
Simon Kelley | 43c271b | 2012-06-07 10:02:53 +0100 | [diff] [blame] | 121 | make $(TARGET) PREFIX=/usr DESTDIR=`pwd`/debian/base CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(COPTS)" CC=gcc |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 122 | ifeq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS))) |
| 123 | install -m 644 doc.html debian/base/usr/share/doc/$(package)/. |
| 124 | install -m 644 setup.html debian/base/usr/share/doc/$(package)/. |
| 125 | install -m 644 dnsmasq.conf.example debian/base/usr/share/doc/$(package)/examples/. |
| 126 | install -m 644 FAQ debian/base/usr/share/doc/$(package)/. |
| 127 | gzip -9 debian/base/usr/share/doc/$(package)/FAQ |
| 128 | install -m 644 CHANGELOG debian/base/usr/share/doc/$(package)/changelog |
| 129 | gzip -9 debian/base/usr/share/doc/$(package)/changelog |
| 130 | install -m 644 CHANGELOG.archive debian/base/usr/share/doc/$(package)/changelog.archive |
| 131 | gzip -9 debian/base/usr/share/doc/$(package)/changelog.archive |
| 132 | install -m 644 dbus/DBus-interface debian/base/usr/share/doc/$(package)/. |
| 133 | gzip -9 debian/base/usr/share/doc/$(package)/DBus-interface |
| 134 | endif |
Simon Kelley | 4ba9b38 | 2012-07-29 17:07:48 +0100 | [diff] [blame] | 135 | install -m 644 debian/dnsmasq-base.conffiles debian/base/DEBIAN/conffiles |
Simon Kelley | bc54ae3 | 2012-08-28 21:26:56 +0100 | [diff] [blame] | 136 | install -m 755 debian/dnsmasq-base.postinst debian/base/DEBIAN/postinst |
| 137 | install -m 755 debian/dnsmasq-base.postrm debian/base/DEBIAN/postrm |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 138 | install -m 644 debian/changelog debian/base/usr/share/doc/$(package)/changelog.Debian |
| 139 | gzip -9 debian/base/usr/share/doc/$(package)/changelog.Debian |
| 140 | install -m 644 debian/readme debian/base/usr/share/doc/$(package)/README.Debian |
| 141 | install -m 644 debian/copyright debian/base/usr/share/doc/$(package)/copyright |
Simon Kelley | 4ba9b38 | 2012-07-29 17:07:48 +0100 | [diff] [blame] | 142 | install -m 644 debian/dbus.conf debian/base/etc/dbus-1/system.d/dnsmasq.conf |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 143 | gzip -9 debian/base/usr/share/man/man8/dnsmasq.8 |
| 144 | for f in debian/base/usr/share/man/*; do \ |
| 145 | if [ -f $$f/man8/dnsmasq.8 ]; then \ |
| 146 | gzip -9 $$f/man8/dnsmasq.8 ; \ |
| 147 | fi \ |
| 148 | done |
| 149 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
| 150 | strip -R .note -R .comment debian/base/usr/sbin/dnsmasq |
| 151 | endif |
| 152 | cd debian/base && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums |
| 153 | dpkg-shlibdeps debian/base/usr/sbin/dnsmasq |
| 154 | dpkg-gencontrol -pdnsmasq-base -Pdebian/base |
| 155 | chown -R root.root debian/base |
| 156 | chmod -R g-ws debian/base |
| 157 | dpkg --build debian/base .. |
| 158 | |
| 159 | ifeq ($(DEB_BUILD_ARCH_OS),linux) |
| 160 | rm -rf debian/utils |
| 161 | install -m 755 -d debian/utils/DEBIAN \ |
| 162 | -d debian/utils/usr/share/man/man1 \ |
| 163 | -d debian/utils/usr/bin \ |
| 164 | -d debian/utils/usr/share/doc/dnsmasq-utils |
Simon Kelley | 43c271b | 2012-06-07 10:02:53 +0100 | [diff] [blame] | 165 | make -C contrib/wrt PREFIX=/usr DESTDIR=`pwd`/debian/utils CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" COPTS="$(COPTS)" CC=gcc |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 166 | install -m 755 contrib/wrt/dhcp_release debian/utils/usr/bin/dhcp_release |
| 167 | install -m 644 contrib/wrt/dhcp_release.1 debian/utils/usr/share/man/man1/dhcp_release.1 |
| 168 | gzip -9 debian/utils/usr/share/man/man1/dhcp_release.1 |
| 169 | install -m 755 contrib/wrt/dhcp_lease_time debian/utils/usr/bin/dhcp_lease_time |
| 170 | install -m 644 contrib/wrt/dhcp_lease_time.1 debian/utils/usr/share/man/man1/dhcp_lease_time.1 |
| 171 | install -m 644 debian/copyright debian/utils/usr/share/doc/dnsmasq-utils/copyright |
| 172 | install -m 644 debian/changelog debian/utils/usr/share/doc/dnsmasq-utils/changelog.Debian |
| 173 | gzip -9 debian/utils/usr/share/doc/dnsmasq-utils/changelog.Debian |
| 174 | gzip -9 debian/utils/usr/share/man/man1/dhcp_lease_time.1 |
| 175 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
| 176 | strip -R .note -R .comment debian/utils/usr/bin/dhcp_release |
| 177 | strip -R .note -R .comment debian/utils/usr/bin/dhcp_lease_time |
| 178 | endif |
| 179 | cd debian/utils && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums |
| 180 | dpkg-shlibdeps -Tdebian/utils-substvars debian/utils/usr/bin/dhcp_release debian/utils/usr/bin/dhcp_lease_time |
| 181 | dpkg-gencontrol -Tdebian/utils-substvars -pdnsmasq-utils -Pdebian/utils |
| 182 | chown -R root.root debian/utils |
| 183 | chmod -R g-ws debian/utils |
| 184 | dpkg --build debian/utils .. |
| 185 | endif |
| 186 | |
| 187 | define checkdir |
| 188 | test -f Makefile -a -f debian/rules |
| 189 | endef |
| 190 | |
| 191 | # Below here is fairly generic really |
| 192 | |
| 193 | binary: binary-arch binary-indep |
Simon Kelley | 760169f | 2012-03-09 14:27:49 +0000 | [diff] [blame] | 194 | |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 195 | build: |
Simon Kelley | 760169f | 2012-03-09 14:27:49 +0000 | [diff] [blame] | 196 | build-arch: |
| 197 | build-indep: |
Simon Kelley | c72daea | 2012-01-05 21:33:27 +0000 | [diff] [blame] | 198 | |
| 199 | checkroot: |
| 200 | test root = "`whoami`" |
| 201 | |
| 202 | .PHONY: binary binary-arch binary-indep clean checkroot |
| 203 | |
| 204 | |