aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 59ff6902336909c9df337e9e7208da298f4da3ba (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# netlink-notify - Notify about netlink changes

CC	:= gcc
MD	:= markdown
CONVERT	:= convert -define png:compression-level=9 -background transparent
INSTALL	:= install
CP	:= cp
RM	:= rm
CFLAGS	+= -std=c11 -O2 -Wall -Werror
CFLAGS	+= $(shell pkg-config --cflags --libs libnotify)
# this is just a fallback in case you do not use git but downloaded
# a release tarball...
VERSION := 0.7.2

all: netlink-notify icons README.html

netlink-notify: netlink-notify.c version.h config.h
	$(CC) $(CFLAGS) -o netlink-notify netlink-notify.c

config.h:
	$(CP) config.def.h config.h

version.h: $(wildcard .git/HEAD .git/index .git/refs/tags/*) Makefile
	echo "#ifndef VERSION" > $@
	echo "#define VERSION \"$(shell git describe --tags --long 2>/dev/null || echo ${VERSION})\"" >> $@
	echo "#endif" >> $@

icons: netlink-notify-up.png netlink-notify-down.png netlink-notify-address.png netlink-notify-away.png

netlink-notify-up.png: netlink-notify-up.svg
	$(CONVERT) netlink-notify-up.svg netlink-notify-up.png

netlink-notify-down.png: netlink-notify-down.svg
	$(CONVERT) netlink-notify-down.svg netlink-notify-down.png

netlink-notify-address.png: netlink-notify-address.svg
	$(CONVERT) netlink-notify-address.svg netlink-notify-address.png

netlink-notify-away.png: netlink-notify-away.svg
	$(CONVERT) netlink-notify-away.svg netlink-notify-away.png

README.html: README.md
	$(MD) README.md > README.html

install: install-bin install-doc

install-bin: netlink-notify icons
	$(INSTALL) -D -m0755 netlink-notify $(DESTDIR)/usr/bin/netlink-notify
	$(INSTALL) -D -m0644 netlink-notify.desktop $(DESTDIR)/etc/xdg/autostart/netlink-notify.desktop
	$(INSTALL) -D -m0755 netlink-notify-up.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/netlink-notify-up.svg
	$(INSTALL) -D -m0755 netlink-notify-down.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/netlink-notify-down.svg
	$(INSTALL) -D -m0755 netlink-notify-address.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/netlink-notify-address.svg
	$(INSTALL) -D -m0755 netlink-notify-away.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/netlink-notify-away.svg
	$(INSTALL) -D -m0755 netlink-notify-up.png $(DESTDIR)/usr/share/icons/hicolor/48x48/status/netlink-notify-up.png
	$(INSTALL) -D -m0755 netlink-notify-down.png $(DESTDIR)/usr/share/icons/hicolor/48x48/status/netlink-notify-down.png
	$(INSTALL) -D -m0755 netlink-notify-address.png $(DESTDIR)/usr/share/icons/hicolor/48x48/status/netlink-notify-address.png
	$(INSTALL) -D -m0755 netlink-notify-away.png $(DESTDIR)/usr/share/icons/hicolor/48x48/status/netlink-notify-away.png

install-doc: README.html
	$(INSTALL) -D -m0644 README.md $(DESTDIR)/usr/share/doc/netlink-notify/README.md
	$(INSTALL) -D -m0644 README.html $(DESTDIR)/usr/share/doc/netlink-notify/README.html
	$(INSTALL) -D -m0644 screenshot-away.png $(DESTDIR)/usr/share/doc/netlink-notify/screenshot-away.png
	$(INSTALL) -D -m0644 screenshot-down.png $(DESTDIR)/usr/share/doc/netlink-notify/screenshot-down.png
	$(INSTALL) -D -m0644 screenshot-ip.png $(DESTDIR)/usr/share/doc/netlink-notify/screenshot-ip.png
	$(INSTALL) -D -m0644 screenshot-ipv6.png $(DESTDIR)/usr/share/doc/netlink-notify/screenshot-ipv6.png
	$(INSTALL) -D -m0644 screenshot-up.png $(DESTDIR)/usr/share/doc/netlink-notify/screenshot-up.png

clean:
	$(RM) -f *.o *~ README.html netlink-notify version.h

distclean:
	$(RM) -f *.o *~ README.html netlink-notify version.h config.h

release:
	git archive --format=tar.xz --prefix=netlink-notify-$(VERSION)/ $(VERSION) > netlink-notify-$(VERSION).tar.xz
	gpg -ab netlink-notify-$(VERSION).tar.xz