summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-08-20 13:18:28 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-08-20 13:18:28 -0400
commit8285e73db76b916aff838c07bec9d77e245185b1 (patch)
tree47dc68d58ffee63a7b678164eb30986986e2be25
parented19064c465219fbe13f014a77c7624ef81913c9 (diff)
downloaddeheader-8285e73db76b916aff838c07bec9d77e245185b1.tar.gz
deheader-8285e73db76b916aff838c07bec9d77e245185b1.tar.bz2
deheader-8285e73db76b916aff838c07bec9d77e245185b1.tar.xz
deheader-8285e73db76b916aff838c07bec9d77e245185b1.zip
Cope with a cmake idiosyncracy.
-rwxr-xr-xdeheader6
-rw-r--r--deheader.xml8
2 files changed, 11 insertions, 3 deletions
diff --git a/deheader b/deheader
index 0d66ed4..f328ef8 100755
--- a/deheader
+++ b/deheader
@@ -30,7 +30,7 @@ on interrupt or after processing with its original timestamp, unless the
The last line of the output is a statistical summary of operations.
"""
-import sys, os, getopt, time, re, operator, commands
+import sys, os, getopt, time, re, operator, commands, subprocess
BATON_DEBUG = 1
PROGRESS_DEBUG = 2
@@ -1359,6 +1359,8 @@ def testcompile(source, maker, msg="", verbosity=0, showerrs=False):
derived = stem + ".o"
if os.path.exists(derived):
os.remove(derived)
+ elif os.path.exists("CMakeList.txt"):
+ subprocess.call(["make","clean"])
command = maker + " " + derived
start = time.time()
(status, output) = commands.getstatusoutput(command)
@@ -1375,6 +1377,8 @@ def testcompile(source, maker, msg="", verbosity=0, showerrs=False):
print "deheader: %s%s %s." % (source, msg, explain)
if os.path.exists(derived):
os.remove(derived)
+ elif os.path.exists("CMakeList.txt"):
+ subprocess.call(["make","clean"])
return (status, end - start)
def c_analyze(sourcefile, maker, includes, requires, verbosity):
diff --git a/deheader.xml b/deheader.xml
index c375279..2ade657 100644
--- a/deheader.xml
+++ b/deheader.xml
@@ -36,10 +36,14 @@
<para>This tool takes a list of C or C++ sourcefiles and generates a
report on which #includes can be omitted from them; also, what
standard inclusions may be required for portability. The test, for
-each foo.c or foo.cc or foo.cpp, is simply whether 'rm foo.o; make
-foo.o' returns a zero status (but the build command may be
+each foo.c or foo.cc or foo.cpp, is simply whether "rm foo.o; make
+foo.o" returns a zero status (but the build command may be
overridden).</para>
+<para>Exception: Under cmake, foo.o is a phoney target. Therefore,
+when a "CMakeList.txt" is detected, "make clean" is done rather than
+"rm foo.o".</para>
+
<para>Optionally, with the <option>-r</option> switch, the
unneeded headers are removed from the sourcefiles. Don't use
this option unless you have your sourcefiles safely under version