1.1 --- a/Makefile Sat Dec 29 11:30:38 2007 +0100
1.2 +++ b/Makefile Sat Dec 29 13:19:16 2007 +0100
1.3 @@ -24,9 +24,10 @@
1.4 #
1.5 PLUGIN = premiereepg
1.6
1.7 -### The version number of this plugin (taken from the main source file):
1.8 +### The version number of this plugin:
1.9
1.10 -VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
1.11 +RELEASE := $(shell grep 'define PLUGIN_RELEASE' version.h | awk '{ print $$3 }' | sed -e 's/[";]//g')
1.12 +VERSION := $(shell if test -d .hg; then echo -n '$(RELEASE)-'; (hg identify 2>/dev/null || echo -n Unknown) | sed -e 's/ .*//'; else echo -n '$(RELEASE)'; fi)
1.13
1.14 ### The C++ compiler and options:
1.15
1.16 @@ -42,11 +43,12 @@
1.17 ### Allow user defined options to overwrite defaults:
1.18
1.19 -include $(VDRDIR)/Make.config
1.20 +-include Make.config
1.21
1.22 ### The version number of VDR (taken from VDR's "config.h"):
1.23
1.24 -VDRVERSION = $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
1.25 -APIVERSION = $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
1.26 +VDRVERSION := $(shell sed -ne '/define VDRVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
1.27 +APIVERSION := $(shell sed -ne '/define APIVERSION/ s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
1.28 ifeq ($(strip $(APIVERSION)),)
1.29 APIVERSION = $(VDRVERSION)
1.30 endif
1.31 @@ -64,7 +66,7 @@
1.32
1.33 ### The object files (add further files here):
1.34
1.35 -OBJS = $(PLUGIN).o
1.36 +OBJS = $(PLUGIN).o version.o
1.37
1.38 ifdef DBG
1.39 CXXFLAGS += -g
1.40 @@ -81,8 +83,9 @@
1.41
1.42 MAKEDEP = $(CXX) -MM -MG
1.43 DEPFILE = .dependencies
1.44 -$(DEPFILE): Makefile
1.45 - @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
1.46 +DEPFILES = $(subst version.c,,$(OBJS:%.o=%.c) $(OBJS2:%.o=%.c))
1.47 +$(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h)
1.48 + @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@
1.49
1.50 -include $(DEPFILE)
1.51
1.52 @@ -119,6 +122,13 @@
1.53
1.54 i18n: $(I18Nmsgs)
1.55
1.56 +version.c: FORCE
1.57 + @echo >$@.new "/* this file will be overwritten without warning */"; \
1.58 + echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \
1.59 + diff $@.new $@ >$@.diff 2>&1; \
1.60 + if test -s $@.diff; then mv -f $@.new $@; fi; \
1.61 + rm -f $@.new $@.diff;
1.62 +
1.63 dist: clean
1.64 @-rm -rf $(TMPDIR)/$(ARCHIVE)
1.65 @mkdir $(TMPDIR)/$(ARCHIVE)
1.66 @@ -129,4 +139,7 @@
1.67
1.68 clean:
1.69 @-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~
1.70 - @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
1.71 + @-rm -f version.c
1.72 + @-rm -f $(PODIR)/*.mo
1.73 +
1.74 +FORCE: