Unify profile update and profile replace concepts
[wifi-radar.git] / Makefile
blobfe7098a2bbdea72cff1373dd25037bc0ef2e9614
2 # Makefile for WiFi Radar
5 SHELL = /bin/sh
6 DESTDIR =
9 # These settings are what I would expect for most modern Linux distros,
10 # and are what work for me unmodified on Ubuntu. -BEF-
12 package = wifi-radar
13 prefix = /usr
14 sbindir = $(prefix)/sbin
15 sysconfdir = /etc/
16 initdir = $(sysconfdir)/init.d
17 mandir = $(prefix)/share/man
18 pixmapsdir = $(prefix)/share/pixmaps
19 appsdir = $(prefix)/share/applications
21 srcdir = .
22 top_srcdir = .
23 top_builddir = .
25 VERSION = $(shell cat $(srcdir)/docs/VERSION)
27 BRANCH = $(shell echo v$(shell cat $(srcdir)/docs/VERSION | cut -d. -f1-2).x)
29 TOPDIR := $(CURDIR)
32 .PHONY: all install tarball dev-docs changelog clean distclean
34 all: wifi-radar.localized su-wifiradar
36 install: all
37 test -d $(DESTDIR)/${sysconfdir} || install -d -m 755 $(DESTDIR)/${sysconfdir}
39 test -d $(DESTDIR)/${sbindir} || install -d -m 755 $(DESTDIR)/${sbindir}
40 install -m 755 wifi-radar.localized $(DESTDIR)/${sbindir}/wifi-radar
41 install -m 755 su-wifiradar $(DESTDIR)/${sbindir}/su-wifiradar
43 test -d $(DESTDIR)/${mandir}/man1 || install -d -m 755 $(DESTDIR)/${mandir}/man1
44 install -m 644 man/man1/wifi-radar.1 $(DESTDIR)/${mandir}/man1
46 test -d $(DESTDIR)/${mandir}/man5 || install -d -m 755 $(DESTDIR)/${mandir}/man5
47 install -m 644 man/man5/wifi-radar.conf.5 $(DESTDIR)/${mandir}/man5
49 test -d $(DESTDIR)/${pixmapsdir} || install -d -m 755 $(DESTDIR)/${pixmapsdir}
50 install -m 644 pixmaps/wifi-radar.svg $(DESTDIR)/${pixmapsdir}
51 install -m 644 pixmaps/wifi-radar.png $(DESTDIR)/${pixmapsdir}
53 test -d $(DESTDIR)/${appsdir} || install -d -m 755 $(DESTDIR)/${appsdir}
54 install -m 644 wifi-radar.desktop $(DESTDIR)/${appsdir}
56 su-wifiradar: su-wifiradar.in
57 sed "s/@ICONPATH@/$pixmapsdir/" su-wifiradar.in > su-wifiradar
59 wifi-radar.localized: wifi-radar
60 cp wifi-radar wifi-radar.tmp
61 perl -pi -e 's#^CONF_FILE\s+=.*#CONF_FILE = "$(DESTDIR)/${sysconfdir}/wifi-radar.conf"#' wifi-radar.tmp
62 mv wifi-radar.tmp wifi-radar.localized
64 tarball: $(TOPDIR)/tmp/${package}-$(VERSION).tar.bz2.sign $(TOPDIR)/tmp/${package}-$(VERSION).tar.bz2.sha256
66 $(TOPDIR)/tmp/${package}-$(VERSION).tar.bz2.sign: $(TOPDIR)/tmp/${package}-$(VERSION).tar.bz2
67 cd $(TOPDIR)/tmp && gpg --detach-sign -a --output ${package}-$(VERSION).tar.bz2.asc ${package}-$(VERSION).tar.bz2
68 cd $(TOPDIR)/tmp && chmod 644 ${package}-$(VERSION).tar.bz2.asc
69 cd $(TOPDIR)/tmp && gpg --verify ${package}-$(VERSION).tar.bz2.asc
71 $(TOPDIR)/tmp/${package}-$(VERSION).tar.bz2.sha256:
72 cd $(TOPDIR)/tmp && sha256sum ${package}-$(VERSION).tar.bz2 > ${package}-$(VERSION).tar.bz2.sha256
74 $(TOPDIR)/tmp/${package}-$(VERSION).tar.bz2:
75 rm -fr $(TOPDIR)/tmp
76 mkdir -p $(TOPDIR)/tmp/
77 git archive --format=tar --prefix=${package}-$(VERSION)/ $(BRANCH) | (cd $(TOPDIR)/tmp/ && tar xf -)
78 find $(TOPDIR)/tmp/${package}-$(VERSION) -type f -exec chmod ug+r {} \;
79 find $(TOPDIR)/tmp/${package}-$(VERSION) -type d -exec chmod ug+rx {} \;
80 perl -pi -e 's#^WIFI_RADAR_VERSION\s+=.*#WIFI_RADAR_VERSION = "${VERSION}"#' $(TOPDIR)/tmp/${package}-$(VERSION)/wifi-radar
81 chmod 755 $(TOPDIR)/tmp/${package}-$(VERSION)/wifi-radar
82 cd $(TOPDIR)/tmp && tar -ch ${package}-$(VERSION) | bzip2 > ${package}-$(VERSION).tar.bz2
83 cd $(TOPDIR)/tmp && chmod 644 ${package}-$(VERSION).tar.bz2
84 ls -l $(TOPDIR)/tmp/
86 dev-docs:
87 mkdir -p docs/developer
88 ( cd docs/developer ; pydoc -w ../../wifiradar/*.py ; rename "" wifiradar. * ; pydoc -w ../../wifi-radar.py )
90 changelog:
91 mkdir -p $(TOPDIR)/tmp/
92 git log | perl -pi -e 's/</&lt;/g; s/>/&gt;/g; s/@/@<!-- com.com -->/g;' > $(TOPDIR)/tmp/CHANGELOG
94 clean:
95 rm -f wifi-radar.localized
96 rm -fr tmp/
98 distclean: clean