~ubuntu-branches/ubuntu/trusty/kerneloops/trusty-201403051755

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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#
# to build this package, you need to have the following components installed:
# dbus-glib-devel libnotify-devel gtk2-devel curl-devel
#

BINDIR=/usr/bin
SBINDIR=/usr/sbin
LOCALESDIR=/usr/share/locale
MANDIR=/usr/share/man/man8
CC?=gcc

CFLAGS := -O2 -g -fstack-protector -D_FORTIFY_SOURCE=2 -Wall -W -Wstrict-prototypes -Wundef -fno-common -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wformat -Wformat-security -Werror=format-security

MY_CFLAGS := `pkg-config --cflags libnotify gtk+-2.0 dbus-glib-1`
#
# pkg-config tends to make programs pull in a ton of libraries, not all 
# are needed. -Wl,--as-needed tells the linker to just drop unused ones,
# and that makes the applet load faster and use less memory.
#
LDF_A := -Wl,--as-needed `pkg-config --libs libnotify gtk+-2.0 dbus-glib-1`
LDF_D := -Wl,--as-needed `pkg-config --libs glib-2.0 dbus-glib-1` `curl-config --libs` -Wl,"-z relro" -Wl,"-z now" 

all:	kerneloops kerneloops-applet kerneloops-submit kerneloops.8.gz

noui:	kerneloops kerneloops.8.gz

.c.o:
	$(CC) $(CFLAGS) $(MY_CFLAGS) -c -o $@ $<
 

kerneloops:	kerneloops.o submit.o dmesg.o configfile.o kerneloops.h
	gcc kerneloops.o submit.o dmesg.o configfile.o $(LDF_D) -o kerneloops
	@(cd po/ && $(MAKE))

kerneloops-applet: kerneloops-applet.o
	gcc kerneloops-applet.o $(LDF_A)-o kerneloops-applet

kerneloops-submit: kerneloops-submit.o configfile.o
	gcc kerneloops-submit.o configfile.o $(LDF_D) -o kerneloops-submit

kerneloops.8.gz: kerneloops.8
	gzip -9 -c $< > $@

clean:
	rm -f *~ *.o *.ko DEADJOE kerneloops kerneloops-applet *.out */*~ kerneloops.8.gz test/*.dbg
	@(cd po/ && $(MAKE) $@)

dist: clean
	rm -rf .git .gitignore push.sh .*~  */*~ test/*dbg

install-system: kerneloops.8.gz
	-mkdir -p $(DESTDIR)$(MANDIR)
	-mkdir -p $(DESTDIR)/etc/dbus-1/system.d/
	install -m 0644 kerneloops.conf $(DESTDIR)/etc/kerneloops.conf
	install -m 0644 kerneloops.dbus $(DESTDIR)/etc/dbus-1/system.d/
	install -m 0644 kerneloops.8.gz $(DESTDIR)$(MANDIR)/
	@(cd po/ && env LOCALESDIR=$(LOCALESDIR) DESTDIR=$(DESTDIR) $(MAKE) install)

install-kerneloops: kerneloops
	-mkdir -p $(DESTDIR)$(SBINDIR)
	install -m 0755 kerneloops $(DESTDIR)$(SBINDIR)/

install-kerneloops-submit: kerneloops-submit
	-mkdir -p $(DESTDIR)$(BINDIR)
	install -m 0755 kerneloops-submit $(DESTDIR)$(BINDIR)/

install-applet: kerneloops-applet
	-mkdir -p $(DESTDIR)$(BINDIR)
	-mkdir -p $(DESTDIR)/etc/xdg/autostart
	-mkdir -p $(DESTDIR)/usr/share/kerneloops
	install -m 0755 kerneloops-applet $(DESTDIR)$(BINDIR)/
	desktop-file-install --mode 0644 --dir=$(DESTDIR)/etc/xdg/autostart/ kerneloops-applet.desktop
	install -m 0644 icon.png $(DESTDIR)/usr/share/kerneloops/icon.png

install: install-system install-kerneloops install-applet install-kerneloops-submit

install-noui: install-system install-kerneloops install-kerneloops-submit


# This is for translators. To update your po with new strings, do :
# svn up ; make uptrans LG=fr # or de, ru, hu, it, ...
uptrans:
	xgettext -C -s -k_ -o po/kerneloops.pot *.c *.h
	@(cd po/ && env LG=$(LG) $(MAKE) $@)

	

tests: kerneloops
	desktop-file-validate *.desktop
	for i in test/*txt ; do echo -n . ; ./kerneloops --debug $$i > $$i.dbg ; diff -u $$i.out $$i.dbg ; done ; echo
	[ -e /usr/bin/valgrind ] && for i in test/*txt ; do echo -n . ; valgrind -q --leak-check=full ./kerneloops --debug $$i > $$i.dbg ; diff -u $$i.out $$i.dbg ; done ; echo

valgrind: kerneloops tests
	valgrind -q --leak-check=full ./kerneloops --debug test/*.txt