Commit 99400dfe authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make vmodtool leave output files alone if unchanged.

This prevents unecessary docs builds.
However, we do need to touch the *if.c mtime, otherwise a
doc-only change will cause vmodtool to run on every make afterwards.

Relevant to: #3901
parent 3f0e12ad
......@@ -76,8 +76,11 @@ $(libvmod_XXX_la_OBJECTS): PFX.h
PFX.h vmod_XXX.rst vmod_XXX.man.rst: PFX.c
# A doc-change will not update mtime on the .h and .c files, so a
# touch(1) is necessary to signal that vmodtool was in fact run.
PFX.c: $(vmodtool) $(srcdir)/VCC
\t@PYTHON@ $(vmodtool) $(vmodtoolargs_XXX) $(srcdir)/VCC
\ttouch PFX.c
clean-local: clean-vmod-XXX
......@@ -924,7 +927,15 @@ class vcc():
def commit(self):
for i in self.commit_files:
os.rename(i + ".tmp", i)
try:
before = open(i, "rb").read()
except:
before = None
after = open(i + ".tmp", "rb").read()
if before != after:
os.rename(i + ".tmp", i)
else:
os.remove(i + ".tmp")
def parse(self):
global inputline
......
......@@ -32,8 +32,11 @@ $(libvmod_blob_la_OBJECTS): vcc_blob_if.h
vcc_blob_if.h vmod_blob.rst vmod_blob.man.rst: vcc_blob_if.c
# A doc-change will not update mtime on the .h and .c files, so a
# touch(1) is necessary to signal that vmodtool was in fact run.
vcc_blob_if.c: $(vmodtool) $(srcdir)/vmod_blob.vcc
@PYTHON@ $(vmodtool) $(vmodtoolargs_blob) $(srcdir)/vmod_blob.vcc
touch vcc_blob_if.c
clean-local: clean-vmod-blob
......
......@@ -25,8 +25,11 @@ $(libvmod_cookie_la_OBJECTS): vcc_cookie_if.h
vcc_cookie_if.h vmod_cookie.rst vmod_cookie.man.rst: vcc_cookie_if.c
# A doc-change will not update mtime on the .h and .c files, so a
# touch(1) is necessary to signal that vmodtool was in fact run.
vcc_cookie_if.c: $(vmodtool) $(srcdir)/vmod_cookie.vcc
@PYTHON@ $(vmodtool) $(vmodtoolargs_cookie) $(srcdir)/vmod_cookie.vcc
touch vcc_cookie_if.c
clean-local: clean-vmod-cookie
......
......@@ -28,8 +28,11 @@ $(libvmod_debug_la_OBJECTS): vcc_debug_if.h
vcc_debug_if.h vmod_debug.rst vmod_debug.man.rst: vcc_debug_if.c
# A doc-change will not update mtime on the .h and .c files, so a
# touch(1) is necessary to signal that vmodtool was in fact run.
vcc_debug_if.c: $(vmodtool) $(srcdir)/vmod_debug.vcc
@PYTHON@ $(vmodtool) $(vmodtoolargs_debug) $(srcdir)/vmod_debug.vcc
touch vcc_debug_if.c
clean-local: clean-vmod-debug
......
......@@ -35,8 +35,11 @@ $(libvmod_directors_la_OBJECTS): vcc_directors_if.h
vcc_directors_if.h vmod_directors.rst vmod_directors.man.rst: vcc_directors_if.c
# A doc-change will not update mtime on the .h and .c files, so a
# touch(1) is necessary to signal that vmodtool was in fact run.
vcc_directors_if.c: $(vmodtool) $(srcdir)/vmod_directors.vcc
@PYTHON@ $(vmodtool) $(vmodtoolargs_directors) $(srcdir)/vmod_directors.vcc
touch vcc_directors_if.c
clean-local: clean-vmod-directors
......
......@@ -25,8 +25,11 @@ $(libvmod_proxy_la_OBJECTS): vcc_proxy_if.h
vcc_proxy_if.h vmod_proxy.rst vmod_proxy.man.rst: vcc_proxy_if.c
# A doc-change will not update mtime on the .h and .c files, so a
# touch(1) is necessary to signal that vmodtool was in fact run.
vcc_proxy_if.c: $(vmodtool) $(srcdir)/vmod_proxy.vcc
@PYTHON@ $(vmodtool) $(vmodtoolargs_proxy) $(srcdir)/vmod_proxy.vcc
touch vcc_proxy_if.c
clean-local: clean-vmod-proxy
......
......@@ -25,8 +25,11 @@ $(libvmod_purge_la_OBJECTS): vcc_purge_if.h
vcc_purge_if.h vmod_purge.rst vmod_purge.man.rst: vcc_purge_if.c
# A doc-change will not update mtime on the .h and .c files, so a
# touch(1) is necessary to signal that vmodtool was in fact run.
vcc_purge_if.c: $(vmodtool) $(srcdir)/vmod_purge.vcc
@PYTHON@ $(vmodtool) $(vmodtoolargs_purge) $(srcdir)/vmod_purge.vcc
touch vcc_purge_if.c
clean-local: clean-vmod-purge
......
......@@ -28,8 +28,11 @@ $(libvmod_std_la_OBJECTS): vcc_std_if.h
vcc_std_if.h vmod_std.rst vmod_std.man.rst: vcc_std_if.c
# A doc-change will not update mtime on the .h and .c files, so a
# touch(1) is necessary to signal that vmodtool was in fact run.
vcc_std_if.c: $(vmodtool) $(srcdir)/vmod_std.vcc
@PYTHON@ $(vmodtool) $(vmodtoolargs_std) $(srcdir)/vmod_std.vcc
touch vcc_std_if.c
clean-local: clean-vmod-std
......
......@@ -26,8 +26,11 @@ $(libvmod_unix_la_OBJECTS): vcc_unix_if.h
vcc_unix_if.h vmod_unix.rst vmod_unix.man.rst: vcc_unix_if.c
# A doc-change will not update mtime on the .h and .c files, so a
# touch(1) is necessary to signal that vmodtool was in fact run.
vcc_unix_if.c: $(vmodtool) $(srcdir)/vmod_unix.vcc
@PYTHON@ $(vmodtool) $(vmodtoolargs_unix) $(srcdir)/vmod_unix.vcc
touch vcc_unix_if.c
clean-local: clean-vmod-unix
......
......@@ -25,8 +25,11 @@ $(libvmod_vtc_la_OBJECTS): vcc_vtc_if.h
vcc_vtc_if.h vmod_vtc.rst vmod_vtc.man.rst: vcc_vtc_if.c
# A doc-change will not update mtime on the .h and .c files, so a
# touch(1) is necessary to signal that vmodtool was in fact run.
vcc_vtc_if.c: $(vmodtool) $(srcdir)/vmod_vtc.vcc
@PYTHON@ $(vmodtool) $(vmodtoolargs_vtc) $(srcdir)/vmod_vtc.vcc
touch vcc_vtc_if.c
clean-local: clean-vmod-vtc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment