f8d64c61752b3d0c505740c33dea4e8d5850a50f
[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                    $(talloc_objs) $(server_objs) $(list_objs)
47
48 discover/pb-discover: $(pb_discover_objs)
49         $(LINK.o) -o $@ $^
50
51
52 parser-test: $(parser_test_objs)
53         $(LINK.o) -o $@ $^
54
55 install: all
56         $(INSTALL) -D petitboot $(DESTDIR)$(sbindir)/petitboot
57         $(INSTALL) -D petitboot-udev-helper \
58                 $(DESTDIR)$(sbindir)/petitboot-udev-helper
59         $(INSTALL) -Dd $(DESTDIR)$(pkgdatadir)/artwork/
60         $(INSTALL) -t $(DESTDIR)$(pkgdatadir)/artwork/ \
61                 $(foreach a,$(artwork),$(top_srcdir)/artwork/$(a))
62
63 dist:   $(PACKAGE)-$(VERSION).tar.gz
64
65 check:  parser-test
66         devices/parser-test.sh
67
68 distcheck: dist
69         tar -xvf $(PACKAGE)-$(VERSION).tar.gz
70         cd $(PACKAGE)-$(VERSION) && make check
71
72 $(PACKAGE)-$(VERSION).tar.gz: $(PACKAGE)-$(VERSION)
73         tar czvf $@ $^
74
75 $(PACKAGE)-$(VERSION): clean
76         for f in $$(git-ls-files); do \
77                 d=$@/$$(dirname $$f); \
78                 mkdir -p $$d; \
79                 cp -a $$f $$d; \
80         done
81 clean:
82         rm -rf $(PACKAGE)-$(VERSION)
83         rm -f $(uis)
84         rm -f $(pb_twin_objs) $(pb_test_objs)
85         rm -f $(pb_discover_objs)
86         rm -f discover/pb-discover
87         rm -f ui/test/pb-test
88