Create device-handler for managing registered devices
[petitboot] / rules.mk
1
2 VPATH = $(srcdir)
3
4 CFLAGS += -I$(top_srcdir) -I$(top_srcdir)/lib -I$(builddir)
5
6 # we need paths to be overridable at build-time
7 DEFS += '-DPREFIX="$(prefix)"' '-DPKG_SHARE_DIR="$(pkgdatadir)"'
8
9 #uis = ui/twin/pb-twin
10 uis = ui/test/pb-test
11 parsers = native yaboot kboot
12 artwork = background.jpg cdrom.png hdd.png usbpen.png tux.png cursor.gz
13
14
15 talloc_objs = lib/talloc/talloc.o
16 list_objs = lib/list/list.o
17 server_objs = lib/pb-protocol/pb-protocol.o
18
19 parser_test_objs = parser-test.o $(parser_objs)
20
21 all: $(uis) discover/pb-discover
22
23 # twin gui
24 ui/twin/pb-twin: LDFLAGS+=$(twin_LDFLAGS)
25 ui/twin/pb-twin: CFLAGS+=$(twin_CFLAGS)
26
27 pb_twin_objs = ui/twin/pb-twin.o ui/common/devices.o
28
29 ui/twin/pb-twin: $(pb_twin_objs)
30         $(LINK.o) -o $@ $^
31
32 # test ui
33 pb_test_objs = ui/test/pb-test.o ui/common/discover-client.o \
34         $(talloc_objs) $(server_objs)
35
36 ui/test/pb-test: $(pb_test_objs)
37         $(LINK.o) -o $@ $^
38
39 # discovery daemon
40 #pb_discover_objs = discover/params.o discover/parser.o discover/paths.o \
41 #             discover/yaboot-cfg.o \
42 #             $(foreach p,$(parsers),discover/$(p)-parser.o)
43
44 pb_discover_objs = discover/pb-discover.o discover/udev.o discover/log.o \
45                    discover/waiter.o discover/discover-server.o \
46                    discover/device-handler.o \
47                    $(talloc_objs) $(server_objs) $(list_objs)
48
49 discover/pb-discover: $(pb_discover_objs)
50         $(LINK.o) -o $@ $^
51
52
53 parser-test: $(parser_test_objs)
54         $(LINK.o) -o $@ $^
55
56 install: all
57         $(INSTALL) -D petitboot $(DESTDIR)$(sbindir)/petitboot
58         $(INSTALL) -D petitboot-udev-helper \
59                 $(DESTDIR)$(sbindir)/petitboot-udev-helper
60         $(INSTALL) -Dd $(DESTDIR)$(pkgdatadir)/artwork/
61         $(INSTALL) -t $(DESTDIR)$(pkgdatadir)/artwork/ \
62                 $(foreach a,$(artwork),$(top_srcdir)/artwork/$(a))
63
64 dist:   $(PACKAGE)-$(VERSION).tar.gz
65
66 check:  parser-test
67         devices/parser-test.sh
68
69 distcheck: dist
70         tar -xvf $(PACKAGE)-$(VERSION).tar.gz
71         cd $(PACKAGE)-$(VERSION) && make check
72
73 $(PACKAGE)-$(VERSION).tar.gz: $(PACKAGE)-$(VERSION)
74         tar czvf $@ $^
75
76 $(PACKAGE)-$(VERSION): clean
77         for f in $$(git-ls-files); do \
78                 d=$@/$$(dirname $$f); \
79                 mkdir -p $$d; \
80                 cp -a $$f $$d; \
81         done
82 clean:
83         rm -rf $(PACKAGE)-$(VERSION)
84         rm -f $(uis)
85         rm -f $(pb_twin_objs) $(pb_test_objs)
86         rm -f $(pb_discover_objs)
87         rm -f discover/pb-discover
88         rm -f ui/test/pb-test
89