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