]> git.ozlabs.org Git - petitboot/blob - rules.mk
Makefile cleanups
[petitboot] / rules.mk
1
2 VPATH = $(srcdir)
3
4 CPPFLAGS += -I$(top_srcdir) -I$(top_srcdir)/lib -I$(builddir)
5
6 # we need paths to be overridable at build-time
7 DEFS += '-DPREFIX="$(prefix)"' '-DPKG_SHARE_DIR="$(pkgdatadir)"' \
8         '-DLOCAL_STATE_DIR="$(localstatedir)"'
9
10 # programs
11 pb_discover = discover/pb-discover
12 pb_cui = ui/ncurses/pb-cui
13 pb_test = ui/test/pb-test
14 pb_twin = ui/twin/pb-twin
15 parser_test = test/parser-test
16
17 # install targets and components
18 daemons = $(pb_discover)
19 #parsers = kboot native yaboot (todo)
20 parsers = kboot
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-utils.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
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 # object collections
51 lib_objs = $(list_objs) $(log_objs) $(protocol_objs) $(talloc_objs) \
52         $(waiter_objs)
53
54 daemon_objs = $(lib_objs) $(parser_objs) $(discover_objs)
55
56 client_objs = $(lib_objs) $(ui_common_objs)
57
58 all: $(uis) $(daemons)
59
60 # ncurses cui
61 pb_cui_objs = $(client_objs) $(ncurses_objs) ui/ncurses/ps3-cui.o
62
63 $(pb_cui): LDFLAGS += -lncurses
64
65 $(pb_cui): $(pb_cui_objs)
66         $(LINK.o) -o $@ $^
67
68 # test ui
69 pb_test_objs = $(client_objs) ui/test/pb-test.o
70
71 $(pb_test): $(pb_test_objs)
72         $(LINK.o) -o $@ $^
73
74 # twin gui
75 pb_twin_objs = $(client_objs) $(twin_objs) ui/twin/ps3-twin.o
76
77 $(pb_twin): LDFLAGS+=$(twin_LDFLAGS) $(LIBTWIN)
78 $(pb_twin): CFLAGS+=$(twin_CFLAGS)
79
80 $(pb_twin): $(pb_twin_objs)
81         $(LINK.o) -o $@ $^
82
83 # discovery daemon
84 pb_discover_objs = $(daemon_objs) discover/pb-discover.o
85
86 $(pb_discover): $(pb_discover_objs)
87         $(LINK.o) -o $@ $^
88
89 # parser-test
90 parser_test_objs = $(parser_objs) test/parser-test.o
91
92 $(parser_test): $(parser_test_objs)
93         $(LINK.o) -o $@ $^
94
95 parser-test: $(parser_test)
96
97 install: all $(rules)
98         $(INSTALL) -d $(DESTDIR)$(sbindir)/
99         $(INSTALL) $(daemons) $(uis) $(DESTDIR)$(sbindir)/
100         $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/artwork/
101         $(INSTALL) $(addprefix $(top_srcdir)/ui/twin/artwork/,$(artwork)) \
102                 $(DESTDIR)$(pkgdatadir)/artwork/
103         $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/utils
104         $(INSTALL) $(top_srcdir)/$(rules) $(DESTDIR)$(pkgdatadir)/utils
105
106 dist: $(PACKAGE)-$(VERSION).tar.gz
107
108 check: parser-test
109         $(SHELL) test/parser-test.sh
110
111 distcheck: dist
112         tar -xvf $(PACKAGE)-$(VERSION).tar.gz
113         cd $(PACKAGE)-$(VERSION) && make check
114
115 $(PACKAGE)-$(VERSION).tar.gz: $(PACKAGE)-$(VERSION)
116         tar czvf $@ $^
117
118 $(PACKAGE)-$(VERSION): clean
119         for f in $$(git-ls-files); do \
120                 d=$@/$$(dirname $$f); \
121                 mkdir -p $$d; \
122                 cp -a $$f $$d; \
123         done
124
125 clean:
126         rm -rf $(PACKAGE)-$(VERSION)
127         rm -f $(uis)
128         rm -f $(pb_cui_objs)
129         rm -f $(pb_test_objs)
130         rm -f $(pb_twin_objs)
131         rm -f $(daemons)
132         rm -f $(pb_discover_objs)
133         rm -f $(tests)
134         rm -f $(parser_test_objs)
135
136 maintainer-clean: clean
137         -rm -f $(top_srcdir)/aclocal.m4
138         -rm -rf $(top_srcdir)/autom4te.cache
139         -rm -f $(top_srcdir)/config.h.in
140         -rm -f $(top_srcdir)/configure
141         -rm -f config.h
142         -rm -f config.log
143         -rm -f config.status
144         -rm -f Makefile
145         -rm -f $(PACKAGE)-$(VERSION).tar.gz