[gtk-doc] make: check if date can format dates
- From: Stefan Kost <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] make: check if date can format dates
- Date: Fri, 14 Feb 2014 09:06:43 +0000 (UTC)
commit a5155312facec5859c51a9448688e6aa792e6747
Author: Stefan Sauer <ensonic users sf net>
Date: Fri Feb 14 10:04:41 2014 +0100
make: check if date can format dates
Don't use date to format date-stamps in tests unless it is supported.
Fixes #671519
configure.ac | 14 ++++++++++++++
tests/gtk-doc.make | 18 +++++++++---------
tests/gtk-doc.notmpl.make | 16 ++++++++--------
3 files changed, 31 insertions(+), 17 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b699568..0b8e750 100644
--- a/configure.ac
+++ b/configure.ac
@@ -210,17 +210,31 @@ fi
AC_SUBST(TRACE)
dnl check what date format we can use for the makefile tracing in tests
+AC_MSG_CHECKING(whether date can output nanoseconds)
date +%s.%N | grep -q '%N'
if test "$?" == "1"; then
TS_FMT="+%s.%N"
ELAPSED_FMT="+%H:%M:%S.%N"
+ AC_MSG_RESULT(yes)
else
TS_FMT="+%s.0"
ELAPSED_FMT="+%H:%M:%S"
+ AC_MSG_RESULT(no)
fi
AC_SUBST(TS_FMT)
AC_SUBST(ELAPSED_FMT)
+AC_MSG_CHECKING(whether date can format dates)
+date >/dev/null 2>&1 --utc --date @1.1 $ELAPSED_FMT
+if test "$?" == "0"; then
+ DATE_FMT_CMD="date --utc $ELAPSED_FMT --date @0"
+ AC_MSG_RESULT(yes)
+else
+ DATE_FMT_CMD="echo "
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST(DATE_FMT_CMD)
+
dnl
dnl Documentation
dnl
diff --git a/tests/gtk-doc.make b/tests/gtk-doc.make
index 8c16651..8cb070c 100644
--- a/tests/gtk-doc.make
+++ b/tests/gtk-doc.make
@@ -54,11 +54,11 @@ CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
check-local: html-build.stamp pdf-build.stamp
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: All done"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: All done"
docs: html-build.stamp pdf-build.stamp
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: All done"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: All done"
$(REPORT_FILES): sgml-build.stamp
@@ -87,7 +87,7 @@ setup-build.stamp: ts
scan-build.stamp: ts setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Scanning header files"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Scanning header files"
@_source_dir='' ; \
for i in $(DOC_SOURCE_DIR) ; do \
_source_dir="$${_source_dir} --source-dir=$$i" ; \
@@ -97,7 +97,7 @@ scan-build.stamp: ts setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir}
$(SCAN_OPTIONS) $(EXTRA_HFILES) 2>&1 | tee -a gtkdoc-scan.log
@if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Introspecting gobjects"; \
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Introspecting gobjects"; \
scanobj_options=""; \
if test "x$(V)" = "x1"; then \
scanobj_options="--verbose"; \
@@ -120,7 +120,7 @@ $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)
tmpl-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt
$(DOC_MODULE)-overrides.txt
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Rebuilding template files"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Rebuilding template files"
@echo "gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)" >gtkdoc-mktmpl.log; \
PATH=$(abs_top_builddir):$(PATH) PERL5LIB=$(abs_top_builddir):$(PERL5LIB) \
gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) 2>&1 | tee -a gtkdoc-mktmpl.log
@@ -141,7 +141,7 @@ $(srcdir)/tmpl/*.sgml:
sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files)
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Building XML"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Building XML"
@_source_dir='' ; \
for i in $(DOC_SOURCE_DIR) ; do \
_source_dir="$${_source_dir} --source-dir=$$i" ; \
@@ -158,7 +158,7 @@ sgml.stamp: sgml-build.stamp
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @00$$tsd $(ELAPSED_FMT)`: Building HTML"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Building HTML"
@rm -rf html
@mkdir html
@mkhtml_options=""; \
@@ -178,7 +178,7 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
fi; \
done;
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Fixing cross-references"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Fixing cross-references"
@echo "gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR)
$(FIXXREF_OPTIONS)" >gtkdoc-fixxref.log; \
PATH=$(abs_top_builddir):$(PATH) PERL5LIB=$(abs_top_builddir):$(PERL5LIB) \
gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
2>&1 | tee -a gtkdoc-fixxref.log
@@ -188,7 +188,7 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Building PDF"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Building PDF"
@rm -f $(DOC_MODULE).pdf
@mkpdf_options=""; \
if test "x$(V)" = "x1"; then \
diff --git a/tests/gtk-doc.notmpl.make b/tests/gtk-doc.notmpl.make
index b4f2994..f9a8343 100644
--- a/tests/gtk-doc.notmpl.make
+++ b/tests/gtk-doc.notmpl.make
@@ -54,11 +54,11 @@ CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
check-local: html-build.stamp pdf-build.stamp
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: All done"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: All done"
docs: html-build.stamp pdf-build.stamp
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: All done"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: All done"
$(REPORT_FILES): sgml-build.stamp
@@ -84,7 +84,7 @@ setup-build.stamp: ts
scan-build.stamp: ts setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Scanning header files"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Scanning header files"
@_source_dir='' ; \
for i in $(DOC_SOURCE_DIR) ; do \
_source_dir="$${_source_dir} --source-dir=$$i" ; \
@@ -94,7 +94,7 @@ scan-build.stamp: ts setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir}
$(SCAN_OPTIONS) $(EXTRA_HFILES) 2>&1 | tee -a gtkdoc-scan.log
@if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Introspecting gobjects"; \
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Introspecting gobjects"; \
scanobj_options=""; \
if test "x$(V)" = "x1"; then \
scanobj_options="--verbose"; \
@@ -117,7 +117,7 @@ $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)
sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt
$(DOC_MODULE)-overrides.txt $(expand_content_files)
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Building XML"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Building XML"
@_source_dir='' ; \
for i in $(DOC_SOURCE_DIR) ; do \
_source_dir="$${_source_dir} --source-dir=$$i" ; \
@@ -134,7 +134,7 @@ sgml.stamp: sgml-build.stamp
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @00$$tsd $(ELAPSED_FMT)`: Building HTML"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Building HTML"
@rm -rf html
@mkdir html
@mkhtml_options=""; \
@@ -154,7 +154,7 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
fi; \
done;
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Fixing cross-references"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Fixing cross-references"
@echo "gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR)
$(FIXXREF_OPTIONS)" >gtkdoc-fixxref.log; \
PATH=$(abs_top_builddir):$(PATH) PERL5LIB=$(abs_top_builddir):$(PERL5LIB) \
gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
2>&1 | tee -a gtkdoc-fixxref.log
@@ -164,7 +164,7 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
@ts1=`cat ts`;ts2=`date $(TS_FMT)`;tsd=`echo $$ts2-$$ts1 | bc`; \
- echo " DOC `date --utc --date @0$$tsd $(ELAPSED_FMT)`: Building PDF"
+ echo " DOC `$(DATE_FMT_CMD)$$tsd`: Building PDF"
@rm -f $(DOC_MODULE).pdf
@mkpdf_options=""; \
if test "x$(V)" = "x1"; then \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]