af6223beb45f8bc8117b7903d90b5bf57c5ed193
[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 $(DESTDIR)$(sbindir)/
62         $(INSTALL) discover/pb-discover $(uis) $(DESTDIR)$(sbindir)/
63         $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/artwork/
64         $(INSTALL) $(addprefix $(top_srcdir)/ui/twin/artwork/,$(artwork)) \
65                 $(DESTDIR)$(pkgdatadir)/artwork/
66
67 dist:   $(PACKAGE)-$(VERSION).tar.gz
68
69 check:  parser-test
70         devices/parser-test.sh
71
72 distcheck: dist
73         tar -xvf $(PACKAGE)-$(VERSION).tar.gz
74         cd $(PACKAGE)-$(VERSION) && make check
75
76 $(PACKAGE)-$(VERSION).tar.gz: $(PACKAGE)-$(VERSION)
77         tar czvf $@ $^
78
79 $(PACKAGE)-$(VERSION): clean
80         for f in $$(git-ls-files); do \
81                 d=$@/$$(dirname $$f); \
82                 mkdir -p $$d; \
83                 cp -a $$f $$d; \
84         done
85 clean:
86         rm -rf $(PACKAGE)-$(VERSION)
87         rm -f $(uis)
88         rm -f $(pb_twin_objs) $(pb_test_objs)
89         rm -f $(pb_discover_objs)
90         rm -f discover/pb-discover
91         rm -f ui/test/pb-test
92