summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasmin Jessich <jasmin@anw.at>2017-05-25 20:21:13 (GMT)
committerJasmin Jessich <jasmin@anw.at>2017-05-25 20:30:31 (GMT)
commit260f2cf0cb7b724c9ca3f662529e7b6bbb9cbbb6 (patch)
tree5b5775965847c369148065e7456a3a58c1d60a02
parent3e0774c0968dc38178cadb41558302c8a888b875 (diff)
downloadvdr-plugin-live-260f2cf0cb7b724c9ca3f662529e7b6bbb9cbbb6.tar.gz
vdr-plugin-live-260f2cf0cb7b724c9ca3f662529e7b6bbb9cbbb6.tar.bz2
Improve Makefile printing
- Added global.mk with common makefile print macros. Use VERBOSE=1 on the command line to show executed commands. - Removed recursion printing of make. - Suppress “nothing to be done for 'all'” message from make. - gen_version_suffix.h is now always created.
-rw-r--r--.gitignore2
-rw-r--r--Makefile37
-rw-r--r--css/Makefile15
-rw-r--r--global.mk38
-rw-r--r--javascript/Makefile15
-rw-r--r--pages/Makefile13
6 files changed, 97 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index 2ca3fe0..8d534ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,8 @@ CVS
*.so
gen_version_suffix.h
pages/*.cpp
+css/*.cpp
+javascript/*.cpp
po/*.mo
po/live.pot
.dependencies
diff --git a/Makefile b/Makefile
index aee7d25..090b6b6 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,8 @@ APIVERSION := $(call PKGCFG,apiversion)
### Allow user defined options to overwrite defaults:
-include $(PLGCFG)
+include global.mk
+
### Determine tntnet and cxxtools versions:
TNTVERSION = $(shell tntnet-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }')
CXXTOOLVER = $(shell cxxtools-config --version | sed -e's/\.//g' | sed -e's/pre.*//g' | awk '/^..$$/ { print $$1."000"} /^...$$/ { print $$1."00"} /^....$$/ { print $$1."0" } /^.....$$/ { print $$1 }')
@@ -96,19 +98,21 @@ SUBDIRS := $(WEB_DIR_PAGES) $(WEB_DIR_CSS) $(WEB_DIR_JAVA)
### The main target:
.PHONY: all
all: lib i18n
+ @true
### Implicit rules:
$(WEB_DIR_PAGES)/%.o: $(WEB_DIR_PAGES)/%.cpp $(WEB_DIR_PAGES)/%.ecpp
- @$(MAKE) -C $(WEB_DIR_PAGES) PLUGINFEATURES="$(PLUGINFEATURES)" $(notdir $@)
+ @$(MAKE) -C $(WEB_DIR_PAGES) --no-print-directory PLUGINFEATURES="$(PLUGINFEATURES)" $(notdir $@)
$(WEB_DIR_CSS)/%.o:
- @$(MAKE) -C $(WEB_DIR_CSS) PLUGINFEATURES="$(PLUGINFEATURES)" $(notdir $@)
+ @$(MAKE) -C $(WEB_DIR_CSS) --no-print-directory PLUGINFEATURES="$(PLUGINFEATURES)" $(notdir $@)
$(WEB_DIR_JAVA)/%.o:
- @$(MAKE) -C $(WEB_DIR_JAVA) PLUGINFEATURES="$(PLUGINFEATURES)" $(notdir $@)
+ @$(MAKE) -C $(WEB_DIR_JAVA) --no-print-directory PLUGINFEATURES="$(PLUGINFEATURES)" $(notdir $@)
%.o: %.cpp
- $(CXX) $(CXXFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
+ $(call PRETTY_PRINT,"CC" $@)
+ $(Q)$(CXX) $(CXXFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
### Dependencies:
MAKEDEP = $(CXX) -MM -MG
@@ -123,7 +127,7 @@ endif
### For all recursive Targets:
recursive-%:
- @$(MAKE) $*
+ @$(MAKE) --no-print-directory $*
### Internationalization (I18N):
PODIR := po
@@ -134,10 +138,12 @@ I18Npot := $(PODIR)/$(PLUGIN).pot
I18Npot_deps = $(PLUGINSRCS) $(wildcard $(WEB_DIR_PAGES)/*.cpp) setup.h epg_events.h
$(I18Npot): $(I18Npot_deps)
- xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --omit-header -o $@ $(I18Npot_deps)
+ $(call PRETTY_PRINT,"GT" $@)
+ $(Q)xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --omit-header -o $@ $(I18Npot_deps)
.PHONY: I18Nmo
I18Nmo: $(I18Nmo)
+ @true
%.mo: %.po
$(if $(DISABLE_I18Nmo_txt),,@echo "Creating *.mo")
@@ -157,6 +163,7 @@ $(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
.PHONY: inst_I18Nmsg
inst_I18Nmsg: $(I18Nmsgs)
+ @true
# When building in parallel, this will tell make to keep an order in the steps
recursive-I18Nmo: subdirs
@@ -172,9 +179,7 @@ install-i18n: i18n recursive-inst_I18Nmsg
$(VERSIONSUFFIX): FORCE
ifneq ($(MAKECMDGOALS),clean)
-ifeq ($(MAKELEVEL),$(filter $(MAKELEVEL),0 1))
- ./buildutil/version-util $(VERSIONSUFFIX) || ./buildutil/version-util -F $(VERSIONSUFFIX)
-endif
+ @./buildutil/version-util $(VERSIONSUFFIX) || ./buildutil/version-util -F $(VERSIONSUFFIX)
endif
.PHONY: subdirs $(SUBDIRS)
@@ -182,16 +187,18 @@ subdirs: $(SUBDIRS)
$(SUBDIRS):
ifneq ($(MAKECMDGOALS),clean)
- @$(MAKE) -C $@ PLUGINFEATURES="$(PLUGINFEATURES)" all
+ @$(MAKE) -C $@ --no-print-directory PLUGINFEATURES="$(PLUGINFEATURES)" all
else
- @$(MAKE) -C $@ clean
+ @$(MAKE) -C $@ --no-print-directory clean
endif
$(SOFILE): $(PLUGINOBJS) $(WEBLIBS)
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(PLUGINOBJS) -Wl,--whole-archive $(WEBLIBS) -Wl,--no-whole-archive $(LIBS) -o $@
+ $(call PRETTY_PRINT,"LD" $@)
+ $(Q)$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(PLUGINOBJS) -Wl,--whole-archive $(WEBLIBS) -Wl,--no-whole-archive $(LIBS) -o $@
.PHONY: sofile
sofile: $(SOFILE)
+ @true
# When building in parallel, this will tell make to keep an order in the steps
recursive-sofile: subdirs
@@ -207,7 +214,8 @@ lib: $(VERSIONSUFFIX) subdirs $(PLUGINOBJS) recursive-sofile
soinst: $(SOINST)
$(SOINST): $(SOFILE)
- install -D $< $@
+ $(call PRETTY_PRINT,"Installing" $<)
+ $(Q)install -D $< $@
.PHONY: install-lib
install-lib: lib recursive-soinst
@@ -217,7 +225,7 @@ install: install-lib install-i18n
.PHONY: dist
dist: $(I18Npo)
- $(MAKE) clean
+ $(MAKE) --no-print-directory clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE)
@@ -227,6 +235,7 @@ dist: $(I18Npo)
.PHONY: clean
clean: subdirs
+ $(call PRETTY_PRINT,"CLN top")
@-rm -f $(I18Nmo) $(I18Npot)
@-rm -f $(PLUGINOBJS) $(DEPFILE) *.so *.tgz core* *~
@-rm -f $(VERSIONSUFFIX)
diff --git a/css/Makefile b/css/Makefile
index 0411b30..9655703 100644
--- a/css/Makefile
+++ b/css/Makefile
@@ -11,22 +11,31 @@ INCLUDES += -I$(VDRDIR)/include -I..
OBJS := styles.o
SRCS := $(patsubst %.o,%.cpp,$(OBJS))
+include ../global.mk
+
### The main target:
all: libcss.a
+ @true
### Implicit rules:
%.o: %.cpp
- $(CXX) $(CXXFLAGS) $(TNTFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
+ $(call PRETTY_PRINT,"CC css/" $@)
+ $(Q)$(CXX) $(CXXFLAGS) $(TNTFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
%.cpp: %.css
- $(ECPPC) $(ECPPFLAGS) $(ECPPFLAGS_CSS) -b -m "text/css" $<
+ $(call PRETTY_PRINT,"ECPP css/" $@)
+ $(Q)$(ECPPC) $(ECPPFLAGS) $(ECPPFLAGS_CSS) -b -m "text/css" $<
### Targets:
libcss.a: $(OBJS)
- $(AR) r $@ $^
+ $(call PRETTY_PRINT,"AR css/" $@)
+ $(Q)$(AR) r $@ $^ $(AR_NUL)
clean:
+ $(call PRETTY_PRINT,"CLN css/")
@rm -f *~ *.o core* libcss.a $(SRCS)
dist: clean
@echo "Nothing to do for distribution here ..."
+
+.PRECIOUS: $(SRCS)
diff --git a/global.mk b/global.mk
new file mode 100644
index 0000000..1c74f37
--- /dev/null
+++ b/global.mk
@@ -0,0 +1,38 @@
+#
+# Add macros and definitions which shall be available for all Makefiles
+# This might be added to VDR main directory in the future
+
+# build mode (0 - non-verbose, 1 - verbose)
+VERBOSE ?= 0
+
+# Desplay percentage (0 - no percentage, 1 - print xxx% (not 100% accurate!))
+#WITH_PERCENT ?= 0
+# does not work currently
+override WITH_PERCENT := 0
+
+# pretty print macros
+
+ifeq ($(WITH_PERCENT),1)
+ ifndef ECHO
+ I := i
+ TARGET_COUNTER = $(words $(I)) $(eval I += i)
+ TOTAL_TARGETS := $(shell $(MAKE) $(MAKECMDGOALS) --dry-run --file=$(firstword $(MAKEFILE_LIST)) \
+ --no-print-directory --no-builtin-rules --no-builtin-variables ECHO="COUNTTHIS" | grep -c "COUNTTHIS")
+ ECHO = echo "[$(shell expr " $(shell echo $$((${TARGET_COUNTER} * 100 / ${TOTAL_TARGETS})))" : '.*\(...\)$$')%]"
+ endif
+else
+ ECHO = echo
+endif
+
+ifeq ($(VERBOSE),0)
+ # Have a look to the VDR Makefile hw to use these macros in Plugins.
+
+ Q = @
+ PRETTY_PRINT = @$(ECHO) $(1)
+ AR_NUL = > /dev/null 2>&1
+else
+ Q =
+ PRETTY_PRINT =
+ AR_NUL =
+endif
+
diff --git a/javascript/Makefile b/javascript/Makefile
index 08f0ad7..5465c3c 100644
--- a/javascript/Makefile
+++ b/javascript/Makefile
@@ -11,22 +11,31 @@ INCLUDES += -I$(VDRDIR)/include -I..
OBJS := treeview.o
SRCS := $(patsubst %.o,%.cpp,$(OBJS))
+include ../global.mk
+
### The main target:
all: libjavascript.a
+ @true
### Implicit rules:
%.o: %.cpp
- $(CXX) $(CXXFLAGS) $(TNTFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
+ $(call PRETTY_PRINT,"CC javascript/" $@)
+ $(Q)$(CXX) $(CXXFLAGS) $(TNTFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
%.cpp: %.js
- $(ECPPC) $(ECPPFLAGS) $(ECPPFLAGS_JS) -b -m "text/javascript" $<
+ $(call PRETTY_PRINT,"ECPP javascript/" $@)
+ $(Q)$(ECPPC) $(ECPPFLAGS) $(ECPPFLAGS_JS) -b -m "text/javascript" $<
### Targets:
libjavascript.a: $(OBJS)
- $(AR) r $@ $^
+ $(call PRETTY_PRINT,"AR javascript/" $@)
+ $(Q)$(AR) r $@ $^ $(AR_NUL)
clean:
+ $(call PRETTY_PRINT,"CLN javascript/")
@rm -f *~ *.o core* libjavascript.a $(SRCS)
dist: clean
@echo "Nothing to do for distribution here ..."
+
+.PRECIOUS: $(SRCS)
diff --git a/pages/Makefile b/pages/Makefile
index 018f256..ae0710e 100644
--- a/pages/Makefile
+++ b/pages/Makefile
@@ -20,16 +20,21 @@ SRCS := $(patsubst %.o,%.cpp,$(OBJS))
ESRCS := $(patsubst %.o,%.ecpp,$(OBJS))
ESRCS_DEPS := $(patsubst %.o,.%.edep,$(OBJS))
+include ../global.mk
+
### The main target:
all: libpages.a
+ @true
### Implicit rules:
%.o: %.cpp
- $(CXX) $(CXXFLAGS) $(TNTFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
+ $(call PRETTY_PRINT,"CC pages/" $@)
+ $(Q)$(CXX) $(CXXFLAGS) $(TNTFLAGS) -c $(DEFINES) $(PLUGINFEATURES) $(INCLUDES) $<
%.cpp: %.ecpp
- $(ECPPC) $(ECPPFLAGS) $(ECPPFLAGS_CPP) $<
+ $(call PRETTY_PRINT,"ECPP pages/" $@)
+ $(Q)$(ECPPC) $(ECPPFLAGS) $(ECPPFLAGS_CPP) $<
.%.edep: %.ecpp
@$(ECPPC) -M $(ECPPFLAGS) $(ECPPFLAGS_CPP) $< > $@
@@ -47,9 +52,11 @@ endif
### Targets:
libpages.a: $(OBJS)
- $(AR) r $@ $^
+ $(call PRETTY_PRINT,"AR pages/" $@)
+ $(Q)$(AR) r $@ $^ $(AR_NUL)
clean:
+ $(call PRETTY_PRINT,"CLN pages/")
@rm -f *~ *.o core* libpages.a $(SRCS) $(DEPFILE) $(ESRCS_DEPS)
dist: clean