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 | |
| 14 | # policy manual, section 10.1 |
| 15 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
| 16 | CFLAGS = -g -O0 -Wall -W |
| 17 | else |
| 18 | CFLAGS = -g -O2 -Wall -W |
| 19 | endif |
| 20 | |
| 21 | COPTS = |
| 22 | TARGET = install-i18n |
| 23 | |
| 24 | DEB_BUILD_ARCH_OS := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) |
| 25 | |
| 26 | ifeq (,$(findstring nodbus,$(DEB_BUILD_OPTIONS))) |
| 27 | COPTS += -DHAVE_DBUS |
| 28 | endif |
| 29 | |
| 30 | ifeq (,$(findstring noconntrack,$(DEB_BUILD_OPTIONS))) |
| 31 | ifeq ($(DEB_BUILD_ARCH_OS),linux) |
| 32 | COPTS += -DHAVE_CONNTRACK |
| 33 | endif |
| 34 | endif |
| 35 | |
| 36 | ifneq (,$(findstring noipv6,$(DEB_BUILD_OPTIONS))) |
| 37 | COPTS += -DNO_IPV6 |
| 38 | endif |
| 39 | |
| 40 | ifneq (,$(findstring notftp,$(DEB_BUILD_OPTIONS))) |
| 41 | COPTS += -DNO_TFTP |
| 42 | endif |
| 43 | |
| 44 | ifneq (,$(findstring nodhcp,$(DEB_BUILD_OPTIONS))) |
| 45 | COPTS += -DNO_DHCP |
| 46 | endif |
| 47 | |
| 48 | ifneq (,$(findstring noscript,$(DEB_BUILD_OPTIONS))) |
| 49 | COPTS += -DNO_SCRIPT |
| 50 | endif |
| 51 | |
| 52 | ifneq (,$(findstring nortc,$(DEB_BUILD_OPTIONS))) |
| 53 | COPTS += -DHAVE_BROKEN_RTC |
| 54 | endif |
| 55 | |
| 56 | ifneq (,$(findstring noi18n,$(DEB_BUILD_OPTIONS))) |
| 57 | TARGET = install |
| 58 | ifeq (,$(findstring noidn, $(DEB_BUILD_OPTIONS))) |
| 59 | COPTS += -DHAVE_IDN |
| 60 | endif |
| 61 | endif |
| 62 | |
| 63 | clean: |
| 64 | $(checkdir) |
| 65 | rm -rf debian/daemon debian/base debian/utils debian/*~ debian/files debian/substvars debian/utils-substvars |
| 66 | make clean |
| 67 | make -C contrib/wrt clean |
| 68 | |
| 69 | binary-indep: checkroot |
| 70 | $(checkdir) |
| 71 | rm -rf debian/daemon |
| 72 | install -m 755 \ |
| 73 | -d debian/daemon/DEBIAN \ |
| 74 | -d debian/daemon/usr/share/doc \ |
| 75 | -d debian/daemon/etc/init.d \ |
| 76 | -d debian/daemon/etc/dnsmasq.d \ |
| 77 | -d debian/daemon/etc/resolvconf/update.d \ |
| 78 | -d debian/daemon/usr/lib/resolvconf/dpkg-event.d \ |
| 79 | -d debian/daemon/etc/default \ |
| 80 | -d debian/daemon/etc/dbus-1/system.d \ |
| 81 | -d debian/daemon/lib/systemd/system \ |
| 82 | -d debian/daemon/etc/insserv.conf.d |
| 83 | install -m 644 debian/conffiles debian/daemon/DEBIAN |
| 84 | install -m 755 debian/postinst debian/postrm debian/prerm debian/daemon/DEBIAN |
| 85 | install -m 755 debian/init debian/daemon/etc/init.d/dnsmasq |
| 86 | install -m 755 debian/resolvconf debian/daemon/etc/resolvconf/update.d/dnsmasq |
| 87 | install -m 755 debian/resolvconf-package debian/daemon/usr/lib/resolvconf/dpkg-event.d/dnsmasq |
| 88 | install -m 644 debian/default debian/daemon/etc/default/dnsmasq |
| 89 | install -m 644 dnsmasq.conf.example debian/daemon/etc/dnsmasq.conf |
| 90 | install -m 644 debian/readme.dnsmasq.d debian/daemon/etc/dnsmasq.d/README |
| 91 | install -m 644 debian/dbus.conf debian/daemon/etc/dbus-1/system.d/dnsmasq.conf |
| 92 | install -m 644 debian/systemd.service debian/daemon/lib/systemd/system/dnsmasq.service |
| 93 | install -m 644 debian/insserv debian/daemon/etc/insserv.conf.d/dnsmasq |
| 94 | ln -s $(package) debian/daemon/usr/share/doc/dnsmasq |
| 95 | cd debian/daemon && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums |
| 96 | dpkg-gencontrol -pdnsmasq -Pdebian/daemon |
| 97 | chown -R root.root debian/daemon |
| 98 | chmod -R g-ws debian/daemon |
| 99 | dpkg --build debian/daemon .. |
| 100 | |
| 101 | binary-arch: checkroot |
| 102 | $(checkdir) |
| 103 | rm -rf debian/base |
| 104 | install -m 755 \ |
| 105 | -d debian/base/DEBIAN \ |
| 106 | -d debian/base/usr/share/doc/$(package) \ |
| 107 | -d debian/base/usr/share/doc/$(package)/examples \ |
| 108 | -d debian/base/var/run \ |
| 109 | -d debian/base/var/lib/misc |
| 110 | make $(TARGET) PREFIX=/usr DESTDIR=`pwd`/debian/base CFLAGS="$(CFLAGS)" COPTS="$(COPTS)" CC=gcc |
| 111 | ifeq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS))) |
| 112 | install -m 644 doc.html debian/base/usr/share/doc/$(package)/. |
| 113 | install -m 644 setup.html debian/base/usr/share/doc/$(package)/. |
| 114 | install -m 644 dnsmasq.conf.example debian/base/usr/share/doc/$(package)/examples/. |
| 115 | install -m 644 FAQ debian/base/usr/share/doc/$(package)/. |
| 116 | gzip -9 debian/base/usr/share/doc/$(package)/FAQ |
| 117 | install -m 644 CHANGELOG debian/base/usr/share/doc/$(package)/changelog |
| 118 | gzip -9 debian/base/usr/share/doc/$(package)/changelog |
| 119 | install -m 644 CHANGELOG.archive debian/base/usr/share/doc/$(package)/changelog.archive |
| 120 | gzip -9 debian/base/usr/share/doc/$(package)/changelog.archive |
| 121 | install -m 644 dbus/DBus-interface debian/base/usr/share/doc/$(package)/. |
| 122 | gzip -9 debian/base/usr/share/doc/$(package)/DBus-interface |
| 123 | endif |
| 124 | install -m 644 debian/changelog debian/base/usr/share/doc/$(package)/changelog.Debian |
| 125 | gzip -9 debian/base/usr/share/doc/$(package)/changelog.Debian |
| 126 | install -m 644 debian/readme debian/base/usr/share/doc/$(package)/README.Debian |
| 127 | install -m 644 debian/copyright debian/base/usr/share/doc/$(package)/copyright |
| 128 | gzip -9 debian/base/usr/share/man/man8/dnsmasq.8 |
| 129 | for f in debian/base/usr/share/man/*; do \ |
| 130 | if [ -f $$f/man8/dnsmasq.8 ]; then \ |
| 131 | gzip -9 $$f/man8/dnsmasq.8 ; \ |
| 132 | fi \ |
| 133 | done |
| 134 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
| 135 | strip -R .note -R .comment debian/base/usr/sbin/dnsmasq |
| 136 | endif |
| 137 | cd debian/base && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums |
| 138 | dpkg-shlibdeps debian/base/usr/sbin/dnsmasq |
| 139 | dpkg-gencontrol -pdnsmasq-base -Pdebian/base |
| 140 | chown -R root.root debian/base |
| 141 | chmod -R g-ws debian/base |
| 142 | dpkg --build debian/base .. |
| 143 | |
| 144 | ifeq ($(DEB_BUILD_ARCH_OS),linux) |
| 145 | rm -rf debian/utils |
| 146 | install -m 755 -d debian/utils/DEBIAN \ |
| 147 | -d debian/utils/usr/share/man/man1 \ |
| 148 | -d debian/utils/usr/bin \ |
| 149 | -d debian/utils/usr/share/doc/dnsmasq-utils |
| 150 | make -C contrib/wrt PREFIX=/usr DESTDIR=`pwd`/debian/utils CFLAGS="$(CFLAGS)" COPTS="$(COPTS)" CC=gcc |
| 151 | install -m 755 contrib/wrt/dhcp_release debian/utils/usr/bin/dhcp_release |
| 152 | install -m 644 contrib/wrt/dhcp_release.1 debian/utils/usr/share/man/man1/dhcp_release.1 |
| 153 | gzip -9 debian/utils/usr/share/man/man1/dhcp_release.1 |
| 154 | install -m 755 contrib/wrt/dhcp_lease_time debian/utils/usr/bin/dhcp_lease_time |
| 155 | install -m 644 contrib/wrt/dhcp_lease_time.1 debian/utils/usr/share/man/man1/dhcp_lease_time.1 |
| 156 | install -m 644 debian/copyright debian/utils/usr/share/doc/dnsmasq-utils/copyright |
| 157 | install -m 644 debian/changelog debian/utils/usr/share/doc/dnsmasq-utils/changelog.Debian |
| 158 | gzip -9 debian/utils/usr/share/doc/dnsmasq-utils/changelog.Debian |
| 159 | gzip -9 debian/utils/usr/share/man/man1/dhcp_lease_time.1 |
| 160 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
| 161 | strip -R .note -R .comment debian/utils/usr/bin/dhcp_release |
| 162 | strip -R .note -R .comment debian/utils/usr/bin/dhcp_lease_time |
| 163 | endif |
| 164 | cd debian/utils && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums |
| 165 | dpkg-shlibdeps -Tdebian/utils-substvars debian/utils/usr/bin/dhcp_release debian/utils/usr/bin/dhcp_lease_time |
| 166 | dpkg-gencontrol -Tdebian/utils-substvars -pdnsmasq-utils -Pdebian/utils |
| 167 | chown -R root.root debian/utils |
| 168 | chmod -R g-ws debian/utils |
| 169 | dpkg --build debian/utils .. |
| 170 | endif |
| 171 | |
| 172 | define checkdir |
| 173 | test -f Makefile -a -f debian/rules |
| 174 | endef |
| 175 | |
| 176 | # Below here is fairly generic really |
| 177 | |
| 178 | binary: binary-arch binary-indep |
| 179 | build: |
| 180 | |
| 181 | checkroot: |
| 182 | test root = "`whoami`" |
| 183 | |
| 184 | .PHONY: binary binary-arch binary-indep clean checkroot |
| 185 | |
| 186 | |