aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 9dccba52b3903a4f1b3c6733b00d93eff65ca8c3 (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
71
72
73
74
75
VERSION = 1
PATCHLEVEL = 0
EXTRAVERSION = alpha3

LIBRARY	= multitouch.so
FDIS	= 11-multitouch.fdi
MODULES = match mtdev src
XMODULES = driver

o_match	= match

o_mtdev	= iobuf caps core

o_src	= hwstate mtstate memory mtouch gestures

o_driver= multitouch

TARGETS	+= match/test
TARGETS	+= mtdev/mapgen
TARGETS	+= mtdev/test
TARGETS	+= src/test

OBJECTS	= $(addsuffix .o,\
	$(foreach mod,$(MODULES),\
	$(addprefix $(mod)/,$(o_$(mod)))))
XOBJECTS= $(addsuffix .o,\
	$(foreach mod,$(XMODULES),\
	$(addprefix $(mod)/,$(o_$(mod)))))

TBIN	= $(addprefix bin/,$(TARGETS))
TLIB	= $(addprefix obj/,$(LIBRARY))
TOBJ	= $(addprefix obj/,$(addsuffix .o,$(TARGETS)))
TFDI	= $(addprefix fdi/,$(FDIS))
OBJS	= $(addprefix obj/,$(OBJECTS))
XOBJS	= $(addprefix obj/,$(XOBJECTS))
LIBS	= -lm

DLIB	= usr/lib/xorg/modules/input
DFDI	= usr/share/hal/fdi/policy/20thirdparty

INCLUDE = -Iinclude -I/usr/include/xorg -I/usr/include/pixman-1
OPTS	= -O3 -fPIC

.PHONY: all clean
.PRECIOUS: obj/%.o

all:	$(OBJS) $(TLIB) $(TOBJ) $(TBIN)

bin/%:	obj/%.o $(OBJS)
	@mkdir -p $(@D)
	gcc $< -o $@ $(OBJS) $(LIBS)

$(TLIB): $(OBJS) $(XOBJS)
	@rm -f $(TLIB)
	gcc -shared $(OBJS) $(XOBJS) -Wl,-soname -Wl,$(LIBRARY) -o $@

obj/%.o: %.c
	@mkdir -p $(@D)
	gcc $(INCLUDE) $(OPTS) -c $< -o $@

obj/%.o: %.cc
	@mkdir -p $(@D)
	gcc $(INCLUDE) $(OPTS) -c $< -o $@

clean:
	rm -rf bin obj

distclean: clean
	rm -rf debian/*.log debian/files

install: $(TLIB) $(TFDI)
	install -d "$(DESTDIR)/$(DLIB)"
	install -d "$(DESTDIR)/$(DFDI)"
	install -m 755 $(TLIB) "$(DESTDIR)/$(DLIB)"
	install -m 644 $(TFDI) "$(DESTDIR)/$(DFDI)"