X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=rules.mk;h=040f269f9e68a967b6b435735734670658ab2357;hp=403a388e585c39995d5fea16058bf4a84da272cf;hb=8a939f0de36db6316e0872b7263408b2dc9b83ea;hpb=49e0052d59f8b863dc6d1f975f752da93ba67b36 diff --git a/rules.mk b/rules.mk index 403a388..040f269 100644 --- a/rules.mk +++ b/rules.mk @@ -1,81 +1,121 @@ - VPATH = $(srcdir) CPPFLAGS += -I$(top_srcdir) -I$(top_srcdir)/lib -I$(builddir) +LDFLAGS += $(CFLAGS) # we need paths to be overridable at build-time DEFS += '-DPREFIX="$(prefix)"' '-DPKG_SHARE_DIR="$(pkgdatadir)"' \ '-DLOCAL_STATE_DIR="$(localstatedir)"' -uis = ui/test/pb-test -#parsers = native yaboot kboot -parsers = kboot -artwork = background.jpg cdrom.png hdd.png usbpen.png tux.png cursor.gz +# 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 yaboot +uis = $(pb_test) +tests = $(parser_test) ifeq ($(PBTWIN),y) - uis += ui/twin/pb-twin + uis += $(pb_twin) endif +# other to install +artwork = background.jpg cdrom.png hdd.png usbpen.png tux.png cursor.gz +rules = utils/99-petitboot.rules + +# 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) + discover/parser-conf.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 +# Makefiles +makefiles = Makefile $(top_srcdir)/rules.mk -# twin gui -ui/twin/pb-twin: LDFLAGS+=$(twin_LDFLAGS) $(LIBTWIN) -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) + +client_objs = $(lib_objs) $(ui_common_objs) -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): $(makefiles) + +$(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): $(makefiles) -ui/test/pb-test: $(pb_test_objs) +$(pb_test): $(pb_test_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) +# twin gui +pb_twin_objs = $(client_objs) $(twin_objs) ui/twin/ps3-twin.o +$(pb_twin_objs): $(makefiles) -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_twin): LDFLAGS+=$(twin_LDFLAGS) $(LIBTWIN) +$(pb_twin): CFLAGS+=$(twin_CFLAGS) -discover/pb-discover: $(pb_discover_objs) +$(pb_twin): $(pb_twin_objs) $(LINK.o) -o $@ $^ +# discovery daemon +pb_discover_objs = $(daemon_objs) discover/pb-discover.o +$(pb_discover_objs): $(makefiles) -parser-test: $(parser_test_objs) +$(pb_discover): $(pb_discover_objs) $(LINK.o) -o $@ $^ -install: all utils/99-petitboot.rules +# parser-test +parser_test_objs = $(parser_objs) test/parser-test.o +$(parser_test_objs): $(makefiles) + +$(parser_test): $(parser_test_objs) + $(LINK.o) -o $@ $^ + +parser-test: $(parser_test) + +install: all $(rules) $(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/ $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/utils - $(INSTALL) $(top_srcdir)/utils/99-petitboot.rules \ - $(DESTDIR)$(pkgdatadir)/utils + $(INSTALL) -m 644 $(top_srcdir)/$(rules) $(DESTDIR)$(pkgdatadir)/utils -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 @@ -85,18 +125,22 @@ $(PACKAGE)-$(VERSION).tar.gz: $(PACKAGE)-$(VERSION) 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 @@ -108,4 +152,3 @@ maintainer-clean: clean -rm -f config.status -rm -f Makefile -rm -f $(PACKAGE)-$(VERSION).tar.gz -