Add maintainer-clean makefile target
[petitboot] / rules.mk
1
2
3 VPATH = $(srcdir)
4
5 CPPFLAGS += -I$(top_srcdir) -I$(top_srcdir)/lib -I$(builddir)
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 uis = ui/test/pb-test
12 #parsers = native yaboot kboot
13 parsers = kboot
14 artwork = background.jpg cdrom.png hdd.png usbpen.png tux.png cursor.gz
15
16 ifeq ($(PBTWIN),y)
17         uis += ui/twin/pb-twin
18 endif
19
20 log_objs = lib/log/log.o
21 talloc_objs = lib/talloc/talloc.o
22 list_objs = lib/list/list.o
23 waiter_objs = lib/waiter/waiter.o
24 server_objs = lib/pb-protocol/pb-protocol.o
25 parser_objs = discover/parser.o discover/parser-utils.o \
26               $(foreach p, $(parsers), discover/$(p)-parser.o)
27
28 parser_test_objs = parser-test.o $(parser_objs)
29
30 all: $(uis) discover/pb-discover
31
32 # twin gui
33 ui/twin/pb-twin: LDFLAGS+=$(twin_LDFLAGS) $(LIBTWIN)
34 ui/twin/pb-twin: CFLAGS+=$(twin_CFLAGS)
35
36 pb_twin_objs = ui/twin/pb-twin.o ui/common/devices.o
37
38 ui/twin/pb-twin: $(pb_twin_objs)
39         $(LINK.o) -o $@ $^
40
41 # test ui
42 pb_test_objs = ui/test/pb-test.o ui/common/discover-client.o \
43         $(log_objs) $(talloc_objs) $(server_objs) $(list_objs)
44
45 ui/test/pb-test: $(pb_test_objs)
46         $(LINK.o) -o $@ $^
47
48 # discovery daemon
49 #pb_discover_objs = discover/params.o discover/parser.o discover/paths.o \
50 #             discover/yaboot-cfg.o \
51 #             $(foreach p,$(parsers),discover/$(p)-parser.o)
52
53 pb_discover_objs = discover/pb-discover.o discover/udev.o \
54                    discover/discover-server.o discover/device-handler.o \
55                    discover/paths.o $(talloc_objs) $(server_objs) \
56                    $(parser_objs) $(list_objs) $(waiter_objs) $(log_objs)
57
58 discover/pb-discover: $(pb_discover_objs)
59         $(LINK.o) -o $@ $^
60
61
62 parser-test: $(parser_test_objs)
63         $(LINK.o) -o $@ $^
64
65 install: all utils/99-petitboot.rules
66         $(INSTALL) -d $(DESTDIR)$(sbindir)/
67         $(INSTALL) discover/pb-discover $(uis) $(DESTDIR)$(sbindir)/
68         $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/artwork/
69         $(INSTALL) $(addprefix $(top_srcdir)/ui/twin/artwork/,$(artwork)) \
70                 $(DESTDIR)$(pkgdatadir)/artwork/
71         $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/utils
72         $(INSTALL) $(top_srcdir)/utils/99-petitboot.rules \
73                  $(DESTDIR)$(pkgdatadir)/utils
74
75 dist:   $(PACKAGE)-$(VERSION).tar.gz
76
77 check:  parser-test
78         devices/parser-test.sh
79
80 distcheck: dist
81         tar -xvf $(PACKAGE)-$(VERSION).tar.gz
82         cd $(PACKAGE)-$(VERSION) && make check
83
84 $(PACKAGE)-$(VERSION).tar.gz: $(PACKAGE)-$(VERSION)
85         tar czvf $@ $^
86
87 $(PACKAGE)-$(VERSION): clean
88         for f in $$(git-ls-files); do \
89                 d=$@/$$(dirname $$f); \
90                 mkdir -p $$d; \
91                 cp -a $$f $$d; \
92         done
93 clean:
94         rm -rf $(PACKAGE)-$(VERSION)
95         rm -f $(uis)
96         rm -f $(pb_twin_objs) $(pb_test_objs)
97         rm -f $(pb_discover_objs)
98         rm -f discover/pb-discover
99         rm -f ui/test/pb-test
100
101 maintainer-clean: clean
102         -rm -f $(top_srcdir)/aclocal.m4
103         -rm -rf $(top_srcdir)/autom4te.cache
104         -rm -f $(top_srcdir)/config.h.in
105         -rm -f $(top_srcdir)/configure
106         -rm -f config.h
107         -rm -f config.log
108         -rm -f config.status
109         -rm -f Makefile
110         -rm -f $(PACKAGE)-$(VERSION).tar.gz
111