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