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