]> git.ozlabs.org Git - petitboot/blob - rules.mk
Remove device handler test code
[petitboot] / rules.mk
1
2 VPATH = $(srcdir)
3
4 CPPFLAGS += -I$(top_srcdir) -I$(top_srcdir)/lib -I$(builddir)
5 LDFLAGS += $(CFLAGS)
6
7 # we need paths to be overridable at build-time
8 DEFS += '-DPREFIX="$(prefix)"' '-DPKG_SHARE_DIR="$(pkgdatadir)"' \
9         '-DLOCAL_STATE_DIR="$(localstatedir)"'
10
11 # programs
12 pb_discover = discover/pb-discover
13 pb_cui = ui/ncurses/pb-cui
14 pb_test = ui/test/pb-test
15 pb_twin = ui/twin/pb-twin
16 parser_test = test/parser-test
17
18 # install targets and components
19 daemons = $(pb_discover)
20 parsers = kboot yaboot
21 uis = $(pb_test)
22 tests = $(parser_test)
23
24 ifeq ($(PBTWIN),y)
25         uis += $(pb_twin)
26 endif
27
28 # other to install
29 artwork = background.jpg cdrom.png hdd.png usbpen.png tux.png cursor.gz
30 rules = utils/99-petitboot.rules
31
32 # client/daemon lib objs
33 list_objs = lib/list/list.o
34 log_objs = lib/log/log.o
35 protocol_objs = lib/pb-protocol/pb-protocol.o
36 talloc_objs = lib/talloc/talloc.o
37 waiter_objs = lib/waiter/waiter.o
38
39 # daemon objs
40 parser_objs = discover/parser.o discover/parser-conf.o discover/paths.o \
41         $(foreach p, $(parsers), discover/$(p)-parser.o)
42 discover_objs =  discover/udev.o discover/discover-server.o \
43         discover/device-handler.o discover/paths.o discover/parser-utils.o
44
45 # client objs
46 ui_common_objs = ui/common/discover-client.o
47 ncurses_objs =
48 twin_objs = ui/twin/pb-twin.o
49
50 # Makefiles
51 makefiles = Makefile $(top_srcdir)/rules.mk
52
53 # object collections
54 lib_objs = $(list_objs) $(log_objs) $(protocol_objs) $(talloc_objs) \
55         $(waiter_objs)
56
57 daemon_objs = $(lib_objs) $(parser_objs) $(discover_objs)
58
59 client_objs = $(lib_objs) $(ui_common_objs)
60
61 all: $(uis) $(daemons)
62
63 # ncurses cui
64 pb_cui_objs = $(client_objs) $(ncurses_objs) ui/ncurses/ps3-cui.o \
65         ui/common/ps3.o
66 $(pb_cui_objs): $(makefiles)
67
68 $(pb_cui): LDFLAGS += -lps3-utils -lmenu -lform -lncurses
69
70 $(pb_cui): $(pb_cui_objs)
71         $(LINK.o) -o $@ $^
72
73 # test ui
74 pb_test_objs = $(client_objs) ui/test/pb-test.o
75 $(pb_test_objs): $(makefiles)
76
77 $(pb_test): $(pb_test_objs)
78         $(LINK.o) -o $@ $^
79
80 # twin gui
81 pb_twin_objs = $(client_objs) $(twin_objs) ui/twin/ps3-twin.o
82 $(pb_twin_objs): $(makefiles)
83
84 $(pb_twin): LDFLAGS+=$(twin_LDFLAGS) $(LIBTWIN)
85 $(pb_twin): CFLAGS+=$(twin_CFLAGS)
86
87 $(pb_twin): $(pb_twin_objs)
88         $(LINK.o) -o $@ $^
89
90 # discovery daemon
91 pb_discover_objs = $(daemon_objs) discover/pb-discover.o
92 $(pb_discover_objs): $(makefiles)
93
94 $(pb_discover): $(pb_discover_objs)
95         $(LINK.o) -o $@ $^
96
97 # parser-test
98 parser_test_objs = $(lib_objs) $(parser_objs) test/parser-test.o
99 $(parser_test_objs): $(makefiles)
100
101 $(parser_test): $(parser_test_objs)
102         $(LINK.o) -o $@ $^
103
104 parser-test: $(parser_test)
105
106 install: all $(rules)
107         $(INSTALL) -d $(DESTDIR)$(sbindir)/
108         $(INSTALL) $(daemons) $(uis) $(DESTDIR)$(sbindir)/
109         $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/artwork/
110         $(INSTALL) $(addprefix $(top_srcdir)/ui/twin/artwork/,$(artwork)) \
111                 $(DESTDIR)$(pkgdatadir)/artwork/
112         $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/utils
113         $(INSTALL) -m 644 $(top_srcdir)/$(rules) $(DESTDIR)$(pkgdatadir)/utils
114
115 dist: $(PACKAGE)-$(VERSION).tar.gz
116
117 check: parser-test
118         $(SHELL) test/parser-test.sh
119
120 distcheck: dist
121         tar -xvf $(PACKAGE)-$(VERSION).tar.gz
122         cd $(PACKAGE)-$(VERSION) && make check
123
124 $(PACKAGE)-$(VERSION).tar.gz: $(PACKAGE)-$(VERSION)
125         tar czvf $@ $^
126
127 $(PACKAGE)-$(VERSION): clean
128         for f in $$(git --git-dir=$(top_srcdir)/.git ls-files); do \
129                 d=$@/$$(dirname $$f); \
130                 mkdir -p $$d; \
131                 cp -a $(top_srcdir)/$$f $$d; \
132         done
133
134 clean:
135         rm -rf $(PACKAGE)-$(VERSION)
136         rm -f $(uis)
137         rm -f $(pb_cui_objs)
138         rm -f $(pb_test_objs)
139         rm -f $(pb_twin_objs)
140         rm -f $(daemons)
141         rm -f $(pb_discover_objs)
142         rm -f $(tests)
143         rm -f $(parser_test_objs)
144
145 maintainer-clean: clean
146         -rm -f $(top_srcdir)/aclocal.m4
147         -rm -rf $(top_srcdir)/autom4te.cache
148         -rm -f $(top_srcdir)/config.h.in
149         -rm -f $(top_srcdir)/configure
150         -rm -f config.h
151         -rm -f config.log
152         -rm -f config.status
153         -rm -f Makefile
154         -rm -f $(PACKAGE)-$(VERSION).tar.gz