From e565e758763f32f49350b78b63308539cc0d90ab Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Wed, 16 Jan 2008 23:57:00 +0100 Subject: Some cleanup in the Makefile dependencies for subdirs Added target to create a generated version suffix file. --- Makefile | 33 +++++++++++++++++++-------------- buildutil/version-util | 37 +++++++++++++++++++++++++++++++++++-- pages/Makefile | 4 +++- pages/pageelems.ecpp | 1 + 4 files changed, 58 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index a0fd7c2..28e8bea 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,6 @@ PLUGIN = live ### The version number of this plugin (taken from the main source file): VERSION = $(shell grep '\#define LIVEVERSION ' setup.h | awk '{ print $$3 }' | sed -e 's/[";]//g') -VERSINFO= $(shell ./buildutil/version-util) ### The C++ compiler and options: @@ -58,7 +57,7 @@ ifneq ($(TNTVERS7),yes) LIBS += httpd/libhttpd.a endif -DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVERSION_SUFFIX='"$(VERSINFO)"' +DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' ifeq ($(TNTVERS7),yes) DEFINES += -DTNTVERS7 endif @@ -69,6 +68,8 @@ ifneq ($(TNTVERS7),yes) SUBDIRS += httpd endif +VERSIONSUFFIX = gen_version_suffix.h + ### The object files (add further files here): PLUGINOBJS = $(PLUGIN).o thread.o tntconfig.o setup.o i18n.o timers.o \ @@ -79,10 +80,10 @@ WEBLIBS = pages/libpages.a css/libcss.a javascript/libjavascript.a ### Default rules: -.PHONY: all dist clean SUBDIRS - all: libvdr-$(PLUGIN).so $(I18NTARG) +.PHONY: all dist clean subdirs $(SUBDIRS) PAGES + ### Implicit rules: %.o: %.cpp @@ -95,7 +96,9 @@ DEPFILE = .dependencies $(DEPFILE): Makefile @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(PLUGINOBJS:%.o=%.cpp) > $@ +ifneq ($(MAKECMDGOALS),clean) -include $(DEPFILE) +endif ### Internationalization (I18N): @@ -131,15 +134,18 @@ generate-i18n: i18n-template.h $(I18Npot) $(I18Npo) buildutil/pot2i18n.pl ### Targets: -SUBDIRS: - @for dir in $(SUBDIRS); do \ - make -C $$dir CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" || exit 1; \ - done +subdirs: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" $(MAKECMDGOALS) PAGES: - make -C pages CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" .dependencies || exit 1; + $(MAKE) -C pages CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" .dependencies + +$(VERSIONSUFFIX): FORCE + ./buildutil/version-util $(VERSIONSUFFIX) -libvdr-$(PLUGIN).so: SUBDIRS $(PLUGINOBJS) +libvdr-$(PLUGIN).so: $(VERSIONSUFFIX) $(SUBDIRS) $(PLUGINOBJS) $(CXX) $(LDFLAGS) -shared -o $@ $(PLUGINOBJS) -Wl,--whole-archive $(WEBLIBS) -Wl,--no-whole-archive $(LIBS) @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION) ifneq ($(TNTVERS7),yes) @@ -173,11 +179,10 @@ dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @echo Distribution package created as $(PACKAGE).tgz -clean: +clean: $(SUBDIRS) @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot @-rm -f $(PLUGINOBJS) $(DEPFILE) *.so *.tgz core* *~ - @for dir in $(SUBDIRS); do \ - make -C $$dir clean ; \ - done .PRECIOUS: $(I18Npo) + +FORCE: diff --git a/buildutil/version-util b/buildutil/version-util index 7e377ab..cf2aa31 100755 --- a/buildutil/version-util +++ b/buildutil/version-util @@ -10,6 +10,23 @@ # An indication if localy modified files exist is added. # ----------------------------------------------------------------------------- +[ $# -lt 1 ] && echo "USAGE: version-util " && exit 1 + +VERS_FILE=$1 + +function createVers () +{ +cat < /dev/null \ @@ -34,10 +51,26 @@ function gitVers () echo "_git_${b}_${h}" } +function checkVers () +{ + s=`$1` + if [ ! -e ${VERS_FILE} ]; then + echo "$VERS_FILE does not exist! creating a new one." + createVers $s > ${VERS_FILE} + else + v=`grep '^#define VERSION_SUFFIX' ${VERS_FILE} \ + | awk '{print $3}'` + if [ "$v" != "$s" ]; then + echo "$VERS_FILE is being recreated!" + createVers $s > ${VERS_FILE} + fi + fi +} + if [ -d CVS ]; then - cvsVers + checkVers cvsVers fi if [ -d .git ]; then - gitVers + checkVers gitVers fi diff --git a/pages/Makefile b/pages/Makefile index 11b7ebe..8f718fe 100644 --- a/pages/Makefile +++ b/pages/Makefile @@ -41,10 +41,12 @@ all: libpages.a MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies -$(DEPFILE): Makefile $(OBJS:%.o=%.cpp) $(OBJS:%.o=%.ecpp) +$(DEPFILE): Makefile $(OBJS:%.o=%.cpp) $(OBJS:%.o=%.ecpp) @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@ +ifneq ($(MAKECMDGOALS),clean) -include $(DEPFILE) +endif ### Targets: diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp index cd527cd..34cfbf8 100644 --- a/pages/pageelems.ecpp +++ b/pages/pageelems.ecpp @@ -9,6 +9,7 @@ #include "timers.h" #include "tools.h" #include "epg_events.h" +#include "gen_version_suffix.h" using namespace std; using namespace vdrlive; -- cgit v1.2.3 From 880ee6e7feb33daeb94c6a1195c8eb4202a570b0 Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Thu, 17 Jan 2008 00:22:07 +0100 Subject: Fixed some compile time problems with the version generation. --- .gitignore | 1 + Makefile | 1 + buildutil/version-util | 6 ++++-- pages/pageelems.ecpp | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c990521..020d64b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ CVS *.o *.a *.so +gen_version_suffix.h pages/*.cpp po/*.mo po/live.pot diff --git a/Makefile b/Makefile index 28e8bea..dfe8697 100644 --- a/Makefile +++ b/Makefile @@ -182,6 +182,7 @@ dist: clean clean: $(SUBDIRS) @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot @-rm -f $(PLUGINOBJS) $(DEPFILE) *.so *.tgz core* *~ + @-rm -f $(VERSIONSUFFIX) .PRECIOUS: $(I18Npo) diff --git a/buildutil/version-util b/buildutil/version-util index cf2aa31..f35d7f7 100755 --- a/buildutil/version-util +++ b/buildutil/version-util @@ -22,7 +22,7 @@ cat < ${VERS_FILE} fi diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp index 34cfbf8..a2fef4a 100644 --- a/pages/pageelems.ecpp +++ b/pages/pageelems.ecpp @@ -335,7 +335,7 @@ int update_status(1);
Michael Brückner (skiller2k1)
<$ tr("Information") $>
<$ tr("LIVE version") $>:
-
<$ LIVEVERSION $><$ VERSION_SUFFIX $>
+
<$ LIVEVERSION $><$ #VERSION_SUFFIX $>
<$ tr("VDR version") $>:
<$ VDRVERSION $>
<$ tr("Features") $>
-- cgit v1.2.3