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