summaryrefslogtreecommitdiffstats
path: root/recipes/literki/literki/makefile.patch
blob: c6f78f0754b02f46f6f339a9c8dd6afb3c460fcf (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
commit d2ad0f4591619aa176edfb618971d0c8ff608a69
Author: Yann Dirson <ydirson@altern.org>
Date:   Tue Aug 3 22:35:25 2010 +0200

    Make the Makefile suitable for packaging and cross-compiling.
    
    This includes normalisation of variable names to minimize packaging
    work, as well as an install target.
    
    Signed-off-by: Yann Dirson <ydirson@altern.org>

diff --git a/Makefile b/Makefile
index f300953..834e6f6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,39 @@
+DESTDIR=
+prefix=/usr
+bindir=$(prefix)/bin
+datadir=$(prefix)/share
+sysconfdir=/etc
+
 PLIKI=display.o keymap.o keys.o keyboard.o applet.o launcher.o logger.o slider.o image_cache.o touchpad.o switcher.o vibrator.o
 
 LIBS=-lX11 -lXext -lXtst -lpthread -lXrandr -lpng -lfakekey
 
-CXXCOMPILE=g++
+CXX=g++
+
+MYCFLAGS = -g $(shell freetype-config --cflags)
+MYLDFLAGS = -g $(shell freetype-config --libs)
 
-CFLAGS=-g `freetype-config --cflags`
-LDFLAGS=-g `freetype-config --libs`
+all: literki
 
 %.o: %.cpp
-	$(CXXCOMPILE) $(CFLAGS) -c $<
+	$(CXX) $(CXXFLAGS) $(MYCFLAGS) -c $<
 
-all:	$(PLIKI)
-	g++ $(LIBS) $(LDFLAGS) -o literki $(PLIKI)
+literki: $(PLIKI)
+	$(CXX) $(LDFLAGS) $(LIBS) $(MYLDFLAGS) -o $@ $^
 
 clean:	
 	rm *.o
 	rm literki
+
+install:
+	install -d -m755 \
+		$(DESTDIR)$(bindir) \
+		$(DESTDIR)$(sysconfdir)/literki \
+		$(DESTDIR)$(datadir)/applications \
+		$(DESTDIR)$(datadir)/pixmaps \
+		$(DESTDIR)$(datadir)/literki/png
+	install -m755 literki $(DESTDIR)$(bindir)/
+	install -m755 literki.conf *layout.conf $(DESTDIR)$(sysconfdir)/literki/
+	install -m644 png/* $(DESTDIR)$(datadir)/literki/png/
+	install -m644 literki.desktop $(DESTDIR)$(datadir)/applications/
+	install -m644 literki.png $(DESTDIR)$(datadir)/pixmaps/