[Cbe-oss-dev] [patch 4/8 v2] petitboot: Makefile cleanups

Geoff Levand geoffrey.levand at am.sony.com
Thu Feb 19 06:15:18 EST 2009


Subject: [patch] petitboot: Makefile cleanups

General cleanup of the makefile.

Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>
---
v2: Rebase to option-with-twin-2.diff.

 Makefile.in  |    4 +
 configure.ac |    5 +-
 rules.mk     |  127 ++++++++++++++++++++++++++++++++++++++++++-----------------
 3 files changed, 98 insertions(+), 38 deletions(-)

--- a/Makefile.in
+++ b/Makefile.in
@@ -11,11 +11,15 @@ DEFS = @DEFS@
 CPPFLAGS = @CPPFLAGS@ $(DEFS)
 
 # dependencies
+ at COND_WITH_LIBTWIN_FALSE@cond_pb_twin =
+ at COND_WITH_LIBTWIN_TRUE@cond_pb_twin = $(pb_twin)
+LIBTWIN = @LIBTWIN@
 twin_CFLAGS = @twin_CFLAGS@
 twin_LDFLAGS = @twin_LIBS@
 
 # other programs
 INSTALL = @INSTALL@
+SHELL = @SHELL@
 
 # paths
 prefix = @prefix@
--- a/configure.ac
+++ b/configure.ac
@@ -48,8 +48,9 @@ AS_IF([test "x$with_twin" != xno],
 		fi],
 		[${twin_LIBS}])])
 
+AM_CONDITIONAL([COND_WITH_LIBTWIN], [test "x$with_twin" = "xyes"])
 
-mkdir -p discover ui/test ui/common lib/talloc lib/pb-protocol lib/list \
-	      lib/waiter lib/log
+mkdir -p discover lib/list lib/log lib/pb-protocol lib/talloc lib/waiter \
+	test ui/common ui/ncurses ui/test ui/twin
 
 AC_OUTPUT
--- a/rules.mk
+++ b/rules.mk
@@ -1,5 +1,4 @@
 
-
 VPATH = $(srcdir)
 
 CPPFLAGS += -I$(top_srcdir) -I$(top_srcdir)/lib -I$(builddir)
