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