File: Makefile

package info (click to toggle)
obsession 20140608-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 536 kB
  • sloc: ansic: 956; makefile: 53
file content (68 lines) | stat: -rw-r--r-- 1,977 bytes parent folder | download
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
-include makefile.mk

PREFIX ?=/usr/local
LOCALE_DIR=$(PREFIX)/share/locale


# Building flags.
PKG_CONFIG ?= pkg-config
CFLAGS ?=-march=native -mtune=generic -O2 -Wall
VALAFLAGS:=$(foreach w,$(LDFLAGS) $(CFLAGS) $(CPPFLAGS),-X $(w))
CFLAGS +=$(shell $(PKG_CONFIG) --cflags gtk+-3.0 dbus-1 x11 gio-unix-2.0) -I.
LDFLAGS+=$(shell $(PKG_CONFIG) --libs gtk+-3.0 glib-2.0 dbus-1 x11 gio-unix-2.0)

# PO and MO files
LINGUAS= $(shell ls po/*.po)
I18N_MO= $(LINGUAS:.po=.mo)


all: obsession-exit obsession-logout xdg-autostart $(I18N_MO)

.SUFFIXES: .c

.c.o:
	@echo "Compiling $<"
	@$(CC) -o $@ -c $< $(CFLAGS) $(CPPFLAGS)

obsession-exit: obsession-exit.o dbus-interface.o obsession-common.o config.h
	@echo "Building $@"
	@$(CC) -o $@ $(filter-out %.h,$^) $(LDFLAGS)

obsession-logout: obsession-logout.o dbus-interface.o obsession-common.o config.h
	@echo "Building $@"
	@$(CC) -o $@ $(filter-out %.h,$^) $(LDFLAGS)

xdg-autostart:  autostart/xdg-autostart.vala
	@echo "Building $@"
	@valac --cc=$(CC) --pkg-config=$(PKG_CONFIG) -o $@ $(VALAFLAGS) $^

po/%.mo: po/%.po
	msgfmt -o $@ $<

PHONY: clean install configure mrproper

mrproper: clean
	rm -f makefile.mk

clean:
	rm -f obsession-exit obsession-logout xdg-autostart *.o $(I18N_MO)
	sed -i 's#define PREFIX.*#define PREFIX              "/usr/local"#' config.h

	rm -f makefile.mk

configure:
	sed -i 's#define PREFIX.*#define PREFIX "$(PREFIX)"#' config.h
	echo "PREFIX ?= $(PREFIX)" > makefile.mk

install: all
	install -D -m0755 obsession-exit   $(DESTDIR)$(PREFIX)/bin/obsession-exit
	install -D -m0755 obsession-logout $(DESTDIR)$(PREFIX)/bin/obsession-logout
	install -D -m0755 xdg-autostart    $(DESTDIR)$(PREFIX)/bin/xdg-autostart
	# mo files.
	for f in $(I18N_MO) ; do \
		F=`basename $$f | sed 's/\.[^\.]*$$//'`;\
		install -D -m0644 $$f $(DESTDIR)$(LOCALE_DIR)/$$F/LC_MESSAGES/obsession-logout.mo;\
	done
	for f in `ls images/*.png`; do \
		install -D -m0644 $$f $(DESTDIR)$(PREFIX)/share/obsession/$$f;\
	done