@@ -8,68 +7,111 @@ CPPFLAGS += -I$(top_srcdir) -I$(top_srcd
 DEFS += '-DPREFIX="$(prefix)"' '-DPKG_SHARE_DIR="$(pkgdatadir)"' \
 	'-DLOCAL_STATE_DIR="$(localstatedir)"'
 
-#uis = ui/twin/pb-twin
-uis = ui/test/pb-test
-#parsers = native yaboot kboot
+# programs
+pb_discover = discover/pb-discover
+pb_cui = ui/ncurses/pb-cui
+pb_test = ui/test/pb-test
+pb_twin = ui/twin/pb-twin
+parser_test = test/parser-test
+
+# install targets and components
+daemons = $(pb_discover)
+#parsers = kboot native yaboot (todo)
 parsers = kboot
+uis = $(pb_test) $(cond_pb_twin)
+tests = $(parser_test)
+
+# other to install
 artwork = background.jpg cdrom.png hdd.png usbpen.png tux.png cursor.gz
 
+# client/daemon lib objs
+list_objs = lib/list/list.o
 log_objs = lib/log/log.o
+protocol_objs = lib/pb-protocol/pb-protocol.o
 talloc_objs = lib/talloc/talloc.o
-list_objs = lib/list/list.o
 waiter_objs = lib/waiter/waiter.o
-server_objs = lib/pb-protocol/pb-protocol.o
+
+# daemon objs
 parser_objs = discover/parser.o discover/parser-utils.o \
-	      $(foreach p, $(parsers), discover/$(p)-parser.o)
+	$(foreach p, $(parsers), discover/$(p)-parser.o)
+discover_objs = discover/udev.o discover/discover-server.o \
+	discover/device-handler.o discover/paths.o
 
-parser_test_objs = parser-test.o $(parser_objs)
+# client objs
+ui_common_objs = ui/common/discover-client.o
+ncurses_objs =
+twin_objs = ui/twin/pb-twin.o
 
-all: $(uis) discover/pb-discover
+# headers
+discover_all_headers = $(wildcard $(top_srcdir)/discover/*.h)
+lib_headers = $(wildcard $(top_srcdir)/lib/*/*.h)
+ui_all_headers = $(wildcard $(top_srcdir)/ui/*/*.h)
 
-# twin gui
-ui/twin/pb-twin: LDFLAGS+=$(twin_LDFLAGS)
-ui/twin/pb-twin: CFLAGS+=$(twin_CFLAGS)
+# object collections
+lib_objs = $(list_objs) $(log_objs) $(protocol_objs) $(talloc_objs) \
+	$(waiter_objs)
+
+daemon_objs = $(lib_objs) $(parser_objs) $(discover_objs)
+daemon_headers = $(lib_headers) $(discover_all_headers)
+
+client_objs = $(lib_objs) $(ui_common_objs)
+client_headers = $(lib_headers) $(discover_all_headers) $(ui_all_headers)
 
-pb_twin_objs = ui/twin/pb-twin.o ui/common/devices.o
+all: $(uis) $(daemons)
 
-ui/twin/pb-twin: $(pb_twin_objs)
+# ncurses cui
+pb_cui_objs = $(client_objs) $(ncurses_objs) ui/ncurses/ps3-cui.o
+$(pb_cui_objs): $(client_headers)
+
+$(pb_cui): LDFLAGS+=-lncurses
+
+$(pb_cui): $(pb_cui_objs)
 	$(LINK.o) -o $@ $^
 
 # test ui
-pb_test_objs = ui/test/pb-test.o ui/common/discover-client.o \
-	$(log_objs) $(talloc_objs) $(server_objs) $(list_objs)
+pb_test_objs = $(client_objs) ui/test/pb-test.o
+$(pb_test_objs): $(client_headers)
+
+$(pb_test): $(pb_test_objs)
+	$(LINK.o) -o $@ $^
 
-ui/test/pb-test: $(pb_test_objs)
+# twin gui
+pb_twin_objs = $(client_objs) $(twin_objs) ui/twin/ps3-twin.o
+$(pb_twin_objs): $(client_headers)
+
+$(pb_twin): LDFLAGS+=$(twin_LDFLAGS) $(LIBTWIN)
+$(pb_twin): CFLAGS+=$(twin_CFLAGS)
+
+$(pb_twin): $(pb_twin_objs)
 	$(LINK.o) -o $@ $^
 
 # discovery daemon
-#pb_discover_objs = discover/params.o discover/parser.o discover/paths.o \
-#	      discover/yaboot-cfg.o \
-#	      $(foreach p,$(parsers),discover/$(p)-parser.o)
-
-pb_discover_objs = discover/pb-discover.o discover/udev.o \
-		   discover/discover-server.o discover/device-handler.o \
-		   discover/paths.o $(talloc_objs) $(server_objs) \
-		   $(parser_objs) $(list_objs) $(waiter_objs) $(log_objs)
+pb_discover_objs = $(daemon_objs) discover/pb-discover.o
+$(pb_discover_objs): $(daemon_headers)
 
-discover/pb-discover: $(pb_discover_objs)
+$(pb_discover): $(pb_discover_objs)
 	$(LINK.o) -o $@ $^
 
+# parser-test
+parser_test_objs = $(parser_objs) test/parser-test.o
+$(parser_test_objs): $(daemon_headers)
 
-parser-test: $(parser_test_objs)
+$(parser_test): $(parser_test_objs)
 	$(LINK.o) -o $@ $^
 
+parser-test: $(parser_test)
+
 install: all
 	$(INSTALL) -d $(DESTDIR)$(sbindir)/
-	$(INSTALL) discover/pb-discover $(uis) $(DESTDIR)$(sbindir)/
+	$(INSTALL) $(daemons) $(uis) $(DESTDIR)$(sbindir)/
 	$(INSTALL) -d $(DESTDIR)$(pkgdatadir)/artwork/
 	$(INSTALL) $(addprefix $(top_srcdir)/ui/twin/artwork/,$(artwork)) \
 		$(DESTDIR)$(pkgdatadir)/artwork/
 
-dist:	$(PACKAGE)-$(VERSION).tar.gz
+dist: $(PACKAGE)-$(VERSION).tar.gz
 
-check:	parser-test
-	devices/parser-test.sh
+check: parser-test
+	$(SHELL) test/parser-test.sh
 
 distcheck: dist
 	tar -xvf $(PACKAGE)-$(VERSION).tar.gz
@@ -79,16 +121,29 @@ $(PACKAGE)-$(VERSION).tar.gz: $(PACKAGE)
 	tar czvf $@ $^
 
 $(PACKAGE)-$(VERSION): clean
-	for f in $$(git-ls-files); do \
+	for f in $$(git --git-dir=$(top_srcdir)/.git ls-files); do \
 		d=$@/$$(dirname $$f); \
 		mkdir -p $$d; \
-		cp -a $$f $$d; \
+		cp -a $(top_srcdir)/$$f $$d; \
 	done
 clean:
 	rm -rf $(PACKAGE)-$(VERSION)
 	rm -f $(uis)
-	rm -f $(pb_twin_objs) $(pb_test_objs)
+	rm -f $(pb_cui_objs)
+	rm -f $(pb_test_objs)
+	rm -f $(pb_twin_objs)
+	rm -f $(daemons)
 	rm -f $(pb_discover_objs)
-	rm -f discover/pb-discover
-	rm -f ui/test/pb-test
+	rm -f $(tests)
+	rm -f $(parser_test_objs)
 
+maintainer-clean: clean
+	-rm -f $(top_srcdir)/aclocal.m4
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -f $(top_srcdir)/config.h.in
+	-rm -f $(top_srcdir)/configure
+	-rm -f config.h
+	-rm -f config.log
+	-rm -f config.status
+	-rm -f Makefile
+	-rm -f $(PACKAGE)-$(VERSION).tar.gz





More information about the cbe-oss-dev mailing list