diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-08-20 13:18:28 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-08-20 13:18:28 -0400 |
commit | 8285e73db76b916aff838c07bec9d77e245185b1 (patch) | |
tree | 47dc68d58ffee63a7b678164eb30986986e2be25 | |
parent | ed19064c465219fbe13f014a77c7624ef81913c9 (diff) | |
download | deheader-8285e73db76b916aff838c07bec9d77e245185b1.tar.gz deheader-8285e73db76b916aff838c07bec9d77e245185b1.tar.bz2 deheader-8285e73db76b916aff838c07bec9d77e245185b1.tar.xz deheader-8285e73db76b916aff838c07bec9d77e245185b1.zip |
Cope with a cmake idiosyncracy.
-rwxr-xr-x | deheader | 6 | ||||
-rw-r--r-- | deheader.xml | 8 |
2 files changed, 11 insertions, 3 deletions
@@ -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 |