summaryrefslogtreecommitdiff
path: root/Makefile
blob: f60915ed270b36cbc0fd0d48a9b96a53496b0731 (plain)
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
CFLAGS?=-Os -g -Wall
LDFLAGS?=-Wl,--as-needed

LOCALEDIR?=/usr/share/locale

GETTEXT_PACKAGE:=cfmradio
GETTEXT_CFLAGS:=-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" -DLOCALEDIR=\"$(LOCALEDIR)\"
PKGCONFIG_PKGS:=libosso hildon-1 alsa libpulse-mainloop-glib dbus-glib-1 gconf-2.0
PKGCONFIG_CFLAGS:=$(shell pkg-config $(PKGCONFIG_PKGS) --cflags)
PKGCONFIG_LIBS:=$(shell pkg-config $(PKGCONFIG_PKGS) --libs)
LAUNCHER_CFLAGS:=$(shell pkg-config maemo-launcher-app --cflags)
LAUNCHER_LDFLAGS:=$(shell pkg-config maemo-launcher-app --libs)
MISC_CFLAGS:=-std=gnu99 -DG_LOG_DOMAIN=\"CFmRadio\"

SRCS:=cfmradio.c radio.c types.c tuner.c rds.c \
	presets.c preset_list.c preset_renderer.c
OBJS:=$(SRCS:.c=.o)
POT:=po/$(GETTEXT_PACKAGE).pot
PO_FILES:=$(wildcard po/*.po)
MO_FILES:=$(PO_FILES:.po=.mo)
LANGS:=$(basename $(notdir $(PO_FILES)))

all: cfmradio.launch $(MO_FILES)

cfmradio.launch: $(OBJS)
	$(CC) $(LAUNCHER_LDFLAGS) $(LDFLAGS) -o $@ $^ $(PKGCONFIG_LIBS) $(LIBS)

cfmradio: $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $^ $(PKGCONFIG_LIBS) $(LIBS)

$(OBJS): %.o: %.c
	$(CC) $(GETTEXT_CFLAGS) $(MISC_CFLAGS) $(PKGCONFIG_CFLAGS) $(LAUNCHER_CFLAGS) $(CFLAGS) -o $@ -c $<

radio.c: radio.h types.h n900-fmrx-enabler.h

n900-fmrx-enabler.h: n900-fmrx-enabler.xml
	dbus-binding-tool --mode=glib-client --output=$@ --prefix=fmrx_enabler $<

$(POT): $(SRCS)
	xgettext --default-domain=$(GETTEXT_PACKAGE) --from-code=UTF-8 --language=C \
	--msgid-bugs-address=maemo@javispedro.com --package-name=CFmRadio \
	--keyword=_ -o$@ $^

$(MO_FILES): %.mo: %.po
	msgfmt -c -o $@ $<

$(PO_FILES): %: $(POT)
	msgmerge -U $@ $(POT)
	@touch $@

install: cfmradio.launch
	install -m 0755 $(IFLAGS) cfmradio.launch $(DESTDIR)/usr/bin/
	ln -sf /usr/bin/maemo-invoker $(DESTDIR)/usr/bin/cfmradio
	install -m 0644 $(IFLAGS) data/icon.png \
		$(DESTDIR)/usr/share/icons/hicolor/scalable/hildon/cfmradio.png
	install -m 0644 $(IFLAGS) data/cfmradio.service \
		$(DESTDIR)/usr/share/dbus-1/services/
	install -m 0644 $(IFLAGS) data/cfmradio.desktop \
		$(DESTDIR)/usr/share/applications/hildon/
	for lang in $(LANGS); do \
		install -d $(DESTDIR)$(LOCALEDIR)/$$lang/LC_MESSAGES ; \
		install -m 0644 po/$$lang.mo \
			$(DESTDIR)$(LOCALEDIR)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo ; \
	done

clean:
	rm -f cfmradio cfmradio.launch *.o $(MO_FILES)

.PHONY: all clean