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