fastdep-0.16/0040700000175000007640000000000007747773372010533 5ustar bvhfastdep-0.16/Makefile0100644000175000007640000000351607613335324012166 0ustar bvhall: fastdep include config/config.me include build/project.mk include build/dependencies.mk include build/release.mk include build/gnugetopt.mk include Makefile.common ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),distclean) -include .depends-all endif endif BINARY=fastdep CLASSES=$(foreach group,$(GROUPS),$($(call classgroup,fastdep,$(group)))) SOURCES=$(addsuffix .cc,$(CLASSES)) OBJECTS=$(SOURCES:.cc=.o) OBJECTS+=$(BUILDSOURCES:.c=.o) CFLAGS+=-Wall $(foreach include,$(INCLUDEDIRS),-I $(include)) $(OBJECTS): config/config.me $(ALLMAKEFILES) $(BINARY): $(OBJECTS) $(ALLMAKEFILES) g++ $(CFLAGS) $(CXXFLAGS) -o $(BINARY) $(OBJECTS) # Here is a trick on how to get fastdep linking on older cygwins. # It's probably also needed to get it working on VC 6.0. # However, since I am still reworking the build environment for now, # this is left unmerged. #ifeq ($(HOST_SYSTEM),cygwin) # $(foreach file, $(OBJECTS), $(shell echo $(file) >> linkfiles)) # g++ $(CFLAGS) $(CXXFLAGS) -o $(BINARY) @linkfiles # -rm -f linkfiles #endif .cc.o: $(ALLMAKEFILES) g++ $(CFLAGS) $(CXXFLAGS) -c $< -o $@ clean: -rm -f $(OBJECTS) $(BINARY) .depends-all distclean: -rm -f $(OBJECTS) $(BINARY) .depends-all config/config.me #$(DEPENDS): $(SOURCES) $(MAKEFILE) #ifeq ($(HOST_SYSTEM),cygwin) # $(foreach file, $(SOURCES), $(shell echo $(file) >> fastdepfiles)) # $(BINARY) -o $(DEPENDS) @fastdepfiles > $(DEPENDS) # -rm -f fastdepfiles #else # ./$(BINARY) -o $(DEPENDS) $(SOURCES) # $(call depend_dir) # $(call depend_dir_test) #endif #include $(DEPENDS) #$(DEPENDS): Makefile.real .depends-%: $(call generate-depends) config/config.me: @echo -e "You must run ./configure first to create config/config.me." @echo -e "Use ./configure --help to get information on how to guide the configuration." @echo -e "The make process will now exit with an error." @exit 1 fastdep-0.16/CheckVersion.h0100644000175000007640000000034207747772341013270 0ustar bvh#ifndef CHECKVERSION_3DBA9B36642F541B_H_ #define CHECKVERSION_3DBA9B36642F541B_H_ #define FASTDEP_VERSION_MAJOR 0 #define FASTDEP_VERSION_MINOR 16 #include int atLeastVersion(const std::string& aVersion); #endif fastdep-0.16/CompileState.h0100644000175000007640000000156507570751666013307 0ustar bvh#ifndef COMPILESTATE_H_ #define COMPILESTATE_H_ #include #include class CompileState { public: CompileState(const std::string& aBase); CompileState(const CompileState& anOther); virtual ~CompileState(); CompileState& operator=(const CompileState& anOther); void addDependencies(const std::string& aString); std::string getDependenciesLine() const; void define(const std::string& aString, const std::string& aContent); void undef(const std::string& aString); bool isDefined(const std::string& aString) const; std::string getContent(const std::string& aName) const; void dump() const; void mergeDeps(std::vector& aDepLine); void inDebugMode(); private: std::vector Dependencies; std::string Basedir; std::vector Defines; std::vector Contents; bool DebugMode; }; #endif fastdep-0.16/FileStructure.cc0100644000175000007640000002313407747773130013644 0ustar bvh#include "FileStructure.h" #include "CompileState.h" #include "Define.h" #include "Include.h" #include "Sequence.h" #include "FileCache.h" #include "If.h" #include #define GETNEXT { ++Cursor; if (Cursor >= aLength) break; } #define CURRENT (aFile[Cursor]) #define ON(c,label) { if ( aFile[Cursor] == c ) goto label; } #define ONEOL(label) ON('\r',label) ON('\n',label) #define ONWS(label) ON(' ',label) ON('\t',label) #define ONNOT(c,label) { if (aFile[Cursor] != c) goto label; } #define SKIPON(c,label) { if (aFile[Cursor] == c) { ++Cursor; goto label; } } FileStructure::FileStructure(const std::string& aFilename, FileCache* aCache, const char* aFile, unsigned int aLength) : ResolvedName(aFilename), Main(0), Current(0), Cache(aCache) { Current = Main = new Sequence(this); std::string IncludeFilename; std::string DefineName; std::string DefineParam; std::string DefineBody; std::string Symbol; if (aLength == 0) return; unsigned int Cursor = 0; for (;;) { ON('#',begin_preprocessor) ON(' ',from_begin_of_line) ON('\t',from_begin_of_line) ONEOL(from_begin_of_line) ON('/',begin_comment_empty_line) ON('"',string) ON('\'',singlechar) goto scan_end_of_line; from_begin_of_line: GETNEXT ON(' ',from_begin_of_line) ON('\t',from_begin_of_line) ONEOL(from_begin_of_line) ON('#',begin_preprocessor) ON('/',begin_comment_empty_line) ON('"',string) ON('\'',singlechar) goto scan_end_of_line; scan_end_of_line: GETNEXT ONEOL(from_begin_of_line) ON('/',begin_comment) // TODO test for begin string and begin quote goto scan_end_of_line; begin_comment: GETNEXT ON('*',cstyle_comment) ON('/',ccstyle_comment) goto scan_end_of_line; cstyle_comment: GETNEXT ONNOT('*',cstyle_comment) goto c_style_comment_maybe_end; c_style_comment_maybe_end: GETNEXT ON('*',c_style_comment_maybe_end) ONNOT('/',cstyle_comment) goto scan_end_of_line; ccstyle_comment: GETNEXT ONEOL(from_begin_of_line) goto ccstyle_comment; begin_comment_empty_line: GETNEXT ON('*',cstyle_comment_empty_line) ON('/',ccstyle_comment) goto scan_end_of_line; cstyle_comment_empty_line: GETNEXT ONNOT('*',cstyle_comment_empty_line) goto cstyle_comment_empty_line_maybe_end; cstyle_comment_empty_line_maybe_end: GETNEXT ON('*',c_style_comment_maybe_end) ONNOT('/',cstyle_comment_empty_line) goto from_begin_of_line; string: GETNEXT SKIPON('\\',string) ON('"',scan_end_of_line) goto string; singlechar: GETNEXT SKIPON('\\',endsinglechar) endsinglechar: GETNEXT goto scan_end_of_line; begin_preprocessor: GETNEXT ON('i',begin_preprocessor_i) ON('d',begin_preprocessor_d) ON('e',begin_preprocessor_e) ONWS(begin_preprocessor) // TODO goto scan_end_of_line; begin_preprocessor_i: GETNEXT ON('n',begin_preprocessor_in) ON('f',begin_preprocessor_if) goto scan_end_of_line; begin_preprocessor_in: GETNEXT ONNOT('c',scan_end_of_line) GETNEXT ONNOT('l',scan_end_of_line) GETNEXT ONNOT('u',scan_end_of_line) GETNEXT ONNOT('d',scan_end_of_line) GETNEXT ONNOT('e',scan_end_of_line) goto look_for_filename; look_for_filename: GETNEXT ON(' ',look_for_filename) ON('"',local_include) ON('<',system_include) goto scan_end_of_line; local_include: GETNEXT ON('"',local_include_end) IncludeFilename += CURRENT; goto local_include; local_include_end: localInclude(IncludeFilename); IncludeFilename = ""; goto scan_end_of_line; system_include: GETNEXT ON('>',system_include_end) IncludeFilename += CURRENT; goto system_include; system_include_end: systemInclude(IncludeFilename); IncludeFilename = ""; goto scan_end_of_line; begin_preprocessor_d: GETNEXT ONNOT('e',scan_end_of_line) GETNEXT ONNOT('f',scan_end_of_line) GETNEXT ONNOT('i',scan_end_of_line) GETNEXT ONNOT('n',scan_end_of_line) GETNEXT ONNOT('e',scan_end_of_line) goto look_for_define; look_for_define: GETNEXT ON(' ',look_for_define) ONEOL(from_begin_of_line) goto define_name; define_name: ONWS(define_body_begin) ON('(',define_param) ONEOL(define_end) DefineName += CURRENT; GETNEXT goto define_name; define_param: GETNEXT ON(')',define_body_begin) ONEOL(define_end) DefineParam += CURRENT; goto define_param; define_body_begin: GETNEXT ONWS(define_body_begin) ONEOL(define_end) goto define_body; define_body: ONEOL(define_end) DefineBody += CURRENT; GETNEXT goto define_body; define_end: define(DefineName, DefineParam, DefineBody); DefineName = ""; DefineParam = ""; DefineBody = ""; goto from_begin_of_line; begin_preprocessor_if: GETNEXT ON('n',begin_preprocessor_ifn); ON('d',begin_preprocessor_ifd); ON(' ',if_begin); goto scan_end_of_line; begin_preprocessor_ifn: GETNEXT ONNOT('d',scan_end_of_line); GETNEXT ONNOT('e',scan_end_of_line); GETNEXT ONNOT('f',scan_end_of_line); goto ifndef_begin; ifndef_begin: GETNEXT ON(' ',ifndef_begin) ONEOL(from_begin_of_line) goto ifndef; ifndef: ON(' ',ifndef_end) ON('\t',ifndef_end) ONEOL(ifndef_end) Symbol += CURRENT; GETNEXT goto ifndef; ifndef_end: ifndef(Symbol); Symbol = ""; ONEOL(from_begin_of_line); goto scan_end_of_line; begin_preprocessor_ifd: GETNEXT ONNOT('e',scan_end_of_line); GETNEXT ONNOT('f',scan_end_of_line); goto ifdef_begin; ifdef_begin: GETNEXT ON(' ',ifdef_begin) ONEOL(from_begin_of_line) goto ifdef; ifdef: ON(' ',ifdef_end) ON('\t',ifdef_end) ONEOL(ifdef_end) Symbol += CURRENT; GETNEXT goto ifdef; ifdef_end: ifdef(Symbol); Symbol = ""; ONEOL(from_begin_of_line); goto scan_end_of_line; begin_preprocessor_e: GETNEXT ON('n',begin_preprocessor_en) ON('l',begin_preprocessor_el) goto scan_end_of_line; begin_preprocessor_en: GETNEXT ONNOT('d',scan_end_of_line) GETNEXT ONNOT('i',scan_end_of_line) GETNEXT ONNOT('f',scan_end_of_line) endif(); goto scan_end_of_line; begin_preprocessor_el: GETNEXT ON('s',begin_preprocessor_els) ON('i',begin_preprocessor_eli) goto scan_end_of_line; begin_preprocessor_els: GETNEXT ONNOT('e',scan_end_of_line) else_(); goto scan_end_of_line; begin_preprocessor_eli: GETNEXT ONNOT('f',scan_end_of_line) goto elif_begin; elif_begin: GETNEXT ON(' ',elif_begin); Symbol = ""; ONEOL(elif_end); Symbol += CURRENT; goto elif_in_progress; elif_in_progress: GETNEXT ONEOL(elif_end); Symbol += CURRENT; goto elif_in_progress; elif_end: elif_(Symbol); Symbol = ""; goto from_begin_of_line; if_begin: Symbol = ""; goto if_in_progress; if_in_progress: GETNEXT ONEOL(if_end); Symbol += CURRENT; goto if_in_progress; if_end: if_(Symbol); Symbol = ""; goto from_begin_of_line; } } FileStructure::FileStructure(const FileStructure& anOther) : ModificationTime(anOther.ModificationTime), Main(0) { if (anOther.Main) Main = dynamic_cast(anOther.Main->copy()); } FileStructure::~FileStructure() { delete Main; } FileStructure& FileStructure::operator=(const FileStructure& anOther) { if (this != &anOther) { ModificationTime = anOther.ModificationTime; delete Main; Main = 0; if (anOther.Main) Main = dynamic_cast(anOther.Main->copy()); } return *this; } time_t FileStructure::getModificationTime() const { return ModificationTime; } void FileStructure::setModificationTime(const time_t aTime) { ModificationTime = aTime; } void FileStructure::localInclude(const std::string& aFile) { // cout << "include local file : " << aFile << std::endl; Include* I = new Include(this, aFile, false); Current->add(I); } void FileStructure::systemInclude(const std::string& aFile) { // cout << "include system file : " << aFile << std::endl; Include* I = new Include(this, aFile, true); Current->add(I); } void FileStructure::define(const std::string& aName, const std::string& aParam, const std::string& aBody) { // cout << "define : " << aName << "(" << aParam << ") " << aBody << std::endl; Define* D = new Define(this, aName, aBody); Current->add(D); } void FileStructure::ifndef(const std::string& aName) { // cout << "ifndef : " << aName << std::endl; If* I = new If(this); Current->add(I); Current = I->addIf(new If::IfNDef(aName)); Scopes.push_back(I); } void FileStructure::ifdef(const std::string& aName) { // cout << "ifndef : " << aName << std::endl; If* I = new If(this); Current->add(I); Current = I->addIf(new If::IfDef(aName)); Scopes.push_back(I); } void FileStructure::if_(const std::string& aName) { If* I = new If(this); Current->add(I); Current = I->addIf(new If::IfTest(aName)); Scopes.push_back(I); } void FileStructure::endif() { // cout << "endif" << std::endl; if (Scopes.size() > 0) { Scopes.pop_back(); if (Scopes.size() == 0) Current = Main; else Current = Scopes[Scopes.size()-1]->getLastScope(); } else std::cerr << ResolvedName << ": Too much endifs for me" << std::endl; } void FileStructure::else_() { // std::cout << "else" << std::endl; if (Scopes.size() > 0) Current = Scopes[Scopes.size()-1]->addElse(); else std::cerr << "Spurious else without if" << std::endl; } void FileStructure::elif_(const std::string& aName) { if (Scopes.size() > 0) Current = Scopes[Scopes.size()-1]->addIf(new If::IfTest(aName)); else std::cerr << "Spurious elsif without if" << std::endl; } void FileStructure::getDependencies(CompileState* aState) { Main->getDependencies(aState); } FileCache* FileStructure::getCache() { return Cache; } std::string FileStructure::getPath() const { std::string::size_type p = ResolvedName.rfind(sPathSep); if (p == std::string::npos) p = 0; return std::string(ResolvedName,0,p); } std::string FileStructure::getFileName() const { return ResolvedName; } fastdep-0.16/CHANGELOG0100644000175000007640000000674207747773372011765 0ustar bvh2003/10/28 fastdep-0.16 Implement boolean operators in #if [Pete Gonzalez] Adds support for Windows MinGW GCC and MS VisualC++.NET [Jack T. Goral] Adds Jamfile for compilation with Jam [Jack T. Goral] Make gcc style predefined symbols defined as in -DPARAMETER=3 [Pierric Descamps] Fix unportable configure sh for NetBSD [Julio M. Merino Vidal] Set object filename extension through a command line [Arne Varholm] Man page [Zenaan Harkness] Compilation fixes + makefile for MS VC6 [Alexander Bartolich] 2003/01/15 fastdep-0.15 Fix parsing bug : tab is also valid whitespace in #ifdef lines [Daniel Brahneborg] Add -O switch to specify object dir [Daniel Brahneborg] Use local copy of libgnugetopt on platforms not using GNU libc 2002/11/29 fastdep-0.14 Compilation and build fixes for FreeBSD [Robert Sandilands] Revert braindead /usr exclusion from 0.13 [Robert Sandilands] Don't process include files found in /usr/include Reduce number of stat and open calls by 50% to 90% [idea from code by Richard Cownie] Reworked the build system and introduced a small configuration script Better manual in docbook (converted to dvi/ps/pdf/html) 2002/10/26 fastdep-0.13 Fix compilation error, cout needs std:: prefix in fastdep.cc [Jelbert Treeve] Don't barf if tabs are used as whitespace between #, define and the macro body --debug switch to print out what happens Don't follow includes in /usr directory --atleastversion to check version in scripts 2002/08/12 fastdep-0.12 Also follow <...> includes, but silently ignore them when we can't find them (assuming they are system headers) [Sébastien de Menten] Strip ending newline and carriage returns from include directories [Chris Lambacher] Add -D switch to add always defined symbols (same as gcc) 2002/07/15 fastdep-0.11 Fix when a filename begins the same as the current directory [Chris Lambacher] -o parameter to direct output to a file instead of stdout Add a spec file to generate RPMS 2002/06/01 fastdep-0.10 --extraincludes parameter to read extra includes directories from a filename -q parameter for a quite mode (don't complain when no files found) Fixes in the build process under cygwin Pass .o/.cc names in a filename for linking/dependency generation to avoid exhausting limited size of the command line parameters buffer in cygwin [items by : Chris Lambacher] 2002/05/02 fastdep-0.09 Fixed brain dead bug as shown by new testcase (asterix-comment) Fixed bug when using absolute filenames in #includes Added --stdinclude parameter (defaults to /usr/include) Added --compile parameter to generate a build rule instead of a simple dependency Added -d parameter to strip directory part from the output object name [all items by : Robert Sandilands ] 2002/04/25 fastdep-0.08 Macros without parameters are now evaluated in #if/#elif expressions Improved a (small) bit on the documentation 2002/04/09 fastdep-0.07 --version and -v switches to print version information 2002/04/07 fastdep-0.06 Add missing #include to fix compilation on gcc 3.x 2002/03/18 fastdep-0.05 Begin with a library of regression tests Evaluate expressions after #if 2002/03/10 fastdep-0.04 Preliminary support for #if and #elif 2002/01/10 fastdep-0.03 Emit right dependencies for cross-directory includes 2002/01/08 fastdep-0.02 Correct include file behaviour in the face of multiple directories 2001/12/31 fastdep-0.01 Add installation scheme 2001/12/29 fastdep First version. Don't know about #if and #elif fastdep-0.16/README0100644000175000007640000000134707613335652011412 0ustar bvhfastdep 0.15 (http://www.irule.be/bvh/c++/fastdep/) Copyright Bart Vanhauwaert and all (see AUTHORS), 2001, 2002, 2003 Contents of this package COPYING terms of use and license for this package README this file INSTALL installation guide CHANGELOG changes from version to version TODO non-implemented features AUTHORS about the authors build/ build scripts config/ configuration scripts doc/ documentation on fastdep (html/pdf) tests/ regression tests This is a rough outline of what is supposed to become a fast dependency generator. (Faster than gcc anyway) Full (?) installation guide is in the file INSTALL To compile (without checking dependencies) do ./configure and gmake (On Linux you may generally use make.) fastdep-0.16/Define.h0100644000175000007640000000112007747773130012067 0ustar bvh#ifndef DEFINE_H_ #define DEFINE_H_ #include "Element.h" #include class FileStructure; class Define : public Element { public: Define(FileStructure* aStructure, const std::string& aMacro); Define(FileStructure* aStructure, const std::string& aMacro, const std::string& aContent); Define(const Define& anOther); virtual ~Define(); Define& operator=(const Define& anOther); virtual Element* copy() const; virtual void getDependencies(CompileState* aState); std::string getContent() const; private: std::string MacroName; std::string Content; }; #endif fastdep-0.16/If.h0100644000175000007640000000300707747773130011241 0ustar bvh#ifndef IF_H_ #define IF_H_ #include "Element.h" #include #include class CompileState; class FileStructure; class Sequence; class If : public Element { public: class Control { public: virtual ~Control() = 0; virtual Control* copy() const = 0; virtual bool isTrue(CompileState* aState) const = 0; }; class IfDef : public Control { public: IfDef(const std::string& aName); IfDef(const IfDef& anOther); virtual ~IfDef(); virtual Control* copy() const; virtual bool isTrue(CompileState* aState) const; private: std::string Macro; }; class IfNDef : public Control { public: IfNDef(const std::string& aName); IfNDef(const IfNDef& anOther); virtual ~IfNDef(); virtual Control* copy() const; virtual bool isTrue(CompileState* aState) const; private: std::string Macro; }; class IfTest : public Control { public: IfTest(const std::string& anControl); IfTest(const IfTest& anOther); virtual Control* copy() const; virtual bool isTrue(CompileState* aState) const; private: std::string theExpression; }; public: If(FileStructure* aStructure); If(const If& anOther); virtual ~If(); If& operator=(const If& anOther); virtual Element* copy() const; virtual void getDependencies(CompileState* aState); Sequence* addIf(Control* anExpr); Sequence* addElse(); Sequence* getLastScope(); private: std::vector Expr; std::vector Seq; Sequence* Else; }; #endif fastdep-0.16/Element.cc0100644000175000007640000000076507461212247012430 0ustar bvh#include "Element.h" #include "FileCache.h" #include "FileStructure.h" Element::Element(FileStructure* aStructure) : theStructure(aStructure) { } Element::Element(const Element& anOther) : theStructure(anOther.theStructure) { } Element::~Element() { } Element& Element::operator=(const Element& anOther) { theStructure = anOther.theStructure; return *this; } FileStructure* Element::getStructure() { return theStructure; } FileCache* Element::getCache() { return theStructure->getCache(); } fastdep-0.16/Element.h0100644000175000007640000000075407570751666012306 0ustar bvh#ifndef ELEMENT_H_ #define ELEMENT_H_ #include class CompileState; class FileCache; class FileStructure; class Element { public: Element(FileStructure* aStructure); Element(const Element& anOther); virtual ~Element(); Element& operator=(const Element& anOther); virtual Element* copy() const = 0; virtual void getDependencies(CompileState* aState) = 0; FileStructure* getStructure(); FileCache* getCache(); private: FileStructure* theStructure; }; #endif fastdep-0.16/Sequence.cc0100644000175000007640000000165107747773130012614 0ustar bvh#include "Sequence.h" Sequence::Sequence(FileStructure* aStructure) : Element(aStructure) { } Sequence::Sequence(const Sequence& anOther) : Element(anOther) { for (unsigned int i=0; icopy()); } Sequence::~Sequence() { for (unsigned int i=0; icopy()); } return *this; } Element* Sequence::copy() const { return new Sequence(*this); } void Sequence::add(Element* anElem) { Seq.push_back(anElem); } void Sequence::getDependencies(CompileState* aState) { for (unsigned int i=0; igetDependencies(aState); } fastdep-0.16/FileCache.h0100644000175000007640000000425507747771377012527 0ustar bvh#ifndef FILECACHE_H_ #define FILECACHE_H_ #include #include #include #include #include "FileStructure.h" #include "os.h" class Sequence; class FileCache { public: FileCache(const std::string& aBaseDir); FileCache(const FileCache& anOther); virtual ~FileCache(); FileCache& operator=(const FileCache& anOther); void generate(std::ostream& theStream, const std::string& aDirectory, const std::string& aFilename); FileStructure* update(const std::string& aDirectory, const std::string& aFilename, bool isSystem); void addIncludeDir(const std::string& aBaseDir, const std::string& aDir); void addIncludeDirFromFile(const std::string& aBaseDir, const std::string& aFilename); void addExcludeDir(const std::string& aBaseDir, const std::string& aDir); std::string getAllDependenciesLine() const; void SetObjectsShouldContainDirectories() { ObjectsContainDirectories=true; }; void SetObjectsShouldNotContainDirectories() { ObjectsContainDirectories=false; }; void SetObjectsDir(const std::string& aDir) { ObjectsDir = aDir+sPathSep; } void SetObjectsExt(const std::string& aExt) { ObjectsExt = aExt; } void SetCompileCommand( const std::string &cmd ); void SetQuietModeOn() {QuietMode = true; } void SetQuietModeOff() {QuietMode = false; } void addPreDefine(const std::string& aName); void inDebugMode(); private: struct FileLocation { FileLocation(const std::string& aDir, const std::string& aName) : Directory(aDir), Name(aName) { } bool operator<(const FileLocation& aLoc) const { return (Directory < aLoc.Directory) || ((Directory == aLoc.Directory) && (Name < aLoc.Name)); } std::string Directory; std::string Name; }; typedef std::map FileMap; FileMap Files; std::vector IncludeDirs; std::vector ExcludeDirs; std::vector AllDependencies; std::vector PreDefined; std::string BaseDir; std::string ObjectsDir; std::string ObjectsExt; std::string CompileCommand; bool ObjectsContainDirectories; static bool QuietMode; bool DebugMode; bool WarnAboutNonExistingSystemHeaders; }; #endif fastdep-0.16/FileStructure.h0100644000175000007640000000226407570751666013513 0ustar bvh#ifndef FILESTRUCTURE_H_ #define FILESTRUCTURE_H_ #include #include #include "If.h" class CompileState; class FileCache; class Sequence; class FileStructure { public: FileStructure(const std::string& aFilename, FileCache* aCache, const char* aFile, unsigned int aLength); FileStructure(const FileStructure& anOther); virtual ~FileStructure(); FileStructure& operator=(const FileStructure& anOther); void localInclude(const std::string& aFile); void systemInclude(const std::string& aFile); void define(const std::string& aName, const std::string& aParam, const std::string& aBody); void ifndef(const std::string& aName); void ifdef(const std::string& aName); void endif(); void else_(); void if_(const std::string& aName); void elif_(const std::string& aName); time_t getModificationTime() const; void setModificationTime(const time_t aTime); void getDependencies(CompileState* aState); FileCache* getCache(); std::string getPath() const; std::string getFileName() const; private: time_t ModificationTime; std::string ResolvedName; Sequence* Main; Sequence* Current; FileCache* Cache; std::vector Scopes; }; #endif fastdep-0.16/FileCache.cc0100644000175000007640000001453707747771334012662 0ustar bvh#include "FileCache.h" #include "FileStructure.h" #include "CompileState.h" #include "os.h" #include "MappedFile.h" #include #include #include #include #include #include #include #include #include #ifdef WIN32 extern char *realpath(const char *path, char resolved_path[]); #define PATH_MAX MAX_PATH #endif using namespace std; bool FileCache::QuietMode = false; FileCache::FileCache(const std::string& aBaseDir) : BaseDir(aBaseDir), ObjectsDir(""), ObjectsExt(".o"), DebugMode(false), WarnAboutNonExistingSystemHeaders(false) { CompileCommand = ""; SetObjectsShouldContainDirectories(); IncludeDirs.push_back("."); } FileCache::FileCache(const FileCache& anOther) { } FileCache::~FileCache() { } FileCache& FileCache::operator=(const FileCache& anOther) { return *this; } void FileCache::inDebugMode() { DebugMode = true; } void FileCache::addPreDefine(const std::string& aName) { PreDefined.push_back(aName.substr(0, aName.find('='))); } void FileCache::generate(std::ostream& theStream, const std::string& aDirectory, const std::string& aFilename) { FileStructure* Structure = update(aDirectory, aFilename, false); if (Structure) { CompileState State(aDirectory); if (DebugMode) State.inDebugMode(); for (unsigned int i=0; igetDependencies(&State); std::string Basename(aFilename,0,aFilename.rfind(".")); if (!ObjectsContainDirectories && Basename.rfind(sPathSep)!=Basename.npos) { std::string newBasename(Basename,Basename.rfind(sPathSep)+1,Basename.size()); theStream << newBasename << ".o: " << aFilename; } else { theStream << ObjectsDir << Basename << ".o: " << aFilename; } theStream << State.getDependenciesLine() << std::endl; // State.dump(); State.mergeDeps(AllDependencies); if (std::find(AllDependencies.begin(),AllDependencies.end(),aFilename) == AllDependencies.end()) AllDependencies.push_back(aFilename); if (CompileCommand.size()>0) { theStream << "\t " << CompileCommand << " " << aFilename << std::endl << std::endl ; } } } void FileCache::SetCompileCommand( const std::string &cmd ) { CompileCommand = cmd; } void FileCache::addIncludeDir(const std::string& aBaseDir, const std::string& aDir) { if (std::find(IncludeDirs.begin(),IncludeDirs.end(),aDir) == IncludeDirs.end()) IncludeDirs.push_back(aDir); } void FileCache::addExcludeDir(const std::string& aBaseDir, const std::string& aDir) { if (std::find(ExcludeDirs.begin(),ExcludeDirs.end(),aDir) == ExcludeDirs.end()) ExcludeDirs.push_back(aDir); } void FileCache::addIncludeDirFromFile(const std::string& aBaseDir, const std::string& aFilename) { std::ifstream ifile(aFilename.c_str()); if(!ifile){ // XXX Error message here if(!QuietMode){ std::cerr << "error opening " << aFilename.c_str() << std::endl; } // exit or return ? return; } while(!ifile.eof()){ std::string aDir; std::getline(ifile, aDir); aDir = aDir.substr(0,aDir.find('\n')); aDir = aDir.substr(0,aDir.find('\r')); if (aDir != "") addIncludeDir(aBaseDir, aDir); } } FileStructure* FileCache::update(const std::string& aDirectory, const std::string& aFilename, bool isSystem) { FileMap::iterator iti = Files.find(FileLocation(aDirectory,aFilename)); if (iti != Files.end()) { /* if(!iti->second && !QuietMode && (!isSystem || WarnAboutNonExistingSystemHeaders)) { std::cerr << "error opening " << aFilename.c_str() << std::endl; } */ return iti->second; } auto_ptr mfile(new MappedFile); if (DebugMode) std::cout << "[DEBUG] FileCache::update(" << aDirectory << "," << aFilename << "," << isSystem << ");" << std::endl; char ResolvedBuffer[PATH_MAX+1]; { unsigned int i; for (i=0; iopen(ResolvedBuffer)) break; } if (i == IncludeDirs.size()) { for (i=0; iopen(ResolvedBuffer)) { if (DebugMode) std::cout << "[DEBUG] excluding : " << ResolvedBuffer << std::endl; Files[FileLocation(aDirectory, aFilename)] = 0; return 0; } } std::string theFilename = aDirectory+cPathSep+aFilename; if (aFilename[0]==cPathSep) { theFilename = aFilename; } if (!realpath(theFilename.c_str(), ResolvedBuffer)) { if(!QuietMode && (!isSystem || WarnAboutNonExistingSystemHeaders)) { std::cerr << "error opening " << aFilename.c_str() << std::endl; } Files[FileLocation(aDirectory, aFilename)] = 0; return 0; } if(!mfile->open(ResolvedBuffer)) { if(!QuietMode && (!isSystem || WarnAboutNonExistingSystemHeaders)) { std::cerr << "error opening " << aFilename.c_str() << std::endl; } Files[FileLocation(aDirectory, aFilename)] = 0; return 0; } } } std::string ResolvedName(ResolvedBuffer); long file_size =mfile->size(); time_t last_change =mfile->time(); if (file_size == 0) { std::cerr << ResolvedName << " is empty." << std::endl; return 0; } char * map = 0; try { map = mfile->map(); } catch(string s ) { std::cerr << s << std::endl; exit(1); } FileStructure* S = new FileStructure(ResolvedName, this, map, file_size); S->setModificationTime(last_change); Files.insert(std::make_pair(FileLocation(aDirectory,aFilename), S)); return S; } std::string FileCache::getAllDependenciesLine() const { std::string Result; for (unsigned int i=0; i #else #include #endif #include "getopt.h" #include #include #include "FileCache.h" #include "FileStructure.h" #include "CheckVersion.h" #define CWDBUFFERLENGTH 1024 void PrintVersion() { std::cout << "fastdep v" << FASTDEP_VERSION_MAJOR << "." << FASTDEP_VERSION_MINOR << std::endl << "copyright Bart Vanhauwaert, 2001, 2002" << std::endl << "licensed under the GNU Public License" << std::endl; } /* * Generate dependencies for all files. */ int main(int argc, char **argv) { char cwd_buffer[CWDBUFFERLENGTH+1]; cwd_buffer[0] = 0; #if defined(WIN32) _getcwd(cwd_buffer, CWDBUFFERLENGTH); #else getcwd(cwd_buffer, CWDBUFFERLENGTH); #endif FileCache Cache(cwd_buffer); Cache.addIncludeDir(cwd_buffer,"."); std::string RemakeDepTarget; std::vector ExtraRemakeDeps; std::string OutputFilename; bool doDebug = false; while (1) { int option_index = 0; static struct option long_options[] = { {"remakedeptarget", 1, 0, 0 }, {"extraremakedep", 1, 0, 0 }, {"version", 0, 0, 0 }, {"stdinclude", 2, 0, 0 }, {"compile", 1, 0, 0 }, {"extraincludes", 1, 0, 0}, {"debug",0,0,0 }, {"atleastversion",1,0,0 }, {"objectextension",2 , 0, 0 }, {0, 0, 0, 0} }; int c = getopt_long(argc,argv,"vI:dqo:O:D:e:",long_options, &option_index); if (c==-1) break; switch (c) { case 0: switch (option_index) { case 0: RemakeDepTarget = std::string(optarg); break; case 1: ExtraRemakeDeps.push_back(std::string(optarg)); break; case 2: PrintVersion(); return 0; case 3: if (optarg) { Cache.addIncludeDir(cwd_buffer, optarg); } else { Cache.addIncludeDir(cwd_buffer, "/usr/include"); } break; case 4: Cache.SetCompileCommand( std::string(optarg) ); break; case 5: Cache.addIncludeDirFromFile(cwd_buffer, optarg); break; case 6: doDebug = true; break; case 7: return atLeastVersion(optarg); break; case 8: Cache.SetObjectsExt(optarg); break; } break; case 'I': Cache.addIncludeDir(cwd_buffer, optarg); break; case 'O': Cache.SetObjectsDir(optarg); break; case 'e': Cache.SetObjectsExt(optarg); break; case 'v': PrintVersion(); return 0; case 'd': Cache.SetObjectsShouldNotContainDirectories(); break; case 'q': Cache.SetQuietModeOn(); break; case 'o': OutputFilename = optarg; break; case 'D': Cache.addPreDefine(optarg); break; } } #if ! defined (WIN32) Cache.addExcludeDir("","/usr/include"); #endif if (optind == argc) { std::cout << "Usage : fastdep filename.c" << std::endl; return 0; } if (doDebug) Cache.inDebugMode(); std::ostream* theStream = &std::cout; if (OutputFilename != "") { theStream = new std::ofstream(OutputFilename.c_str()); if (RemakeDepTarget == "") RemakeDepTarget = OutputFilename; } for (int i=optind; i 0) { /* std::string Fullname; if (Filename[0] == cPathSep) Fullname = Filename; else Fullname = getStructure()->getPath()+"/"+Filename; aState->addDependencies(Fullname); */ FileStructure* S = getCache()->update(getStructure()->getPath(),Filename,System); if (S /* && (std::string(S->getFileName(),0,4) != "/usr") */) { aState->addDependencies(S->getFileName()); S->getDependencies(aState); } } } fastdep-0.16/INSTALL0100644000175000007640000000727107747770505011575 0ustar bvh***CONFIGURATION*** This software packages includes an autoconfiguration script, called configure. Normally the configuration process can work out reasonable defaults automatically. So just run ./configure in the top level directory and you are set. It is however possible to guide the configuration by passing appropriate arguments to the script. To learn more about valid arguments and what they do just launch ./configure --help NOTE for users of non-GNU libc (FreeBSD, Solaris, ...) : This package uses GNU getopt_long extension from the GNU libc, which is normally NOT available on FreeBSD, Solaris and possibly other platforms. A local copy of getopt_long is included and configure will pick it up automatically. Make sure the line Checking for GNU getopt_long... provided by local copy is output when running configure or otherwise force the use of the local copy of GNU getopt_long by passing the --enable-local-gnugetopt option to configure. ***COMPILATION*** Once you have successfully configured this package you can compile it using GNU make. gmake On most Linux and cygwin systems, the standard make is traditionally GNU make. In that case an equivalent way to start the compilation is : make ***ALTERNATIVE*** A jamfile for this project is included. ***SHORT INSTALL GUIDE*** When compilation finishes, you will find a fastdep binary in the top level directory of this package. To install it, simply copy it to a convenient location. Possible suggestions are /usr/local/bin or /usr/bin. ***LONG INSTALL GUIDE*** I am experimenting with installation schemes for software. That's why this procedure is a bit weird. You can safely ignore what follows if you don't like it. The idea is to have (non-essential) packages install themselves in /opt/$(CATEGORY)/$(PACKAGENAME). Examples of $(CATEGORY)'s are devel development utilities devel/c c development utilities devel/c++ c++ development utilities games games games/board board games games/strategy strategy games wm/x11 x11 window managers Categories are grouped by function first and not technicalities. So no x11/games (x11 is a technicality in this case). No x11/wm, but wm/x11. Categories are essentially directories. Preferably there should be some 'standards' convention for them (yet another standard). Packagename should not contain version information unless multiple versions of the same package must be installed side by side. In that case a link to the default should be provided. Within /opt/$(CATEGORY)/$(PACKAGENAME) packages are free to do whatever they likes, except for Makefile.install (more about that later). To create some order in the chaos they will probably follow a mini-filesystem. eg. binaries in /opt/$(CATEGORY)/$(PACKAGENAME)/bin etc... /opt/$(CATEGORY)/$(PACKAGENAME) must at least contain the file Makefile.install. Which must be a Makefile (surprise, surprise) with at least one target : uninstall (this does not have to be the default one, though). Uninstall should do the necessary things to uninstall said package. (surprise again). Now for a step by step guide to installation. 1. Verify Makefile.options. Most notably if you are installing this package as a user who does not have write access to /opt change the PREFIX line to (for example) PREFIX=/home/myself/opt 2. make boot to compile the package 3. make -f Makefile.install check-install to check what will be installed and where. (Optional) 4. make -f Makefile.install install to install everything. done. To uninstall simply chdir to $(PREFIX)/devel/c/fastdep and do make -f Makefile.install check-uninstall to optionally review what will be removed and make -f Makefile.install uninstall to really uninstall. Comments? Ideas? Mail bvh-cplusplus@irule.be fastdep-0.16/Makefile.options0100644000175000007640000000007107570763561013663 0ustar bvhPREFIX=/opt CATEGORY=devel/c NAME=fastdep BINARY=fastdep fastdep-0.16/Include.h0100644000175000007640000000076307747773130012274 0ustar bvh#ifndef INCLUDE_H_ #define INCLUDE_H_ #include "Element.h" #include class FileStructure; class CompileState; class Include : public Element { public: Include(FileStructure* aStructure, const std::string& aFilename, bool aSystem); Include(const Include& anOther); virtual ~Include(); Include& operator=(const Include& anOther); virtual Element* copy() const; virtual void getDependencies(CompileState* aState); private: std::string Filename; bool System; }; #endif fastdep-0.16/CompileState.cc0100644000175000007640000000522607747767167013454 0ustar bvh#include "CompileState.h" #include "os.h" #include #include CompileState::CompileState(const std::string& aBase) : Basedir(aBase), DebugMode(false) { } CompileState::CompileState(const CompileState& anOther) { } CompileState::~CompileState() { } CompileState& CompileState::operator=(const CompileState& anOther) { if (this != &anOther) { } return *this; } void CompileState::inDebugMode() { DebugMode = true; } void CompileState::addDependencies(const std::string& aString) { std::string Beef(aString); if (std::string(Beef,0,Basedir.length()+1) == Basedir + sPathSep) //"/") Beef = std::string(aString,Basedir.length()+1,aString.length()); if (std::find(Dependencies.begin(), Dependencies.end(), Beef) == Dependencies.end()) Dependencies.push_back(Beef); } std::string CompileState::getDependenciesLine() const { std::string Result; for (unsigned int i=0; i::iterator i = std::find(Defines.begin(), Defines.end(), aString); while (i != Defines.end()) { unsigned int Pos = i - Defines.begin(); Defines.erase(i); Contents.erase(Contents.begin()+Pos); i = std::find(Defines.begin(), Defines.end(), aString); } } std::string CompileState::getContent(const std::string& aName) const { std::vector::const_iterator i = std::find(Defines.begin(), Defines.end(), aName); if (i != Defines.end()) { unsigned int Pos = i - Defines.begin(); return Contents[Pos]; } return ""; } bool CompileState::isDefined(const std::string& aString) const { bool Result = std::find(Defines.begin(), Defines.end(), aString) != Defines.end(); if (DebugMode) std::cout << "[DEBUG] isdefined " << aString << " : " << Result << ";" << std::endl; return Result; } void CompileState::dump() const { std::cout << "defined:" << std::endl; for (unsigned int i=0; i& aDepLine) { for (unsigned int i=0; i #include class CompileState; class FileStructure; class Sequence : public Element { public: Sequence(FileStructure* aStructure); Sequence(const Sequence& anOther); virtual ~Sequence(); Sequence& operator=(const Sequence& anOther); void add(Element* anElement); virtual Element* copy() const; virtual void getDependencies(CompileState* aState); private: std::vector Seq; }; #endif fastdep-0.16/Define.cc0100644000175000007640000000155207747773130012236 0ustar bvh#include "Define.h" #include "CompileState.h" Define::Define(FileStructure* aStructure, const std::string& aMacro) : Element(aStructure), MacroName(aMacro) { } Define::Define(FileStructure* aStructure, const std::string& aMacro, const std::string& aContent) : Element(aStructure), MacroName(aMacro), Content(aContent) { } Define::Define(const Define& anOther) : Element(anOther), MacroName(anOther.MacroName), Content(anOther.Content) { } Define::~Define() { } Define& Define::operator=(const Define& anOther) { if (this != &anOther) { Element::operator=(*this); MacroName = anOther.MacroName; Content = anOther.Content; } return *this; } Element* Define::copy() const { return new Define(*this); } void Define::getDependencies(CompileState* aState) { aState->define(MacroName, Content); } std::string Define::getContent() const { return Content; } fastdep-0.16/Makefile.common0100644000175000007640000000063607747767461013500 0ustar bvh#CXXFLAGS=-Wall -O2 UNAME_SYS=$(shell uname -s) ifneq (,$(findstring CYGWIN, $(UNAME_SYS))) HOST_SYSTEM=cygwin else HOST_SYSTEM=unix endif ifeq ($(shell uname),FreeBSD) CXXFLAGS:=$(CXXFLAGS) -I . endif $(call classgroup,fastdep,all) = CheckVersion CompileState Define Element Expression \ FileCache FileStructure If Include MappedFile Sequence fastdep GROUPS=all ALLMAKEFILES = Makefile Makefile.common fastdep-0.16/Makefile.install0100644000175000007640000000112307414074247013626 0ustar bvh# Simple install/uninstall script for projects with one binary only # Version 0 include Makefile.options TARGETDIR=$(PREFIX)/$(CATEGORY)/$(NAME) check-install: make -f Makefile.install -n install install: install -D $(BINARY) $(TARGETDIR)/bin/$(BINARY) install -D Makefile.install $(TARGETDIR)/Makefile.install install -D Makefile.options $(TARGETDIR)/Makefile.options check-uninstall: make -f Makefile.install -n uninstall uninstall: -rm $(TARGETDIR)/bin/$(BINARY) -rm $(TARGETDIR)/Makefile.install -rm $(TARGETDIR)/Makefile.options -rm -r $(TARGETDIR)/bin -rm -r $(TARGETDIR) fastdep-0.16/If.cc0100644000175000007640000000563407747773130011407 0ustar bvh#include "If.h" #include "CompileState.h" #include "Expression.h" #include "FileStructure.h" #include "Sequence.h" #include If::Control::~Control() { } If::IfDef::IfDef(const std::string& aName) : Macro(aName) { } If::IfDef::IfDef(const If::IfDef& anOther) : Macro(anOther.Macro) { } If::IfDef::~IfDef() { } If::Control* If::IfDef::copy() const { return new If::IfDef(*this); } bool If::IfDef::isTrue(CompileState* aState) const { return aState->isDefined(Macro); } If::IfNDef::IfNDef(const std::string& aName) : Macro(aName) { } If::IfNDef::IfNDef(const If::IfNDef& anOther) : Macro(anOther.Macro) { } If::IfNDef::~IfNDef() { } If::Control* If::IfNDef::copy() const { return new If::IfNDef(*this); } bool If::IfNDef::isTrue(CompileState* aState) const { return !aState->isDefined(Macro); } If::IfTest::IfTest(const std::string& anExpression) : theExpression(anExpression) { } If::IfTest::IfTest(const If::IfTest& anOther) : theExpression(anOther.theExpression) { } If::Control* If::IfTest::copy() const { return new If::IfTest(*this); } bool If::IfTest::isTrue(CompileState* aState) const { Expression E(theExpression, aState); return E.evaluate(); } If::If(FileStructure* aStructure) : Element(aStructure), Else(0) { } If::If(const If& anOther) : Element(anOther), Else(0) { for (unsigned int i=0; icopy()); for (unsigned int j=0; j(anOther.Seq[j]->copy())); if (anOther.Else) Else = dynamic_cast(anOther.Else->copy()); } If::~If() { for (unsigned int i=0; icopy()); for (unsigned int j=0; j(anOther.Seq[j]->copy())); if (Else) { delete Else; Else = 0; } if (anOther.Else) Else = dynamic_cast(anOther.Else->copy()); } return *this; } Element* If::copy() const { return new If(*this); } void If::getDependencies(CompileState* aState) { for (unsigned int i=0; iisTrue(aState)) { // std::cout << "following in if part " << i << std::endl; Seq[i]->getDependencies(aState); return; } // std::cout << "skipping to ..."; if (Else) { // std::cout << "else" << std::endl; Else->getDependencies(aState); } // else // std::cout << "nothing" << std::endl; } Sequence* If::addIf(Control* anExpr) { Expr.push_back(anExpr); Seq.push_back(new Sequence(getStructure())); return Seq[Seq.size()-1]; } Sequence* If::addElse() { if (!Else) Else = new Sequence(getStructure()); return Else; } Sequence* If::getLastScope() { if (Else) return Else; return Seq[Seq.size()-1]; } fastdep-0.16/doc/0040755000175000007640000000000007747772232011304 5ustar bvhfastdep-0.16/doc/fastdep.docbook0100644000175000007640000002313407600712637014263 0ustar bvh fastdep manual Bart Vanhauwaert
bvh-cplusplus@irule.be http://www.irule.be/bvh/
1 2002-10-28 bvh Initial version This document can be freely translated and distributed. It is releasedˇunder the LDP License. I am not a native English speaker, nor an experienced documentation writer. Thus it should not come as a surprise to you if this text containsˇ typographical, grammatical or even simple spelling errors. To overcome this problem I am actively looking for help, suggestions or improvements to this document from my readers. If you are willing to do so, send email to bvh-cplusplus@irule.beˇ to make this guide a great resource for everyone trying to learn fastdep.
About fastdep and this manual Fastdep generates dependency information for C of C++ files suitable for inclusion in makefiles. There are two main advantages in using it instead of the normal programs. It's fast due to a unique parse-once technology. It has special provision for robust dependency regeneration. This manual assumes basic knowledge of make and the build process for C or C++ programs. I am not a native English speaker, nor an experienced documentation writer. Thus it should not come as a surprise to you if this text containsˇ typographical, grammatical or even simple spelling errors. To overcome this problem I am actively looking for help, suggestions or improvements to this document from my readers. If you are willing to do so, send email to bvh-cplusplus@irule.beˇ to make this guide a great resource for everyone trying to learn fastdep. Basic usage The commandline synopsis for basic usage is fastdep --version sourcefile fastdep --version will show version information and a short copyright statement and exit immediatly. To produce dependency information for two files named file1.cc and file2.cc, execute fastdep file1.cc file2.cc from the shell. The result will be written to standard output. For example it could be file1.o: file1.cc \ header1.h \ header2.h \ header3.h file2.o: file2.cc \ header1.h \ header3.h \ header4.h To save the output, use your shell to redirect standard output to a file which you can include in a makefile. Writing a make-rule to generate dependency information In general it is much more convenient to let your makefiles generate their own dependency information instead of doing it by hand as described in the previous chapter. Let's say we have a variable in our makefile that lists all source files, SOURCES. We also want to save dependency information to a file named .depend. Here is how to write a make rule to accomplish just that. Makefile fragment to generate dependencies from a number of sources .depend: fastdep $(SOURCES) > .depend -include .depend It adds a new target .depend, which is file to hold the dependency information generated by fastdep for all files listed in SOURCES. The fragment also includes this file in the Makefile itself when it exist. If not make will generate it first (using the rule we specified), restart itself and include it next. Now each time we want to regenerate dependencies, all we have to do is delete the .depend file and launch make. Automatically regenerating dependency information Every time you change a dependency relationship (for example when you include an extra header in some source file), you have to regenerate the dependency information manually by executing make .depend (as mentioned in the previous chapter deleting .depend also works) Off course this is very error-prone. Why don't we let make regenerate the dependencies everytime one of the source files changes? Easy enough : Makefile fragment to generate dependencies each time a source file changes (wrong). .depend: $(SOURCES) fastdep $(SOURCES) > .depend -include .depend This seems to work fine, but in fact doesn't. Suppose one (or more) of our source files in SOURCES includes a certain header foo.h. Now imagine that during an edit-compile cycle we don't change anything in the source files, but we added a new include of bar.h in foo.h. This means that the dependencies for each source file that includes foo.h must change. However since none of the source files themself change, make will find that .depend is still up to date and not regenerate it. The end result is incorrect dependency information. To summarize, the dependency information of a source file not only depends on the source file itself, but also on all files it includes. Hence the earlier makefile fragment is incorrect. To solve this problem, the info manual of GNU make proposes a solution where the output of the dependency generator is modified by piping it through sed. While this works for normal dependency generators like the GNU C/C++ compiler (and still works with fastdep), there is a much more elegant solution in fastdep. By adding the --remakedeptarget=file command line option fastdep will also emit a suitable dependency line for its own output. Makefile fragment to generate dependencies each time a source or included file changes (right). .depend: fastdep --remakedeptarget=.depend $(ALLSOURCES) > .depend -include dependinfo The .depend file will now look like this : file1.o: file1.cc \ header1.h \ header2.h \ header3.h file2.o: file2.cc \ header1.h \ header3.h \ header4.h \ .depend: \ file1.cc \ header1.h \ header2.h \ header3.h \ file2.cc \ header4.h \ which is exactly how we want it to be. Adding an external dependency Suppose you change your Makefile. For example you add -O2 to the CFLAGS variable, because finally it's release time. Of course all object files have to be regenerated. The classical way to do that is make clean make But isn't it easier to let all .o files depend on the Makefile itself? So that once you touch the makefile, all objects are immediatly out of date and thus regenerated. That's what the --extraremakedep= option is for. Adding an extra dependency to all targets .depend: fastdep --extraremakedep=Makefile \ --remakedeptarget=.depend $(SOURCES) > .depend -include .depend Here is a possible result file1.o: file1.cc \ header1.h \ header2.h \ header3.h file2.o: file2.cc \ header1.h \ header3.h \ header4.h \ .depend: \ file1.cc \ header1.h \ header2.h \ header3.h \ file2.cc \ header4.h \ Makefile Links and references fastdep Homepage (news and download) : http://www.irule.be/bvh/c++/fastdep/ GNU compiler collection (gcc) Homepage : http://www.gnu.org/software/gcc/gcc.html Manual : http://www.gnu.org/software/gcc/onlinedocs/ GNU make Homepage : http://www.gnu.org/software/make/make.html Manual : http://www.gnu.org/manual/make/html_chapter/make_toc.html
fastdep-0.16/doc/book1.htm0100644000175000007640000000476707613620443013030 0ustar bvhfastdep manualfastdep-0.16/doc/Makefile0100644000175000007640000000117307571536446012743 0ustar bvhDSSSLBASE = /usr/share/sgml/docbook/dsssl-stylesheets-1.74b/ all: fastdep.html fastdep.pdf fastdep.html: fastdep.docbook jade -t sgml -d $(DSSSLBASE)/html/docbook.dsl \ fastdep.docbook cp book1.htm fastdep.html fastdep.tex: fastdep.docbook jade -o fastdep.tex -t tex -d $(DSSSLBASE)/print/docbook.dsl \ fastdep.docbook fastdep.dvi: fastdep.tex jadetex fastdep.tex jadetex fastdep.tex jadetex fastdep.tex fastdep.ps: fastdep.dvi dvips -o fastdep.ps fastdep.dvi fastdep.pdf: fastdep.ps ps2pdf fastdep.ps fastdep.pdf clean: rm -rf *.htm *.html *.dvi *.tex *.pdf *.ps *.log *.aux distclean: rm -rf *.log *.aux *.tex fastdep-0.16/doc/c23.htm0100644000175000007640000000513407613620443012371 0ustar bvhAbout fastdep and this manual

Chapter 1. About fastdep and this manual

Fastdep generates dependency information for C of C++ files suitable for inclusion in makefiles. There are two main advantages in using it instead of the normal programs.

  • It's fast due to a unique parse-once technology.

  • It has special provision for robust dependency regeneration.

This manual assumes basic knowledge of make and the build process for C or C++ programs.

I am not a native English speaker, nor an experienced documentation writer. Thus it should not come as a surprise to you if this text containsˇ typographical, grammatical or even simple spelling errors. To overcome this problem I am actively looking for help, suggestions or improvements to this document from my readers. If you are willing to do so, send email to bvh-cplusplus@irule.beˇ to make this guide a great resource for everyone trying to learn fastdep.

fastdep-0.16/doc/c34.htm0100644000175000007640000000477007613620443012400 0ustar bvhBasic usage

Chapter 2. Basic usage

The commandline synopsis for basic usage is

fastdep [--version] sourcefile...

fastdep --version will show version information and a short copyright statement and exit immediatly.

To produce dependency information for two files named file1.cc and file2.cc, execute fastdep file1.cc file2.cc from the shell.

The result will be written to standard output. For example it could be

file1.o: file1.cc \
	header1.h \
	header2.h \
	header3.h
file2.o: file2.cc \
	header1.h \
	header3.h \
	header4.h

To save the output, use your shell to redirect standard output to a file which you can include in a makefile.

fastdep-0.16/doc/c49.htm0100644000175000007640000000571307613620443012404 0ustar bvhWriting a make-rule to generate dependency information

Chapter 3. Writing a make-rule to generate dependency information

In general it is much more convenient to let your makefiles generate their own dependency information instead of doing it by hand as described in the previous chapter.

Let's say we have a variable in our makefile that lists all source files, SOURCES. We also want to save dependency information to a file named .depend. Here is how to write a make rule to accomplish just that.

Example 3-1. Makefile fragment to generate dependencies from a number of sources

.depend:
	fastdep $(SOURCES) > .depend

-include .depend
	

It adds a new target .depend, which is file to hold the dependency information generated by fastdep for all files listed in SOURCES. The fragment also includes this file in the Makefile itself when it exist. If not make will generate it first (using the rule we specified), restart itself and include it next.

Now each time we want to regenerate dependencies, all we have to do is delete the .depend file and launch make.

fastdep-0.16/doc/c63.htm0100644000175000007640000001111407613620443012370 0ustar bvhAutomatically regenerating dependency information

Chapter 4. Automatically regenerating dependency information

Every time you change a dependency relationship (for example when you include an extra header in some source file), you have to regenerate the dependency information manually by executing make .depend (as mentioned in the previous chapter deleting .depend also works)

Off course this is very error-prone. Why don't we let make regenerate the dependencies everytime one of the source files changes? Easy enough :

Example 4-1. Makefile fragment to generate dependencies each time a source file changes (wrong).

.depend: $(SOURCES)
	fastdep $(SOURCES) > .depend

-include .depend

This seems to work fine, but in fact doesn't. Suppose one (or more) of our source files in SOURCES includes a certain header foo.h. Now imagine that during an edit-compile cycle we don't change anything in the source files, but we added a new include of bar.h in foo.h. This means that the dependencies for each source file that includes foo.h must change. However since none of the source files themself change, make will find that .depend is still up to date and not regenerate it. The end result is incorrect dependency information.

To summarize, the dependency information of a source file not only depends on the source file itself, but also on all files it includes. Hence the earlier makefile fragment is incorrect.

To solve this problem, the info manual of GNU make proposes a solution where the output of the dependency generator is modified by piping it through sed. While this works for normal dependency generators like the GNU C/C++ compiler (and still works with fastdep), there is a much more elegant solution in fastdep. By adding the --remakedeptarget=file command line option fastdep will also emit a suitable dependency line for its own output.

Example 4-2. Makefile fragment to generate dependencies each time a source or included file changes (right).

.depend:
	fastdep --remakedeptarget=.depend $(ALLSOURCES) > .depend

-include dependinfo

The .depend file will now look like this :

file1.o: file1.cc \
	header1.h \
	header2.h \
	header3.h
file2.o: file2.cc \
	header1.h \
	header3.h \
	header4.h \
.depend: \
	file1.cc \
	header1.h \
	header2.h \
	header3.h \
	file2.cc \
	header4.h \

which is exactly how we want it to be.

fastdep-0.16/doc/c90.htm0100644000175000007640000000535207613620443012377 0ustar bvhAdding an external dependency

Chapter 5. Adding an external dependency

Suppose you change your Makefile. For example you add -O2 to the CFLAGS variable, because finally it's release time. Of course all object files have to be regenerated. The classical way to do that is

make clean
make

But isn't it easier to let all .o files depend on the Makefile itself? So that once you touch the makefile, all objects are immediatly out of date and thus regenerated. That's what the --extraremakedep= option is for.

Example 5-1. Adding an extra dependency to all targets

.depend:
	fastdep --extraremakedep=Makefile \
			  --remakedeptarget=.depend $(SOURCES) > .depend

-include .depend

Here is a possible result

file1.o: file1.cc \
	header1.h \
	header2.h \
	header3.h
file2.o: file2.cc \
	header1.h \
	header3.h \
	header4.h \
.depend: \
	file1.cc \
	header1.h \
	header2.h \
	header3.h \
	file2.cc \
	header4.h \
	Makefile
fastdep-0.16/doc/c100.htm0100644000175000007640000000464607613620443012454 0ustar bvhLinks and referencesfastdep-0.16/doc/fastdep.html0100644000175000007640000000476707613620443013617 0ustar bvhfastdep manualfastdep-0.16/doc/fastdep.pdf0100644000175000007640000007277507613620445013432 0ustar bvh%PDF-1.2 %Ç쏢 6 0 obj <> stream xœMÁnĂ Dď|Çôŕ5ť€žŞHý€DVďÄqâVväÄvýűjŇʲŢÎÎ @.ⷝÍŔîŹ<*~ŘcĺŁřžCÇIqy}ażkČ ˍ–ÁŠŘîâ§ů܎/ős œ’.čę3Ű ţĄ`„Ź6¸ř>ÂňˆČŃĄVŃ˝@2`­ĺI •JÚ˝D-9ÓmŽ(r9ç##ipCţÖůeőmÚw4úoâ%G§5mńX‰!žŔQž˘Đ€0•Îĺżť˘űeŠ˙Űçcé۲­Ěá”`át€2\ƒc•FÝ<ŻešŽkTT"žmŽO;˛ŕ„ŐvejŢÇ ŇłIá{ÍěŔ~W¨nĎendstream endobj 7 0 obj 281 endobj 14 0 obj <> endobj 15 0 obj <> endobj 19 0 obj <> stream xœ•Sˎ›@źósÜ蝞÷ä¸J¤Ź´‡Ź…rÇ0–‰lœěČ_–ßK3)ŮCÄQŐUŐd|˝ň˝;WoŐȕ[wfOMő¸CËŹ˜§‹‰ĂÂéžË1č žLí8ŸÚ%ôQ\-ˇ@}'—ě‡y™†}Vâ‚ëR3i@ä[pZš ?/Š)'­/yRF ÉIĆŚp íú_׹Óú^Ńj­(s—cL…tTY÷˧Ży —›Á—Ą ăŕŸ;Ƨ™5‰çĘwI—ƒuޘž ópIG‰œ+W´żPřËkŹĽ#Íz|4˜˙VÂԀ’Xś&85ňZ¸Ţ9YĘyG9-MЉđźP÷÷‘ŤAˆ­Ü¸.qŤévŒ)I*§Śby*äy–!ý3äY˜máżUÂTâ}nŘkőZý€:î endstream endobj 20 0 obj 482 endobj 25 0 obj <> endobj 29 0 obj <> stream xœí[MoÚ@˝űWř˜˜ěě÷“Şˇ^!őě€I݀IŔHíżďîâu ąmHƒŰQHogŸgĺÍóÚ0Ŕœ…żös˛Čž˛§#–>&‹üzœ]Ţr“sZY•gŮvćÁčÜ(í)Ƌěbüaü-CŽ…ˆń4ť(îÄXil‹ÍËcĚ%l9‹˜4Ž…>.댏›uX¸ź> endobj 37 0 obj <> stream xœíXMoŰ0 vôŻđ1=DŠďăôśZä؋g+‰ˇŘigëţý$Ůň’Ě]Ó!ŔR,ČÁŔ3ůD>R4J Ľţ×?ó*yLSX|äUúa–\ߥJ‘)´Hgó¤s€TQ2UB:ŠY•L>–›öjö%áH8jílfE2YĎ=†‚€2=tó”U+ťń/9چ‰’{ň)˘šŇéAěŮˆˇM(ö,Ÿ˛ŻDˆ }ˇ˛5DJĄztŢd‹ĘÖ!:Ś <Úˇë`íT04Z/lm›Ź <Ě%g0ćRŘ[śÎË.x—:UJ§ŹŤ+ 2˛e’ÄĆ"ToŤĎś ôH4ăfO*ŒŇNéŰŹˇMޝƀ rŠw/‚"H˜ĄBďC¨żAň%Ä3ą×ťœ6ÓË~ăT˙Ćq<ż‹RoUŠSflvňcšr@˘0ş‡‘çocćŘ,_†¤ÜĐ`CDmYŮÎř󓨛.ÁTŃ?&ä†6`Ź_žĚęE?‰8‘h q?ůŢŹëĹýUŒ9'ję‚ sţMvž×ńd›7>ô˝–rżńń˙müuÓG(ĺđ.ë|ľ-lŃG¨Ě ëŻk‚ě™k"čÎ5iĘĹ˛íŻ ú5‡•pš–ŻľŃťĽŁ3î}Q”ő˘ßN˜PĎę`ë–Éăa!N0ƒ|j› 7(wˆĂbö ˘’Ăˆřá!ĺj đ§FÉVŤşĺRaŰ,Œ3ʇ–jƒüŕF}ŒžCóžĘę8čÂuáz+\GÓ˙ëoâe{¸(užJ0ĺÝď¸ôĐőŰköţ0! ˜ĂŚÂ¸c°ŰYžyӛYz›Ü&?"r×Íendstream endobj 38 0 obj 633 endobj 39 0 obj <> endobj 41 0 obj <> stream xœWɎŰFrÔWčuz_rJb8€tô…Cq$Ć)sńx>$ߒßK5ťŤ¨ńЂ†Ĺ^jyďU5gbËăżü[ž7Ÿ7ŸˇbśáOyŢţąßüň—t[ə5Ţl÷›´Al`ÎnąpÄţźyőöT\ĆŞ˝˙{ăł^yXś?l^ mR2ďÚ~żďŚ1š­aJ‘ÍĹ0ŞKüŕ“ĘËüĄhѨ%SÜă!㊲UK˛ž‹6E&§˘‰FˆEn VZcŮ)řnť“!F—ţ‚W!Ȁˇ“WŇą 5zuŹÚŞ/Ć*yÁ—^çO°žjU[f_œ ¸ëiq'šęöĄëĎĹXwÉ÷Ŕ —x|ŠFĄ™Đ]zM a¤ÍŚîa^ƙóă~űćÍě6gŇQ8?5Écű˝Cë0ŐcqßTń‹RLke_8Ŕ鲺-›iČţ*ς!ë6űĄwT”OłŃ1ĄŒĘĆ*:’Ŕa˜=ٟŞ~vc§źb™íNHřĺ"U#}wŹÔˆœń1%Ä+ińŇ.%ژ%Ńç"yhÔBS}_ň‰ŇK‹cJ”, gWâCĐA*Úă|°G=-1îWAzÚ>ŒU1ĂŔ< 7ę7žVbm#VšĺLüĽďŽ}qN)¨ë- Őq!f¨K€¸KŔ0\ć-˙Źąţ4ÎbĘޏ?§ źÓ”ą9-–)c‘ł÷ HëĐ ÍěźbFSJSŠČFgĐ8v9t2Eş"ĽĐ4ľőç´bŃÎa–.E?TťŽ-çoڀV9ŮX•§śkşăL; ĺYˆ°ž( Rčüç(ĽČ*Ç1úS‘Hf˜ăK7\Ş˛ŚÚqoĹRťœ+ĆűĽF†I˜ôÓ5!)˙}wŸOŽN˜r fęţ?mJlsĚ:îĂYřŔš9…;ÉáV#!e€-ŸIœÄ9JUX)ç,Šڇ T†éœÉf˜ 7ÜC]fbqĄ0]ŸÚ.Çĺ á˙ąŠÇ*Îľp7ˆľ.H rN(r87žoŕşĆĘ9űšš :4ŐÍ!ßź0KŠËj@aQĆÝŇŮ+G/óŞďčź jšg‘čt b éˆę÷ŠÍ9` 15cFą”$Йš^-yj yˇÓÔúż¤œ@JčżkM=œrB@ďq-°%• äÚj9IC†cZqę^wé&)UŠÍ‰9aQőŮ&˜ˇÚ\ť¤AÎ9ţőRő50¤Jc‡(Á”ş° ÝŰľ€X‹7<öuƒ˛Ňr´3Ě'pďOӐӁ´őşiŕćáÔM K$^Ke§Ę”Ý9é#`ȓćf%‚faýłî4Č\ű+Œ.i č/}=$éH#RŇ‘~ęŚ p切őĂK5ÄY ˆ(%c…rŁ8ĘÍ×ńĺ-eنžůo6ÄRäńéQ~9ŐeŃĚ 0P@M52 VeR™ś4Ž1)ƒAuĹ#艸s¨Ď—ť ¸iňxđ<ŁUßw}ž€ *KľÝ'rJpžf` ’Ě@HŃňášwk÷ ĐFŤÂÍş€rŔ x&5&ćÝ Č2¤(I í]sŞyĘË §ÍM×}Âl*ńbu>UÍĺ.sˆkƒ%Ś#Ěn‘ C¨yěOß/;Ô.u` ­7ԯלŽÜrW’śFçŮýV@RE-46Čćł÷Ąďć´JĐ)AóěůéĽ÷0JVC0ľ['i&yH­C*íńćUşŽÎӏő‚YЍp3ĚC˛ÁLméúĄťËăˆs4Œ Uj§Đ§œ˘ Ł‚ŠźÉŞeazžqÓý ŘOťňo‘ř˙ˇşŸšŠÝ§×ÔŔëŽÉň1žšąűu>HYf,˝[VúřzôÔô]óěÖ@qÝ(Ż áH S}@Ý6–ľ•>{„‚/{F_ ÝÔ§ů˘ËscuVüA‘ëŸş ć ĄÂ׎…‘e--MUôíKW 0—扰y5k%€œî´óŔ¸yšˆ ßíˇ66˙ÁV7endstream endobj 42 0 obj 1540 endobj 43 0 obj <> endobj 45 0 obj <> stream xœľVKoăF zôŻĐq Ź™™á<{ܢ˝oŕ[ˇ­¤ÄjőđĘrÓüűRó’ˋöPäŕ€’Éďă ^°ĺ/ţVýîŰî[Á˝-ýT}ńé°{xŚ ´˛Ş8<í‚/ Ł Ł4…8ôť?ËÓÜL?ţŘYmŃŇąC˝ű `ą ÖşdűTžŰj1kÖ͗sšQ*ŠŁńy1qrM%ŤTçʧ͊kš#텓.Sď§…&ťżNíóqŽ@„bŠá繜›žü'j˛F­o`˜5NjDŽYzˇsS,ŐĐö}SˇĺÜ˝zęŠĚýô#ŢK&€Óŕ÷Üy€0†ĽIúśPŠóä{šĆúRy(A1›šATh†şźR¤ qć|Ż! 3k˜Űţ+–űżŠÂ9ܢĐć>žşĆ ;`:“e(Šžůn=ÇĄň`‘ƒĚ~ŻëtZĐ鏱l†+Á6ćąAĂę27[¢•‚†%Pw%u…v†úŽ’ćF××đ67ɛ➦ą÷mŕ`ynă¨$ÁĘLĚcÓu)´rćš2.ť÷ţ͚óĽ 'ˆF§Ź›˘ţÚÄ%aľL^ŚvžĎ$)8ĚĂ €QŸs-¤œĄ.§:.qîDú2^ćÓe†šLÄú5P EŠŠĆŔXŤž3Ó˛?…ýI 5Ęe™ůr-1bM_—ŽN]ĐZž)řáQąÂR?5Ĺ^6+͉. ¤ÍJű2 Š]Ś=ţäQĐvÔŠeáC˜3}@™>|ůâçä8H&ES¨pÇ›˛n&G_9‚Á|;G§dôNԙ+7ń/݌ŚuśşapŰ+oŁ.řĹ˝ÂÄ˙Z˜źĹ÷ߜdpşyř"×KńţEZY[edXK[—W¸r ńPÝHUą,ŐŔ÷ˇ|żœĂiĘć畞ž ¤[Ő´Č=ŽÁ3żłđ˜ÉG'şXŚŚňĚGZôBáś$™y'Iß\?ˇâǛ–^:×ű/=€œHŮ^ŽmuŒ7Şfůj§úâ˛˚Œš,‡¸ŐšÉˇB;TÝĽNŞ&šfUwQ™ŤĽĐ—ĆLsšŢPňš*4.čuťOrËŠ_ĹçÝçÝ?Ĺendstream endobj 46 0 obj 1070 endobj 51 0 obj <> endobj 53 0 obj <> stream xœWMoŰFrÔŻĐĄ@lŔÚî÷G=4Đý@˝řBK´ĹT˘‘Š“ßYîΐ4é8 rp°\íÎźyóć-gbÉăżüwsX|\|\Šn ˙lËß֋ŸßIˇ”œYăÍr}ťH?K'˜łKg,ą>,.^íŠűś<]Ž?,źbÖ+ŰÖŰŅbqMJć}ŔľOU[ŐwńƒłĚK#ň‡". Ǥľ./Š˙ĘŐéź/ťO\1‰›Űcw˛a…źÔ)ŕ.ÚTÖĺŠhťŻ”Ě;ł\I¸ÔwŸˇĺ}YoËz“N÷Ě™ů%Ç"´Ĺ¸ŤúśťR3ĎqŰńt(ÚęXÇ–\Ź´:‚ľ<ć-ŕĆáŠűßÔé*ć< šĂî˘ÜÇ p5Aă…m(ă*H ˘‰k a¤EÎ›]ŽĚz‹ż>O%‚$şIą ̈́2xŔ§¸¤YB(BŽ*ëî~€K{ŻF°C đĘkű˛ÍČkG}9ž;>Döô[ĄžŹ2t׋}ŮĽ%3œB¸TOÓzÚ]YŃáRP1RňŔĚ0[+5’bTu-Ą4A Ťîw‚‡žęĂ"Ż”•”[Ž Ý`ó–Ś-‹m'ěÇßo§ŐŢ3÷#u­–_ŠőÍ„ŐJܡ+ęî" dćÔ&ECĘ˛ŮœŞ›˛Ű­#N–îBŠŔ]éŠűÄ ˆŔxގgŹVž!ąz -`ʤ8t”>wßeű˛;Ţ2ȡwG[ڌ1xcS$ sœcl/t¨&pRsHŠIT渝ŽđJ)źľ˜.}ęلç§Ş¸IZ-­˝ tEć?DmC V}Š˙Ýj`F›ž"E›÷Ş^P÷UÓŚb{féPąßO[°6eŽˆŚ˝ąŰŽ’`žôPD ǃ`§Œ#˘ž˙űŸwŻ^żŸS6ĺ€hZ â†$>‘ŮM|,ąľľGąoŽ9mFý@9U')јœC%˘Œ‹ÜE2Ü$a‡),ĽÂçŚ[ƒŞ˝™M č1ĄÁ’AG‡hÉłCj˙ŇĹĎb{F§ Áu)M ß;œ€Z–xţÓ5ŞŐőe÷KđGŠ&ĘŻfpnÚApƒYešKŤŞŢěĎŰaíăđ}žďVy#¤ÄLśzy˘[ĺ8 íśÉžĹ)’’™áS—ÓI–›ĎP Ú┓ӊ.šKvě1Úcőüf ššjČîʆ‚Öd çŹéŹÂÍ5îî¸ßfdéĂŹ)y^ŚETű'eZyů¸—śšő€Üˆěœ÷ęř4QŽęI„Œ:ÁÉÍÁˇt|X••&ÓxvVŁi3„QÄiŸ˘oĎC賚­đŃďßAô^ďPo˝%˝ę(vşwsƒ<ˇQ—–ŠC½KTăř”)0cŐ(ĎąŻš%Ę-hp˙˜÷UU۔űô’ƒ Hç‡]YOmíŔ—Ó$KĘ1)˛eŸĄP,ß%Ą yůÍ-ś„ŚšÖÇ6sƒć#ň­óđĄĘ‚yHäúš4÷śxqjÚÉ×ç_'ŕ:Š‹g!ŸĘsśźš/7Ջr{}y•ľŽA8Ne*ÖâĘš'ę„xäÇzÁ$űé74nFq…ńC§~Nĺ[9cqśŢ)%n H“?ŁĹe‘Eq¤ímu(óŞ´j‚—„ŇŔ÷R_=ç{=8îřŔŐ~hޞS0ޓ¨ÍéÓ\Ä?ţܚ›ŰăTq‡#Ľ~_f vÄp3&鏽čęzQœ\™z+ĺ-DiDzž/ÎufRbžŸŃgę‘$ŰřĚ+ €FDōŻ×ˡ‹ˇ‹˙sŠFendstream endobj 54 0 obj 1615 endobj 55 0 obj <> endobj 57 0 obj <> stream xœíZKŰF|œ_ĄC€#Łvżv‰alŮą'ČEZ⌸–H…¤<ńţú­f?Ř=jɲÝÓÂ-˛Y]őŐW_UFdí?˙˙zóÇÍ 2­…˙ÖűĹ÷7ŻŢRľ IĄĹâţáĆ˝@Š %JHŘâ~sűz[Ćşy˙Ż͐ÔLĂc÷››[ŽěĽHkÖžˇK„#Ş8ńKÇąŰWcłŽvťéGŹ‘PÔ˙řiZRˆJŠüR_?ÚEF“ĚřĹş­{ؤ~ZRedą¤>>=°ŠuťŠŰuř†4ĎżA¸ f6íĂd;G‡ÇşŢšŮľöđ ]d$•ÜúfI°=Śý˘ąŢąĎżů8íKŚ:ěQ÷îcL‚ícłŻ§ŻAP8ăÁŞîčíâ&.ގUű8=Ě 0Š ż^Ů%8+cq);0§`U~`…°"„F§îŚĂ Űć0˝`Ŕ4X¸ş}čzo ƒ„ÓLO"FXŒůŸŐţ°sL„ †?mëÖ{k-OÎČT†Ź~ő–e9ŕ€üńăŚoh¤pDLŹáťI€‘;v)•™@FE|­nŤÁ; č!ž´n­ ęiÎáX„g ĘĂTtüÁl:RÁÇŚ;yšÇpX*3gÂáď“)zNƒŤŢTC!tuۡ!xŘćťą,‰€LĽg pćnך°Ůt‘:Šœ%A”ÄÜř§+ˆTżpŔŞ”"@९-ŸL[ƒmÚ猯´Ľ Ăšĺç⫑žs§ŽÖŰSŻDĺA•‘Š ŒÄęicăO)Md-(ȉ: g„ěc”ĺŃňHĽ˜?­nŸz-cčÚÇŐKTâ4ŕr›iBěŸŰIŽm…ńť|łş}÷Ëoo_żyçYŠ3@-VŔbâź_ #l0˝lŽ4řümźĂTđÇßBdŒ Ož†€ QdžËDÔdF^ ĺĽp j˛}úŢÓ" *#9 u˝wː~TŤçđžLă>`ٗm}祪 ń~ďA%„ĽăxZîb L>ň'„„YŽĄ<ľ>_L9Nyç_¨ˆí+ťä„jłq2Řfäh‹RĎĹ7o}JX8×ţš¤,äO’¤ďŤţ Rm§˘s†şœŠ_ú„ĽĄŸ J]ľƒ¨Ąœ^D¸é’)Š¤Î’ţ˛Ž{(Ń\,ţŕ+{šó9-ŕe+Sţ9é>R>:ďË,,űă0žŠ—=NŁO%:üđc‰\‚$a:B´(d=şąŠy4Ŕqœ;@ÚžŇúzFÉźT!>“ˆKŚ1œĽÁ,‹[Řh?Ôť_Ű4Î]qç]M[řáRĄČ\ž?d Ć>˙…Óůź$Dü$I Ď|tšŤLäTŠwĆŮAb“1>÷ƒ-łń28'ęĘ&Ťţm7LĎ-aŇSiŠQŃ8B&ö;Üű€gŽŤŁÚDúz8îF‡P°F¸”öÍEÉ9ĆŽďk'’%żn˛—ŒlŚ#,V;iz?‘˘Já(u‚ŘšwŽű}Ő7˙vŕe*˜$'¸˙ď̕JšV¨/_ÂgE@t­›]Yގ3NwŽ ą–óÓŚ Ńى'ŽękOíjF›÷ŽBCKD"…': ÄUhhŻÂDeŠ˘8ÂI F„™;$Ű ˝2)5Ó紝sĐçŔ‘3tŔ4"ţÇ:°Š0Iš+`ĽŽú]ㇳđôLeZ›ŰhÁ‹m4XÂUÜäbvš”€f 1™ŽŻŽĚŠn÷Ń'ť˜›Ăď&ó,ƒƒ‡ž{żŤ÷wŢdP˝dsÄGJ;‹.˛C×sj)Ošüü›G6ćKKXkű­!đ‘”sqw ɜ+ú§míˆ×^Íp}1sşăxp(Ÿ4ť˘ř‚bšä|Q1]EEž8eg=\_ŇžŰ4/œÎI:Žź“*vhłŞOÎSJ­qŰljCœĹ‘áPoÂŔ şŽ°úűÖ÷7vŔć@ wgfš>§¤ˆ0œĹ$Ś‘‰ZKÔpŘŢöĚŸf/“ÔËPř@ƒĽq‰žž>ÍTŃ8|Ü5B˝e˜ç¨ĚnEJ¸)âüőŤ×ß~;-ČŞyčZĂţ4‚Ť %˛zpF´\íÓ§f Z<šě+ŒGŚš”żX$łé1Śp9‰łĚžŮ(/OÍýŃ7–ržŃčúYűFŹŐť §Ž>V­W2ZÚYv~q–ĺ˝dff/Ď´Ĺ:sę0gsîýđɇ9o=C:ŮR=ĂÄóąnŽ‘ĺ˛÷GKŻg=R×|ö˜4V!ԎN‚wëńŻžÜ"AAaą‡í=˜ěˆaŢ ™ôUÝ!ř0ç‰sţŠOFšéü(p]$Žţ÷ŽňĄb屝•ňL\ ÇfŹŢű;^`&söËx69zŇP)T‘•žG÷ÝŹˆâ%s{ކ  –€%do§Ž›óÓ˙Ďů“9Ň'™ľy9¸ FĎ)ŕ=Ő2UgŐůÂÝ@ßÇmF'=-aśV7|łşýţ§Ÿ˛[%ŇŃßgn¨•&ŔĂ×Ü ¸×‚äťęj .š)ďMŻž.6' ŠhEf=ŕʎŚ42faʎëş'ĹôR•OkVQĆ|W„‘śKÓÉŃ”w‚şÓ "÷Ăzí`ą˜ŻVSź 6’“FnXNÜ0K0Z‘FýKańä%ú5/1÷Ň2 YÍG˘çŽD˙gGbç_Žĺů_Uöa ’ÁńŠ}ęÍýâכ_oţťSAendstream endobj 58 0 obj 2740 endobj 59 0 obj <> endobj 61 0 obj <> stream xœSMÓ@ ˝çWĚq9Ä{žšâl•ă^B:%Amş[‚ ˙ĎLŚ´BŹĺ0ŇłŸýěĂQźďšÍVi X˛ZtűŚP7€$?ŽÇćáĂŘ?/ńüŚűŇ(ŽĄSœŘíš ă­[ąw 2ŕ“f…ž-§cżLC8üČQ˛TŁĽ.hg,ŽPLé” +ôš@k÷8MčŔ˘Şĺ¸Ńœ“‰Ŕ9Ş˛vń9Îť8Y ýUÁ4ďOç¤đ4§ŕfk¤đźŤ|ZLŤ,Ż‚+ľ¤™–)cěwńŹaĚó(p*řľÚÓSÂZŘ"‚ł9EÄŰŹŔƒśtOŃ $c‰‘~ öÓ!" Ăťaařš°üDKR!ÜĐÔżőJ#ŃŒôĘŽ7[˘['˙Ú={ PÎźŒÓ Ż}őĐôľ8ѐ˝wŸBĽjŸďý°ď2Ýѕ>ž Ý]v) Şy/š$j@Í oŇ\ň¸ŹčçeÍł¤ë-Ló U *gÉm‘<ČÚöS„˛‹űŤ&ÇŚâŃZcňY§T“?vâąyl~‡ů{endstream endobj 62 0 obj 438 endobj 63 0 obj <> endobj 65 0 obj <> stream xœľWKoŰFrÔŻĐĄ€ Üîű -Ăi)ŒÄę͗5š˛˜H¤"Rýď;ܗ(S1œCŕƒ€áĚîĚ|ß|łĆˆĚńđËÍěŰěۜx[ú)7ó÷‹ŮšSŒ¤ĐbžXÎB™+‚”œ+!áˆĹfv~š˛ŰŢí^/žĚ4CR3 n‹jv.Đ`Łim’í˘ň6…($ÚŞşšŹÜ &e˛ÚĆ{¤šJŃn0‚—ÉôW7v=|P ŤH§ş­k*ה>k$ Ÿ”GçI%Ę+˜ĐHČyWB}ƒßÍ~ťm;)ƒj M—>ś{ŞBÜ0ĺĘ6÷ÁšŚ˜88űć ­„<˘őűŐĄĽ$%ć^­]j2™? &˜1ÔDSť e!ĽsĹţnŽa‚ťŮŽCN€š0|RSš[ypˆDÚ@#‚ą¸ŚŃÓh’nęŰx;1X%Ű* Ă‘¤<xůáㅯG ,y:óŻď)e”EŰ!yeÉ ŘŐöníŢÄôÉ•ŢšŇî#0 AH*áPaíá-˜H(:/1ńßëţĚóQĹ n0Iன˝;ˇvśK`bYŮכŒéÚëĽ/.8Ó`'PŕMXB~ї šŇŢ}qeď}Ąů\§Ě€>9b }*%ˇ˛ƒÍqxžĄŘžĄ{lL8Ž1önwi¨´ä"—ďç XŒóěÝťĆílď*_>‡I'Ůą?"Išś]W—a6a~(féÎďáxœ!°Ó$N%[ľąy\ćŽö+Ű'2ħî <׀ż„~Čp 3˜r‚oěW—:ŻHÎÝý)˘š€Ü$ ŕQČS N€Ć,>ÎÎßďű×gĂ$,sBÍY-sš}m"LžöşĹě 8@Ć:H,L’Ů~ŞGk×§&)Ş&´Qˆd8‘ęYĘ1ƒHUŹśIdć#<’(ž…ŕ‡rď\¨\çÖË?#&Šéôá&ˀ7yĘNƒß6eŔ” –%óHóXnŕž\yWâ/ů¤†‘˜mb &ب†7SɎý.8pĽ‰*4ö.- ÍR‚vwâŇzłqUmű j\!Mók÷}RJňfXN7Cs›@*YmsBďűŐž›şžH¸ ‚ J `ŁÓáQi™8(í÷ 8j’çďd˙‹"IŚ:őŕĄßAß"4#Uâ‹Öž‹4â:çÝnű:đž!†>Q ƒy+-ăžőOŽ45aôŮńë 沀C5÷ŽW‡í ‰Šóè (MÁŠ’‹*=„‡Ů#ytӌ–‹ʞŇ6ży> endobj 69 0 obj <> stream xœÍTÉnŰ@ ˝ë+tLˆš}ÉąEŃÚ)Ü[€@—Z‹c+ő4JR].AĄƒ€7ňńń đœ ßôMö=䜰ô Mţf‘•_„ÍŁÎŤlźŔsËÁšÜjƒ)MvńvSíűx¸\|˜ă¤Ă°Ĺ2ť00`B€s>aˇíî8ŔڃąÎLpŐ.P PÂĽŘC\Q,¤˜ŸŔxˆmˆ” ŠÜƒ7¨`!¤‡XĄ0Gá”A‚VĽRÇ~÷l(%L^p‹éđC×Ä}ľŽDFcëVN×n/ZBšíxbs""\´ę…°(Ň.ťó=TuşÜÖ]ľź˝$Š ź7ŠókR„ő&ŃŢôýţş,O§qĂFĽOÉa{xŹ#ÜÇňž(oS•ď›2\]•ŤŠŠ–ŒżP˘ ‰*ŁĆNË :}˙ů+Š/Á[ŸŽ„ŽŮoëqŘUłFĎ'uCżíZ˘€á‚ĎÚ­Cű,¤F­‘\Á˙¤řżŠ°nĄ#ft2U_—ÇnŐÓ PvÔ!–kÂ^Ľ™†PŽE3l}6^€MßL†VL§žkęJ …čs+}ŞÚNJN%jjôĐÖ8ÁA—ěQo۸<îÂq4†° ¤VôŚ~猦ÚQ \νĆéýjŁ˙ň™˝Š:iŒFŤލďS*ĽSŽ)cE3/ľ_†98=ƒ}3Y 1űşÎh°ÂÔş×V$ęu9M Gň´lbůděgŠÔwas>ŃyŐż´KJŒ(.˝”řŽďšăŇ;ÂÄŢÎ;˘7şTĎ7:gz˜šĎp`Šířn‘ßd7Ůşg Őendstream endobj 70 0 obj 623 endobj 71 0 obj <> endobj 5 0 obj <> /Contents 6 0 R >> endobj 18 0 obj <> /Contents 19 0 R >> endobj 28 0 obj <> /Contents 29 0 R >> endobj 36 0 obj <> /Contents 37 0 R >> endobj 40 0 obj <> /Contents 41 0 R >> endobj 44 0 obj <> /Contents 45 0 R >> endobj 52 0 obj <> /Contents 53 0 R >> endobj 56 0 obj <> /Contents 57 0 R >> endobj 60 0 obj <> /Contents 61 0 R >> endobj 64 0 obj <> /Contents 65 0 R >> endobj 68 0 obj <> /Contents 69 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 5 0 R 18 0 R 28 0 R 36 0 R 40 0 R 44 0 R 52 0 R 56 0 R 60 0 R 64 0 R 68 0 R ] /Count 11 >> endobj 1 0 obj <> endobj 4 0 obj <> endobj 17 0 obj <> endobj 47 0 obj <> endobj 13 0 obj <> endobj 48 0 obj <> endobj 11 0 obj <> endobj 9 0 obj <> endobj 33 0 obj <> endobj 34 0 obj <> endobj 31 0 obj <> endobj 32 0 obj <> endobj 72 0 obj <> endobj 26 0 obj <> endobj 16 0 obj <> endobj 12 0 obj <> endobj 10 0 obj <> endobj 8 0 obj <> endobj 27 0 obj <> endobj 49 0 obj <> endobj 23 0 obj <> endobj 21 0 obj <> endobj 50 0 obj <> endobj 24 0 obj <> endobj 73 0 obj <> endobj 22 0 obj <> endobj 74 0 obj <> endobj 2 0 obj <>endobj xref 0 75 0000000000 65535 f 0000015034 00000 n 0000028574 00000 n 0000014904 00000 n 0000015082 00000 n 0000013304 00000 n 0000000015 00000 n 0000000366 00000 n 0000023613 00000 n 0000019754 00000 n 0000023548 00000 n 0000018615 00000 n 0000023483 00000 n 0000016342 00000 n 0000000385 00000 n 0000000415 00000 n 0000023418 00000 n 0000015137 00000 n 0000013464 00000 n 0000000467 00000 n 0000001021 00000 n 0000024936 00000 n 0000027352 00000 n 0000024874 00000 n 0000026124 00000 n 0000001041 00000 n 0000023353 00000 n 0000023677 00000 n 0000013608 00000 n 0000001095 00000 n 0000001939 00000 n 0000022086 00000 n 0000022147 00000 n 0000020891 00000 n 0000020954 00000 n 0000001959 00000 n 0000013752 00000 n 0000002013 00000 n 0000002718 00000 n 0000002738 00000 n 0000013896 00000 n 0000002792 00000 n 0000004404 00000 n 0000004425 00000 n 0000014040 00000 n 0000004490 00000 n 0000005632 00000 n 0000016276 00000 n 0000017481 00000 n 0000024816 00000 n 0000024998 00000 n 0000005653 00000 n 0000014184 00000 n 0000005740 00000 n 0000007427 00000 n 0000007448 00000 n 0000014328 00000 n 0000007524 00000 n 0000010336 00000 n 0000010357 00000 n 0000014472 00000 n 0000010433 00000 n 0000010943 00000 n 0000010963 00000 n 0000014616 00000 n 0000011017 00000 n 0000012438 00000 n 0000012459 00000 n 0000014760 00000 n 0000012535 00000 n 0000013230 00000 n 0000013250 00000 n 0000023299 00000 n 0000027273 00000 n 0000028501 00000 n trailer << /Size 75 /Root 1 0 R /Info 2 0 R >> startxref 28626 %%EOF fastdep-0.16/doc/fastdep.10100600000175000007640000000520207747772055013003 0ustar bvh...\" $Header: /aolnet/dev/src/CVS/sgml/docbook-to-man/cmd/docbook-to-man.sh,v 1.1.1.1 1998/11/13 21:31:59 db3l Exp $ ...\" ...\" transcript compatibility for postscript use. ...\" ...\" synopsis: .P! ...\" .de P! .fl \!!1 setgray .fl \\&.\" .fl \!!0 setgray .fl \" force out current output buffer \!!save /psv exch def currentpoint translate 0 0 moveto \!!/showpage{}def .fl \" prolog .sy sed -e 's/^/!/' \\$1\" bring in postscript file \!!psv restore . .de pF .ie \\*(f1 .ds f1 \\n(.f .el .ie \\*(f2 .ds f2 \\n(.f .el .ie \\*(f3 .ds f3 \\n(.f .el .ie \\*(f4 .ds f4 \\n(.f .el .tm ? font overflow .ft \\$1 .. .de fP .ie !\\*(f4 \{\ . ft \\*(f4 . ds f4\" ' br \} .el .ie !\\*(f3 \{\ . ft \\*(f3 . ds f3\" ' br \} .el .ie !\\*(f2 \{\ . ft \\*(f2 . ds f2\" ' br \} .el .ie !\\*(f1 \{\ . ft \\*(f1 . ds f1\" ' br \} .el .tm ? font underflow .. .ds f1\" .ds f2\" .ds f3\" .ds f4\" '\" t .ta 8n 16n 24n 32n 40n 48n 56n 64n 72n .TH "FASTDEP" "1" .SH "NAME" fastdep \(em fast dependency generator for C/C++ .SH "SYNOPSIS" .PP \fBfastdep\fR [options] file .SH "DESCRIPTION" .PP This manual page documents briefly the \fBfastdep\fR command. .PP This manual page was written for the \fBDebian\fP distribution because the original program does not have a manual page. Instead, it has html documentation in HTML format; see below. .PP \fBfastdep\fR is a dependency generator for C and C++ files. It generates dependencies an order of magnitude faster than using gcc to do such. .PP \fB Example Makefile fragment: \fR .PP .nf .ta 8n 16n 24n 32n 40n 48n 56n 64n 72n _depend: \ \ \ \ \ \ \ fastdep $(SOURCES) > _depend -include _depend .fi .SH "OPTIONS" .PP This programs follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. .IP "\fB-v\fP \fB--version\fP " 10 Show version, author, license of program. .SH "SEE ALSO" .PP make (1), cook (1), gcc (1), dep.pl (1), cvs (1), aegis (1). .PP The program is documented fully at \fI/usr/share/doc/fastdep/html/fastdep.html\fP. .SH "AUTHOR" .PP This manual page was written by Zenaan Harkness zen@freedbms.org for the \fBDebian\fP system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation. .PP On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. ...\" created by instant / docbook-to-man, Wed 22 Oct 2003, 09:06 fastdep-0.16/doc/fastdep.sgml0100600000175000007640000001124207747772050013601 0ustar bvh manpage.1'. You may view the manual page with: `docbook-to-man manpage.sgml | nroff -man | less'. A typical entry in a Makefile or Makefile.am is: manpage.1: manpage.sgml docbook-to-man $< > $@ The docbook-to-man binary is found in the docbook-to-man package. Please remember that if you create the nroff version in one of the debian/rules file targets (such as build), you will need to include docbook-to-man in your Build-Depends control field. --> Zenaan"> Harkness"> October 19, 2003"> 1"> zen@freedbms.org"> FASTDEP"> Debian"> GNU"> GPL"> ]>
&dhemail;
&dhfirstname; &dhsurname; 2003 &dhusername; &dhdate;
&dhucpackage; &dhsection; &dhpackage; fast dependency generator for C/C++ &dhpackage; options file DESCRIPTION This manual page documents briefly the &dhpackage; command. This manual page was written for the &debian; distribution because the original program does not have a manual page. Instead, it has html documentation in HTML format; see below. &dhpackage; is a dependency generator for C and C++ files. It generates dependencies an order of magnitude faster than using gcc to do such. Example Makefile fragment: _depend:     fastdep $(SOURCES) > _depend -include _depend OPTIONS This programs follows the usual &gnu; command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. Show version, author, license of program. SEE ALSO make (1), cook (1), gcc (1), dep.pl (1), cvs (1), aegis (1). The program is documented fully at /usr/share/doc/fastdep/html/fastdep.html. AUTHOR This manual page was written by &dhusername; &dhemail; for the &debian; system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the &gnu; General Public License, Version 2 or any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.
fastdep-0.16/Expression.h0100644000175000007640000000076607747765160013057 0ustar bvh#ifndef EXPRESSION_3C96529467795A46_H_ #define EXPRESSION_3C96529467795A46_H_ class CompileState; #include class Expression { public: Expression(const std::string& anExpression, CompileState* aState); int evaluate(); private: int boolean(); int equality(); int relational(); int additive(); int multiplicative(); int factor(); int macro(); void ws(); bool token(const char* aToken); std::string Text; CompileState* theState; unsigned int Pos; }; #endif fastdep-0.16/LICENSE0100644000175000007640000000033307613336303011523 0ustar bvhfastdep is licensed under the GNU public library as found in the COPYING file included in this package. A local copy of libgnugetopt from FreeBSD, derived from GNU libc is included, also under the GNU public license. fastdep-0.16/Expression.cc0100644000175000007640000001175207747767731013220 0ustar bvh#include "Expression.h" #include "CompileState.h" Expression::Expression(const std::string& anExpression, CompileState* aState) : Text(anExpression), theState(aState), Pos(0) { } int Expression::evaluate() { Pos = 0; ws(); int Result = boolean(); if (Pos < Text.length()) // TODO error ; return Result; } int Expression::boolean() { int Left = equality(); if (Pos == Text.length()) return Left; if (Text[Pos] == '|') { ++Pos; if ( (Pos == Text.length()) || (Text[Pos] != '|') ) // TODO error return Left; ++Pos; ws(); int Right = equality(); return Left || Right; } if (Text[Pos] == '&') { ++Pos; if ( (Pos == Text.length()) || (Text[Pos] != '&') ) // TODO error return Left; ++Pos; ws(); int Right = equality(); return Left && Right; } return Left; } int Expression::equality() { int Left = relational(); if (Pos == Text.length()) return Left; if (Text[Pos] == '=') { ++Pos; if ( (Pos == Text.length()) || (Text[Pos] != '=') ) // TODO error return Left; ++Pos; ws(); int Right = relational(); return Left == Right; } if (Text[Pos] == '!') { ++Pos; if ( (Pos == Text.length()) || (Text[Pos] != '=') ) // TODO error return Left; ++Pos; ws(); int Right = relational(); return Left != Right; } return Left; } int Expression::relational() { int Left = additive(); if (Pos == Text.length()) return Left; if (Text[Pos] == '<') { ++Pos; if ( (Pos < Text.length()) && (Text[Pos] == '=') ) { ++Pos; ws(); if (Pos == Text.length()) return Left; // TODO error int Right = additive(); return Left <= Right; } ws(); if (Pos == Text.length()) return Left; // TODO error int Right = additive(); return Left < Right; } if (Text[Pos] == '>') { ++Pos; if ( (Pos < Text.length()) && (Text[Pos] == '=') ) { ++Pos; ws(); if (Pos == Text.length()) return Left; // TODO error int Right = additive(); return Left >= Right; } ws(); if (Pos == Text.length()) return Left; // TODO error int Right = additive(); return Left > Right; } return Left; } int Expression::additive() { int Left = multiplicative(); while (Pos < Text.length()) if (Text[Pos] == '+') { ++Pos; ws(); int Right = multiplicative(); Left += Right; } else if (Text[Pos] == '-') { ++Pos; ws(); int Right = multiplicative(); Left -= Right; } else break; return Left; } int Expression::multiplicative() { int Left = factor(); while (Pos < Text.length()) if (Text[Pos] == '*') { ++Pos; ws(); int Right = factor(); Left *= Right; } else if (Text[Pos] == '/') { ++Pos; ws(); int Right = factor(); if (Right == 0) // TODO error Left = 0; else Left /= Right; } else break; return Left; } int Expression::factor() { if (Pos == Text.length()) return 0; if (Text[Pos] == '!') { ++Pos; ws(); return !factor(); } if (Text[Pos] == '-') { ++Pos; ws(); return -factor(); } if (Text[Pos] == '(') { ++Pos; ws(); int Result = factor(); if ( (Pos == Text.length()) || (Text[Pos] != ')') ) // TODO error ; else { ++Pos; ws(); } return Result; } if ( (Text[Pos] >= '0') && (Text[Pos] <= '9') ) { int Result = Text[Pos]-'0'; ++Pos; while ( (Pos= '0') && (Text[Pos] <= '9')) ) Result = Result*10 + Text[Pos++]-'0'; ws(); return Result; } if (token("defined")) { if ( (Pos == Text.length()) || (Text[Pos] != '(')) // TODO error return 0; ++Pos; ws(); unsigned int To = Pos; while (To < Text.length()) { char c=Text[To]; if ( ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')) || c == '_') ++To; else break; } int Result = 0; if (Pos < To) { std::string Macro(Text,Pos,To-Pos); if (theState->isDefined(Macro)) Result = 1; Pos = To; } if ( (Pos == Text.length()) || (Text[Pos] != ')')) // TODO error ; else { ++Pos; ws(); } return Result; } // TODO error return macro(); } int Expression::macro() { std::string Name; while (Pos < Text.length()) { char c = Text[Pos]; if ( ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')) || c == '_') { Name += c; ++Pos; } else break; } if (Name != "") { ws(); Expression E(theState->getContent(Name),theState); return E.evaluate(); } else // TODO error return 0; } void Expression::ws() { while ( (Pos < Text.length()) && (Text[Pos] == ' ') ) ++Pos; } bool Expression::token(const char* aToken) { unsigned int OrigPos = Pos; for (int i=0; aToken[i]; ++i,++Pos) if ( (Pos == Text.length()) || (Text[Pos] != aToken[i]) ) { Pos = OrigPos; return false; } if (Pos < Text.length()) { char c=Text[Pos]; if ( ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')) || c == '_') { Pos = OrigPos; return false; } } ws(); return true; } fastdep-0.16/tests/0040755000175000007640000000000007747773171011704 5ustar bvhfastdep-0.16/tests/b.h0100644000175000007640000000010107445440026012244 0ustar bvh#ifndef B_H_ #define B_H_ #include "c.h" #include "e.h" #endif fastdep-0.16/tests/a.cc0100644000175000007640000000003607445440067012415 0ustar bvh#include "a.h" #include "b.h" fastdep-0.16/tests/a.h0100644000175000007640000000006207445437726012266 0ustar bvh#ifndef A_H_ #define A_H_ #include "c.h" #endif fastdep-0.16/tests/c.h0100644000175000007640000000006207445437754012271 0ustar bvh#ifndef C_H_ #define C_H_ #include "d.h" #endif fastdep-0.16/tests/d.h0100644000175000007640000000004207445437772012270 0ustar bvh#ifndef D_H_ #define D_H_ #endif fastdep-0.16/tests/good/0040755000175000007640000000000007612561771012624 5ustar bvhfastdep-0.16/tests/good/a.cc.out0100644000175000007640000000005507445440226014151 0ustar bvha.o: a.cc \ a.h \ c.h \ d.h \ b.h \ e.h fastdep-0.16/tests/good/b.cc.out0100644000175000007640000000002107445456376014160 0ustar bvhb.o: b.cc \ e.h fastdep-0.16/tests/good/c.cc.out0100644000175000007640000000003007445461776014161 0ustar bvhc.o: c.cc \ f.h \ g.h fastdep-0.16/tests/good/macrodef.cc.out0100644000175000007640000000005507461747021015512 0ustar bvhmacrodef.o: macrodef.cc \ a.h \ c.h \ d.h fastdep-0.16/tests/good/asterix_comment.cc.out0100644000175000007640000000007307464267716017146 0ustar bvhasterix_comment.o: asterix_comment.cc \ a.h \ c.h \ d.h fastdep-0.16/tests/good/parentdir.script.out0100644000175000007640000000014207504175464016642 0ustar bvh../foo.o: ../foo.cpp \ /home/bvh/src/fastdep/tests/foo.h \ /home/bvh/src/fastdep/tests/barcfg.h fastdep-0.16/tests/good/commentindefine.cc.out0100644000175000007640000000007307612561771017102 0ustar bvhcommentindefine.o: commentindefine.cc \ a.h \ c.h \ d.h fastdep-0.16/tests/e.h0100644000175000007640000000004207445440113012250 0ustar bvh#ifndef E_H_ #define E_H_ #endif fastdep-0.16/tests/run.sh0100755000175000007640000000052407504166377013040 0ustar bvh#!/bin/sh runonetest() { echo "Testing " $1 rm -f last/$1.out ../fastdep $1 > last/$1.out diff -u good/$1.out last/$1.out } runonescript() { echo "Testing " $1 rm -f last/$1.out ./$1 > last/$1.out diff -u good/$1.out last/$1.out } mkdir -p last for i in *.cc; do runonetest $i done for i in *.script; do runonescript $i done fastdep-0.16/tests/f.h0100644000175000007640000000004207445456223012262 0ustar bvh#ifndef F_H_ #define F_H_ #endif fastdep-0.16/tests/b.cc0100644000175000007640000000020507445456350012416 0ustar bvh#if 1-5+2*2+8-16/2 #include "b.h" #endif #if 10<20 #include "e.h" #endif #if 20==10 #include "f.h" #include "notexistant.h" #endif fastdep-0.16/tests/g.h0100644000175000007640000000004207445461761012266 0ustar bvh#ifndef G_H_ #define G_H_ #endif fastdep-0.16/tests/c.cc0100644000175000007640000000022707445461706012424 0ustar bvh#define F #if defined(A) #include "a.h" #elif defined(B) #include "b.h" #elif defined(F) #include "f.h" #endif #if !defined(G) #include "g.h" #endif fastdep-0.16/tests/macrodef.cc0100644000175000007640000000014707461747037013765 0ustar bvh#define BUFSIZE 1001 #if BUFSIZE==1001 #include "a.h" #endif #if BUFSIZE==1000 #include "b.h" #endif fastdep-0.16/tests/asterix_comment.cc0100644000175000007640000000045507464267045015407 0ustar bvh/*************************************************************************** * * HEADER: * * AUTHOR: * * * **************************************************************************** * * DESCRIPTION: * * * ****************************************************************************/ #include "a.h" fastdep-0.16/tests/foo.h0100644000175000007640000000004607504166550012621 0ustar bvh#ifndef FOO_H_ #define FOO_H_ #endif fastdep-0.16/tests/barcfg.h0100644000175000007640000000005407504166572013265 0ustar bvh#ifndef BARCFG_H_ #define BARCFG_H_ #endif fastdep-0.16/tests/parentdir.script0100755000175000007640000000006607504175437015114 0ustar bvh#!/bin/sh cd bar ../../fastdep -I .. ../foo.cpp cd .. fastdep-0.16/tests/foo.cpp0100644000175000007640000000004507504166466013161 0ustar bvh#include "foo.h" #include "barcfg.h" fastdep-0.16/tests/bar/0040755000175000007640000000000007504175417012436 5ustar bvhfastdep-0.16/tests/includeguard.h0100644000175000007640000000011207556511461014500 0ustar bvh#ifndef _TEST #define _TEST 1 #include "includeguard.h" #endif fastdep-0.16/tests/stdio.cpp0100644000175000007640000000007307556514737013526 0ustar bvh#include "features.h" #include int main() { } fastdep-0.16/tests/features.h0100644000175000007640000000010707556514452013657 0ustar bvh#ifndef _FEATURES_H # define _FEATURES_H 1 #include "cdefs.h" #endif fastdep-0.16/tests/cdefs.h0100644000175000007640000000011607556513451013123 0ustar bvh#ifndef _SYS_CDEFS_H #define _SYS_CDEFS_H 1234 #include "features.h" #endif fastdep-0.16/tests/incstdio.cpp0100644000175000007640000000004307564472656014217 0ustar bvh#include int main() { } fastdep-0.16/tests/commentindefine.cc0100644000175000007640000000007107612561455015341 0ustar bvh#ifndef symbol /* some comment */ #include "a.h" #endif fastdep-0.16/TODO0100644000175000007640000000010507613336501011203 0ustar bvh- Find out standard include directory - sizeof() in #if expressions fastdep-0.16/COPYING0100644000175000007640000004313107445466003011560 0ustar bvh GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. fastdep-0.16/config/0040755000175000007640000000000007747772463012012 5ustar bvhfastdep-0.16/config/configure0100755000175000007640000000070507747771056013715 0ustar bvh#!/bin/sh # configure script to glue .sh single issue configures for i in *.sh do . ./$i done for i in $@ do if [ "--help" = "$i" ] then echo Usage echo echo -e "\tconfigure [options]" echo echo -e "where options is on or more of" echo for i in *.sh do ${i%\.sh}_help done exit 0 fi done rm -f config.me for i in *.sh do ${i%\.sh}_commandline $@ done for i in *.sh do ${i%\.sh}_go $@ done echo Succesfully configured fastdep-0.16/config/link.mk0100644000175000007640000000045407476717507013275 0ustar bvh# # link_cc macro # # arguments : # binaryname # linker flags # object files # # example use : $(call link_cc, a.out, -O2, main.o menu.o load.o save.o) # ifeq ($(HOST_SYSTEM), cygwin) link_cc = echo $(3) > linkfiles; g++ $(2) -o $(1) @linkfiles else link_cc = g++ $(2) -o $(1) $(3) endif fastdep-0.16/config/Makefile.macros0100644000175000007640000000014707476717507014731 0ustar bvhinclude config/link.mk -include config/config.me config/config.me: sh -c "(cd config; ./configure)" fastdep-0.16/config/fastdep.sh0100644000175000007640000000166407570727007013764 0ustar bvh#!/bin/sh # Shell script to detect fastdep (http://www.irule.be/bvh/c++/fastdep/) # # Sets FASTDEP_BIN # setp 1 : check command line fastdep_commandline() { for i in $@ do value=${i#--with-fastdep=} if [ ${#i} -ne ${#value} ] then fastdepcheck=$value nofastdepcheck= fi value=${i#--without-fastdep} if [ ${#i} -ne ${#value} ] then nofastdepcheck=true fi done } fastdep_go() { if [ -z "$nofastdepcheck" ] then echo -n "Checking for fastdep... " if [ -z "$fastdepcheck" ] then if [ -n "$FASTDEP" ] then fastdepcheck=$FASTDEP else fastdepcheck=/usr/bin/fastdep fi fi if [ -x "$fastdepcheck" ] then echo "FASTDEP_BIN=$fastdepcheck" >> config.me echo $fastdepcheck else echo not found fi fi } fastdep_help() { echo -e "\t--with-fastdep=" echo -e "\t\tsets fastdep binary" echo -e "\t--without-fastdep" echo -e "\t\tdon't use fastdep to generate C/C++ dependencies" } fastdep-0.16/config/Makefile0100644000175000007640000000007507570740776013445 0ustar bvh-include config.me config.me: rm -f config.me ./configure fastdep-0.16/config/release.sh0100644000175000007640000000151207570761000013735 0ustar bvh#!/bin/sh # Shell script to switch between debug/release versions # step 1 : check command line release_commandline() { debugprofile= releaseprofile=yes for i in $@ do value=${i#--debug} if [ ${#i} -ne ${#value} ] then debugprofile=yes releaseprofile= fi value=${i#--release} if [ ${#i} -ne ${#value} ] then debugprofile= releaseprofile=yes fi done } # step 2 : react release_go() { if [ -n "$debugprofile" ] then echo "DEBUGSYMBOLS=yes" >> config.me echo "OPTIMIZE=no" >> config.me fi if [ -n "$releaseprofile" ] then echo "DEBUGSYMBOLS=no" >> config.me echo "OPTIMIZE=yes" >> config.me fi } # step 0 : give help release_help() { echo -e "\t--debug" echo -e "\t\tinclude debugging symbols" echo -e "\t--release [default]" echo -e "\t\tdon't include debugging symbols and optimize" } fastdep-0.16/config/gnugetopt.sh0100600000175000007640000000207407613333520014325 0ustar bvh#!/bin/sh # Shell script to detect GNU getopt_long # step 1 : check command line gnugetopt_commandline() { for i in $@ do value=${i#--enable-local-gnugetopt} if [ ${#i} -ne ${#value} ] then enablelocalgnugetopt=true disablelocalgnugetopt= fi value=${i#--disable-local-gnugetopt} if [ ${#i} -ne ${#value} ] then enablelocalgnugetopt= disablelocalgnugetopt=true fi done } gnugetopt_trycompile() { gcc gnugetopt.c 2> /dev/null > /dev/null } gnugetopt_go() { echo -n "Checking for GNU getopt_long... " if [ -z "$enablelocalgnugetopt" -a -z "$disablelocalgnugetopt" ] then gnugetopt_trycompile if [ $? -ne "0" ] then enablelocalgnugetopt=true fi fi if [ -n "$enablelocalgnugetopt" ] then echo "provided by local copy" echo "LOCALGNUGETOPT=YES" >> config.me else echo "provided by standard library" fi } gnugetopt_help() { echo -e "\t--enable-local-gnugetopt" echo -e "\t\tuse a local copy of GNU getopt_long" echo -e "\t--disable-local-gnugetopt" echo -e "\t\trely on standard libraries to provide GNU getopt_long" } fastdep-0.16/config/gnugetopt.c0100644000175000007640000000013407613333162014142 0ustar bvh#include int main(int argc, int argv) { return getopt_long(argc,argv,0,0,0); } fastdep-0.16/config/config.me0100644000175000007640000000003507747772456013577 0ustar bvhDEBUGSYMBOLS=no OPTIMIZE=yes fastdep-0.16/fastdep.spec0100644000175000007640000000142207747772324013037 0ustar bvhSummary: A program to generate dependencies for C/C++ source files Name: fastdep Version: 0.16 Release: 1 Copyright: GPL Group: Development/Tools Source: http://www.irule.be/bvh/c++/fastdep/fastdep-0.16.tar.gz BuildRoot: /var/tmp/%{name}-buildroot %description Fastdep is a fast dependency generator for C/C++ files which generates output that can be included in Makefiles. %prep %setup %build ./configure make %install mkdir -p $RPM_BUILD_ROOT/usr/bin install -s -m 755 fastdep $RPM_BUILD_ROOT/usr/bin/fastdep %clean rm $RPM_BUILD_ROOT/usr/bin/fastdep %files %defattr(-,root,root) %doc AUTHOR COPYING README TODO CHANGELOG "doc/book1.htm" "doc/c23.htm" "doc/c49.htm" "doc/c90.htm" "doc/fastdep.html" "doc/c100.htm" "doc/c34.htm" "doc/c63.htm" "doc/fastdep.pdf" /usr/bin/fastdep fastdep-0.16/CheckVersion.cc0100644000175000007640000000051407570767627013434 0ustar bvh#include "CheckVersion.h" #include #include int atLeastVersion(const std::string& aVersion) { int major=0, minor=0; sscanf(aVersion.c_str(),"%d.%d",&major,&minor); if ( (FASTDEP_VERSION_MAJOR < major) || ((FASTDEP_VERSION_MAJOR == major) && (FASTDEP_VERSION_MINOR < minor)) ) return 99; return 42; } fastdep-0.16/FileCache.d0100644000175000007640000000562007571717700012501 0ustar bvhFileCache.o: FileCache.cc FileCache.h /usr/include/g++-3/map \ /usr/include/g++-3/stl_tree.h /usr/include/g++-3/stl_algobase.h \ /usr/include/g++-3/stl_config.h /usr/include/_G_config.h \ /usr/include/bits/types.h /usr/include/features.h \ /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/include/stddef.h \ /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \ /usr/include/wchar.h /usr/include/bits/wchar.h /usr/include/gconv.h \ /usr/include/g++-3/stl_relops.h /usr/include/g++-3/stl_pair.h \ /usr/include/g++-3/type_traits.h /usr/include/string.h \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/include/limits.h \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/include/syslimits.h \ /usr/include/limits.h /usr/include/bits/posix1_lim.h \ /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ /usr/include/bits/posix2_lim.h /usr/include/stdlib.h \ /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ /usr/include/bits/endian.h /usr/include/sys/select.h \ /usr/include/bits/select.h /usr/include/bits/sigset.h \ /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ /usr/include/alloca.h \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/include/new.h \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/include/new \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/include/exception \ /usr/include/g++-3/iostream.h /usr/include/g++-3/streambuf.h \ /usr/include/libio.h \ /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/include/stdarg.h \ /usr/include/g++-3/stl_iterator.h /usr/include/g++-3/stl_alloc.h \ /usr/include/assert.h /usr/include/pthread.h /usr/include/sched.h \ /usr/include/signal.h /usr/include/bits/initspin.h \ /usr/include/bits/sigthread.h /usr/include/g++-3/stl_construct.h \ /usr/include/g++-3/stl_function.h /usr/include/g++-3/stl_map.h \ /usr/include/g++-3/stl_multimap.h /usr/include/g++-3/string \ /usr/include/g++-3/std/bastring.h /usr/include/g++-3/cstddef \ /usr/include/g++-3/std/straits.h /usr/include/g++-3/cctype \ /usr/include/ctype.h /usr/include/g++-3/cstring \ /usr/include/g++-3/alloc.h /usr/include/g++-3/iterator \ /usr/include/g++-3/std/bastring.cc /usr/include/g++-3/vector \ /usr/include/g++-3/stl_uninitialized.h /usr/include/g++-3/stl_vector.h \ /usr/include/g++-3/stl_bvector.h /usr/include/g++-3/iostream \ FileStructure.h If.h Element.h CompileState.h /usr/include/fcntl.h \ /usr/include/bits/fcntl.h /usr/include/stdio.h \ /usr/include/bits/stdio_lim.h /usr/include/sys/mman.h \ /usr/include/bits/mman.h /usr/include/sys/stat.h \ /usr/include/bits/stat.h /usr/include/unistd.h \ /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \ /usr/include/getopt.h /usr/include/g++-3/fstream \ /usr/include/g++-3/fstream.h /usr/include/g++-3/algorithm \ /usr/include/g++-3/stl_tempbuf.h /usr/include/g++-3/stl_algo.h \ /usr/include/g++-3/stl_heap.h fastdep-0.16/configure0100755000175000007640000000007207747771021012435 0ustar bvh#!/bin/sh cd config rm -f config.me ./configure $@ cd .. fastdep-0.16/build/0040755000175000007640000000000007613334334011623 5ustar bvhfastdep-0.16/build/dependencies.mk0100644000175000007640000000070707570752452014612 0ustar bvhifdef FASTDEP_BIN generate-depends = \ $(FASTDEP_BIN) \ $(foreach dir,$(INCLUDEDIRS),-I $(dir)) \ --remakedeptarget=$@ \ $(foreach class,$($(call classgroup,fastdep,$(*F))),$(@D)/$(class).cc) > $@ else generate-depends = \ set -e; \ g++ -MM \ $(foreach dir,$(INCLUDEDIRS),-I $(dir)) \ $(foreach class,$($(call classgroup,fastdep,$(*F))),$(@D)/$(class).cc) \ | sed 's/\(.*\)\.o[ :]*/$(@D)\/\1.o $(subst /,\/,$@) : /g' > $@; \ [ -s $@ ] || rm -f $@ endif fastdep-0.16/build/project.mk0100644000175000007640000000011307570747604013624 0ustar bvhproject_dir = DIRS project_class = CLASSES_$(2) classgroup = CLASSES_$(2) fastdep-0.16/build/release.mk0100644000175000007640000000012507570761446013601 0ustar bvhifeq ($(DEBUGSYMBOLS),yes) CFLAGS+=-g endif ifeq ($(OPTIMIZE),yes) CFLAGS+=-O2 endif fastdep-0.16/build/gnugetopt.mk0100644000175000007640000000015207613334334014163 0ustar bvhifdef LOCALGNUGETOPT INCLUDEDIRS += ./external BUILDSOURCES += external/getopt1.c external/getopt.c endif fastdep-0.16/external/0040755000175000007640000000000007613620134012342 5ustar bvhfastdep-0.16/external/getopt1.c0100644000175000007640000001065007613334551014075 0ustar bvh/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. NOTE: This source is derived from an old version taken from the GNU C Library (glibc). This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include #endif #include "getopt.h" #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 #include #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #define ELIDE_CODE #endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* Not ELIDE_CODE. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ fastdep-0.16/external/getopt.c0100644000175000007640000007271407613334551014025 0ustar bvh/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc. NOTE: This source is derived from an old version taken from the GNU C Library (glibc). This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO # define _NO_PROTO #endif #ifdef HAVE_CONFIG_H # include #endif #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ # ifndef const # define const # endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 # include # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ # include # include #endif /* GNU C library. */ #ifdef VMS # include # if HAVE_STRING_H - 0 # include # endif #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. When compiling libc, the _ macro is predefined. */ # if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC # include # define _(msgid) gettext (msgid) # else # define _(msgid) (msgid) # endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ int __getopt_initialized = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ # include # define my_index strchr #else # if HAVE_STRING_H # include # else # if HAVE_STRINGS_H # include # endif # endif /* Avoid depending on library functions or files whose names are inconsistent. */ #ifndef getenv extern char *getenv (); #endif static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ # if (!defined __STDC__ || !__STDC__) && !defined strlen /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); # endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; #ifdef _LIBC /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; static int nonoption_flags_max_len; static int nonoption_flags_len; static int original_argc; static char *const *original_argv; /* Make sure the environment variable bash 2.0 puts in the environment is valid for the getopt call we must make sure that the ARGV passed to getopt is that one passed to the process. */ static void __attribute__ ((unused)) store_args_and_env (int argc, char *const *argv) { /* XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ original_argc = argc; original_argv = argv; } # ifdef text_set_element text_set_element (__libc_subinit, store_args_and_env); # endif /* text_set_element */ # define SWAP_FLAGS(ch1, ch2) \ if (nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined __STDC__ && __STDC__ static void exchange (char **); #endif static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #ifdef _LIBC /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len), '\0', top + 1 - nonoption_flags_max_len); nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ #if defined __STDC__ && __STDC__ static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * _getopt_initialize (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #ifdef _LIBC if (posixly_correct == NULL && argc == original_argc && argv == original_argv) { if (nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = nonoption_flags_max_len = strlen (orig_str); if (nonoption_flags_max_len < argc) nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } nonoption_flags_len = nonoption_flags_max_len; } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #ifdef _LIBC # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ || (optind < nonoption_flags_len \ && __getopt_nonoption_flags[optind] == '1')) #else # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) { if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, _("%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, _("%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); nextchar += strlen (nextchar); optopt = pfound->val; return '?'; } } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); else /* +option or -option */ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* Not ELIDE_CODE. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ fastdep-0.16/external/getopt.h0100644000175000007640000001170307613334552014022 0ustar bvh/* Declarations for getopt. Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _GETOPT_H #define _GETOPT_H 1 #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { #if defined (__STDC__) && __STDC__ const char *name; #else char *name; #endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 #if defined (__STDC__) && __STDC__ /* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is undefined, we haven't run the autoconf check so provide the declaration without arguments. If it is 0, we checked and failed to find the declaration so provide a fully prototyped one. If it is 1, we found it so don't provide any declaration at all. */ #if defined (__GNU_LIBRARY__) || (defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT) /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *shortopts); #else /* not __GNU_LIBRARY__ */ # if !defined (HAVE_DECL_GETOPT) extern int getopt (); # endif #endif /* __GNU_LIBRARY__ */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind, int long_only); #else /* not __STDC__ */ extern int getopt (); extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); #endif /* __STDC__ */ #ifdef __cplusplus } #endif #endif /* getopt.h */ fastdep-0.16/external/Makefile0100644000175000007640000000102107613334552013777 0ustar bvh# # GNU getopt library # all: libgnugetopt.so.1 libgnugetopt.a libgnugetopt.so.1: getopt.o getopt1.o ${CC} ${CFLAGS} -shared -Wl,-soname,libgnugetopt.so.1 -o libgnugetopt.so.1 getopt.o getopt1.o libgnugetopt.a: getopt.o getopt1.o @echo building static libgnugetopt library ar cq libgnugetopt.a `lorder getopt.o getopt1.o | tsort -q` ranlib libgnugetopt.a getopt1.o: getopt1.c ${CC} ${CFLAGS} -fPIC -o getopt1.o -c -s getopt1.c getopt.o: getopt.c ${CC} ${CFLAGS} -fPIC -o getopt.o -c -s getopt.c clean: rm *.o *.so.1 fastdep-0.16/external/README0100644000175000007640000000035007613334552013223 0ustar bvhThis is just a quick and dirty attempt to get GNU getopt library under FreeBSD. It's very small, so I don't yet know, must we create shared version or not. 03.05.99 -------- Ok, I create shared library. It's Right Thing (tm) :) fastdep-0.16/AUTHORS0100644000175000007640000000116407747773343011612 0ustar bvhBart Vanhauwaert bvh-cplusplus@irule.be http://www.irule.be/bvh Co-authors (see CHANGELOG) Robert Sandilands Chris Lambacher Sébastien de Menten Jelbert Treeve Richard Cownie Daniel Brahneborg Pete Gonzalez Jack T. Goral Pierric Descamps Julio M. Merino Vidal Arne Varholm Zenaan Harkness Alexander Bartolich Contains 3th party code under the GPL from Rick Sladkey GNU C Library, (C) Free Software Foundation, Inc and others This package (fastdep) is licensed under the GNU public license. You know where you can find one. Ok, ok, it's in the COPYING file included in this package. fastdep-0.16/Include.cc.orig0100644000175000007640000000222107747767167013375 0ustar bvh#include "Include.h" #include "FileCache.h" #include "FileStructure.h" #include "CompileState.h" #include "os.h" Include::Include(FileStructure* aStructure, const std::string& aFilename, bool aSystem) : Element(aStructure), Filename(aFilename), System(aSystem) { } Include::Include(const Include& anOther) : Element(anOther), Filename(anOther.Filename), System(anOther.System) { } Include::~Include() { } Include& Include::operator=(const Include& anOther) { if (this != &anOther) { Element::operator=(*this); Filename = anOther.Filename; System = anOther.System; } return *this; } Include* Include::copy() const { return new Include(*this); } void Include::getDependencies(CompileState* aState) { if (Filename.length() > 0) { /* std::string Fullname; if (Filename[0] == cPathSep) Fullname = Filename; else Fullname = getStructure()->getPath()+"/"+Filename; aState->addDependencies(Fullname); */ FileStructure* S = getCache()->update(getStructure()->getPath(),Filename,System); if (S /* && (std::string(S->getFileName(),0,4) != "/usr") */) { aState->addDependencies(S->getFileName()); S->getDependencies(aState); } } } fastdep-0.16/Makefile.vc60100600000175000007640000000125707747773304012667 0ustar bvh.SUFFIXES: .cc NAME = fastdep OBJS = CheckVersion.obj \ CompileState.obj \ Define.obj \ Element.obj \ Expression.obj \ fastdep.obj \ FileCache.obj \ FileStructure.obj \ If.obj \ Include.obj \ Sequence.obj \ getopt.obj \ getopt1.obj _CFLAGS = -W3 -I external -DWIN32=1 -D__STDC__=1 _CPPFLAGS = -TP -GX $(_CFLAGS) .cc.obj:: $(CC) -nologo -c $(_CPPFLAGS) $(CPPFLAGS) $< {extra}.c.obj:: $(CC) -nologo -c $(_CFLAGS) $(CFLAGS) $< $(NAME): $(OBJS) $(CC) -Fe $(NAME).exe $? clean: -del *.obj -del *.exe fastdep-0.16/Jamfile0100644000175000007640000000163507747767167012046 0ustar bvh# Jamfile # # Builds fastdep with VC++ and GCC using 'jam' # # Why use Make if there is free Jam at www.perforce.com? # if $(NT) && $(MSVCNT) { FASTDEP_BINDIR ?= f:$(SLASH)bin_dos ; SubDirC++Flags -GX -D "WIN32" -D "VC_GETOPT" # external/getopt1.c -I external -TP # let the *.cc be C++ ; EXTSRC = #extra sources external\\getopt.c external\\getopt1.c realpath.cc ; } else # Linux, Unix, Windows GCC (Mingw, Cygwin) { if $(MINGW) { EXTSRC = realpath.cc ; } else { FASTDEP_BINDIR ?= $(SLASH)usr$(SLASH)local$(SLASH)bin ; } C++ = g++ ; LINK = g++ ; SubDirC++Flags -Wall -O2 -g ; } # Target to build: fastdep # Main fastdep : $(EXTSRC) CheckVersion.cc CompileState.cc Define.cc Element.cc Expression.cc FileCache.cc FileStructure.cc If.cc Include.cc MappedFile.cc Sequence.cc fastdep.cc ; InstallBin "$(FASTDEP_BINDIR)" : fastdep ; # vim:ts=4:nu fastdep-0.16/MappedFile.cc0100644000175000007640000000552107747767167013067 0ustar bvh#ifdef WIN32 #include #include #define PATH_MAX MAX_PATH #else #include #include #include #endif #include #include "MappedFile.h" #ifdef WIN32 //http://dotnet.di.unipi.it/Content/sscli/docs/doxygen/pal/filetime_8c-source.html static const __int64 SECS_BETWEEN_EPOCHS = 11644473600; static const __int64 SECS_TO_100NS = 10000000; /* 10^7 */ time_t FILEFileTimeToUnixTime( FILETIME FileTime, long *nsec ) { __int64 UnixTime; /* get the full win32 value, in 100ns */ UnixTime = ((__int64)FileTime.dwHighDateTime << 32) + FileTime.dwLowDateTime; /* convert to the Unix epoch */ UnixTime -= (SECS_BETWEEN_EPOCHS * SECS_TO_100NS); // TRACE("nsec=%p\n", nsec); if ( nsec ) { /* get the number of 100ns, convert to ns */ *nsec = (UnixTime % SECS_TO_100NS) * 100; } UnixTime /= SECS_TO_100NS; /* now convert to seconds */ if ( (time_t)UnixTime != UnixTime ) { // WARN("Resulting value is too big for a time_t value\n"); } /* TRACE("Win32 FILETIME = [%#x:%#x] converts to Unix time = [%ld.%09ld]\n", FileTime.dwHighDateTime, FileTime.dwLowDateTime ,(long) UnixTime, nsec?*nsec:0L); */ return (time_t)UnixTime; } MappedFile::~MappedFile() { UnmapViewOfFile(map_); CloseHandle(hFileMapping); CloseHandle(hFile); } bool MappedFile::open(const std::string& name) { hFile = CreateFile(name.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); opened_ = hFile == INVALID_HANDLE_VALUE ? false : true ; if (opened_) { file_size = GetFileSize(hFile, NULL); FILETIME fTime; GetFileTime(hFile, NULL, NULL,&fTime); long nsec; last_change = FILEFileTimeToUnixTime( fTime, &nsec ); } return opened_; } char* MappedFile::map() throw (std::string) { hFileMapping = CreateFileMapping( hFile,NULL, PAGE_WRITECOPY, 0, 0, NULL ); return map_=(char*)MapViewOfFile(hFileMapping, FILE_MAP_COPY, 0, 0, 0); }; #else MappedFile::~MappedFile() { munmap(map_, mapsize); close(fd); } bool MappedFile::open(const std::string& name) { fd = ::open(name.c_str(), O_RDONLY); opened_ = fd >= 0 ? true : false ; if(opened_) { struct stat st; fstat(fd, &st); file_size = st.st_size; last_change = st.st_mtime; mapsize = st.st_size; } return opened_; } char* MappedFile::map() throw (std::string) { int pagesizem1 = getpagesize()-1; mapsize = (mapsize+pagesizem1) & ~pagesizem1; map_ = (char*)mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0); if ((long) map_ == -1) { perror("mkdep: mmap"); close(fd); return 0; } if ((unsigned long) map_ % sizeof(unsigned long) != 0) { throw std::string("do_depend: map not aligned") ; } return map_; }; #endif // vim:ts=4:nu // fastdep-0.16/MappedFile.h0100644000175000007640000000171207747767167012727 0ustar bvh#ifndef __MAPPEDFILE_H__ #define __MAPPEDFILE_H__ #include #ifdef WIN32 #include struct MapFileData { HANDLE hFile; HANDLE hFileMapping; }; #else struct MapFileData { int mapsize; int fd; }; #endif /** Class MappedFile creates memory file mapping. * * Works with Windows Mingw GCC, VC++.NET and on Unix */ class MappedFile : MapFileData { bool opened_; long file_size; time_t last_change; char* map_; public: /** C'tor * */ MappedFile() : opened_(false),file_size(0){} /** D'tor * */ virtual ~MappedFile(); /** Size of the opened file. * */ long size() const {return file_size; } /** Modification time of the opened file. * */ time_t time() const {return last_change; } /** Opens a file for memory mapping * */ bool open(const std::string& name); /** Maps the file into memory * */ char* map() throw (std::string) ; }; #endif // __MAPPEDFILE_H__ // vim:ts=4:nu // fastdep-0.16/config.me0100644000175000007640000000003507747767167012335 0ustar bvhDEBUGSYMBOLS=no OPTIMIZE=yes fastdep-0.16/os.h0100644000175000007640000000034307747767206011333 0ustar bvh#ifndef __OS_H__ #define __OS_H__ #ifdef WIN32 static const char cPathSep = '\\' ; static const char* sPathSep = "\\" ; #else static const char cPathSep = '/' ; static const char* sPathSep = "/" ; #endif #endif // __OS_H__ fastdep-0.16/realpath.cc0100644000175000007640000001054307747767206012653 0ustar bvh#ifdef WIN32 #include #include "os.h" /* * realpath.c -- canonicalize pathname by removing symlinks * Copyright (C) 1993 Rick Sladkey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library Public License for more details. */ #ifdef HAVE_CONFIG_H #include #endif #include //#include #include #include //#include #include /* for PATH_MAX */ //#include /* for MAXPATHLEN */ #include #include /* for S_IFLNK */ #ifndef PATH_MAX #ifdef _POSIX_VERSION #define PATH_MAX _POSIX_PATH_MAX #else #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif #endif #define MAX_READLINKS 32 #if defined __STDC__ || defined WIN32 char *realpath(const char *path, char resolved_path[]) #else char *realpath(path, resolved_path) const char *path; char resolved_path[]; #endif { strcpy(resolved_path,path); return resolved_path; // until fixed char copy_path[PATH_MAX]; char link_path[PATH_MAX]; char got_path[PATH_MAX]; char *new_path = got_path; char *max_path; int readlinks = 0; int n; /* Make a copy of the source path since we may need to modify it. */ if (strlen(path) >= PATH_MAX - 2) { #ifdef WIN32 errno = ENOENT ; #else __set_errno(ENAMETOOLONG); #endif return NULL; } strcpy(copy_path, path); path = copy_path; max_path = copy_path + PATH_MAX - 2; /* If it's a relative pathname use getwd for starters. */ if (*path != cPathSep) { /* Ohoo... */ #define HAVE_GETCWD #ifdef HAVE_GETCWD #ifdef WIN32 _getcwd(new_path, PATH_MAX - 1); #else getcwd(new_path, PATH_MAX - 1); #endif #else getwd(new_path); #endif new_path += strlen(new_path); if (new_path[-1] != cPathSep) *new_path++ = cPathSep; } else { *new_path++ = cPathSep; path++; } /* Expand each slash-separated pathname component. */ while (*path != '\0') { /* Ignore stray "/". */ if (*path == cPathSep) { path++; continue; } if (*path == '.') { /* Ignore ".". */ if (path[1] == '\0' || path[1] == cPathSep) { path++; continue; } if (path[1] == '.') { if (path[2] == '\0' || path[2] == cPathSep) { path += 2; /* Ignore ".." at root. */ if (new_path == got_path + 1) continue; /* Handle ".." by backing up. */ while ((--new_path)[-1] != cPathSep); continue; } } } /* Safely copy the next pathname component. */ while (*path != '\0' && *path != cPathSep) { if (path > max_path) { #ifdef WIN32 errno = ENOENT ; #else __set_errno(ENAMETOOLONG); #endif //__set_errno(ENAMETOOLONG); return NULL; } *new_path++ = *path++; } #ifdef S_IFLNK /* Protect against infinite loops. */ if (readlinks++ > MAX_READLINKS) { __set_errno(ELOOP); return NULL; } /* See if latest pathname component is a symlink. */ *new_path = '\0'; n = readlink(got_path, link_path, PATH_MAX - 1); if (n < 0) { /* EINVAL means the file exists but isn't a symlink. */ if (errno != EINVAL) { /* Make sure it's null terminated. */ *new_path = '\0'; strcpy(resolved_path, got_path); return NULL; } } else { /* Note: readlink doesn't add the null byte. */ link_path[n] = '\0'; if (*link_path == cPathSep) /* Start over for an absolute symlink. */ new_path = got_path; else /* Otherwise back up over this component. */ while (*(--new_path) != cPathSep); /* Safe sex check. */ if (strlen(path) + n >= PATH_MAX - 2) { __set_errno(ENAMETOOLONG); return NULL; } /* Insert symlink contents into path. */ strcat(link_path, path); strcpy(copy_path, link_path); path = copy_path; } #endif /* S_IFLNK */ *new_path++ = cPathSep; } /* Delete trailing slash but don't whomp a lone slash. */ if (new_path != got_path + 1 && new_path[-1] == cPathSep) new_path--; /* Make sure it's null terminated. */ *new_path = '\0'; strcpy(resolved_path, got_path); return resolved_path; } #endif fastdep-0.16/FileCache.cc.orig0100644000175000007640000001451407747770567013623 0ustar bvh#include "FileCache.h" #include "FileStructure.h" #include "CompileState.h" #include "os.h" #include "MappedFile.h" #include #include #include #include #include #include #include #include #include #ifdef WIN32 extern char *realpath(const char *path, char resolved_path[]); #define PATH_MAX MAX_PATH #endif using namespace std; bool FileCache::QuietMode = false; FileCache::FileCache(const std::string& aBaseDir) : BaseDir(aBaseDir), ObjectsDir(""), DebugMode(false), WarnAboutNonExistingSystemHeaders(false) { CompileCommand = ""; SetObjectsShouldContainDirectories(); IncludeDirs.push_back("."); } FileCache::FileCache(const FileCache& anOther) { } FileCache::~FileCache() { } FileCache& FileCache::operator=(const FileCache& anOther) { return *this; } void FileCache::inDebugMode() { DebugMode = true; } void FileCache::addPreDefine(const std::string& aName) { PreDefined.push_back(aName.substr(0, aName.find('='))); } void FileCache::generate(std::ostream& theStream, const std::string& aDirectory, const std::string& aFilename) { FileStructure* Structure = update(aDirectory, aFilename, false); if (Structure) { CompileState State(aDirectory); if (DebugMode) State.inDebugMode(); for (unsigned int i=0; igetDependencies(&State); std::string Basename(aFilename,0,aFilename.rfind(".")); if (!ObjectsContainDirectories && Basename.rfind(sPathSep)!=Basename.npos) { std::string newBasename(Basename,Basename.rfind(sPathSep)+1,Basename.size()); theStream << newBasename << ".o: " << aFilename; } else { theStream << ObjectsDir << Basename << ".o: " << aFilename; } theStream << State.getDependenciesLine() << std::endl; // State.dump(); State.mergeDeps(AllDependencies); if (std::find(AllDependencies.begin(),AllDependencies.end(),aFilename) == AllDependencies.end()) AllDependencies.push_back(aFilename); if (CompileCommand.size()>0) { theStream << "\t " << CompileCommand << " " << aFilename << std::endl << std::endl ; } } } void FileCache::SetCompileCommand( const std::string &cmd ) { CompileCommand = cmd; } void FileCache::addIncludeDir(const std::string& aBaseDir, const std::string& aDir) { if (std::find(IncludeDirs.begin(),IncludeDirs.end(),aDir) == IncludeDirs.end()) IncludeDirs.push_back(aDir); } void FileCache::addExcludeDir(const std::string& aBaseDir, const std::string& aDir) { if (std::find(ExcludeDirs.begin(),ExcludeDirs.end(),aDir) == ExcludeDirs.end()) ExcludeDirs.push_back(aDir); } void FileCache::addIncludeDirFromFile(const std::string& aBaseDir, const std::string& aFilename) { std::ifstream ifile(aFilename.c_str()); if(!ifile){ // XXX Error message here if(!QuietMode){ std::cerr << "error opening " << aFilename.c_str() << std::endl; } // exit or return ? return; } while(!ifile.eof()){ std::string aDir; std::getline(ifile, aDir); aDir = aDir.substr(0,aDir.find('\n')); aDir = aDir.substr(0,aDir.find('\r')); if (aDir != "") addIncludeDir(aBaseDir, aDir); } } FileStructure* FileCache::update(const std::string& aDirectory, const std::string& aFilename, bool isSystem) { FileMap::iterator iti = Files.find(FileLocation(aDirectory,aFilename)); if (iti != Files.end()) { /* if(!iti->second && !QuietMode && (!isSystem || WarnAboutNonExistingSystemHeaders)) { std::cerr << "error opening " << aFilename.c_str() << std::endl; } */ return iti->second; } auto_ptr mfile(new MappedFile); if (DebugMode) std::cout << "[DEBUG] FileCache::update(" << aDirectory << "," << aFilename << "," << isSystem << ");" << std::endl; char ResolvedBuffer[PATH_MAX+1]; { unsigned int i; for (i=0; iopen(ResolvedBuffer)) break; } if (i == IncludeDirs.size()) { for (i=0; iopen(ResolvedBuffer)) { if (DebugMode) std::cout << "[DEBUG] excluding : " << ResolvedBuffer << std::endl; Files[FileLocation(aDirectory, aFilename)] = 0; return 0; } } std::string theFilename = aDirectory+cPathSep+aFilename; if (aFilename[0]==cPathSep) { theFilename = aFilename; } if (!realpath(theFilename.c_str(), ResolvedBuffer)) { if(!QuietMode && (!isSystem || WarnAboutNonExistingSystemHeaders)) { std::cerr << "error opening " << aFilename.c_str() << std::endl; } Files[FileLocation(aDirectory, aFilename)] = 0; return 0; } if(!mfile->open(ResolvedBuffer)) { if(!QuietMode && (!isSystem || WarnAboutNonExistingSystemHeaders)) { std::cerr << "error opening " << aFilename.c_str() << std::endl; } Files[FileLocation(aDirectory, aFilename)] = 0; return 0; } } } std::string ResolvedName(ResolvedBuffer); long file_size =mfile->size(); time_t last_change =mfile->time(); if (file_size == 0) { std::cerr << ResolvedName << " is empty." << std::endl; return 0; } char * map = 0; try { map = mfile->map(); } catch(string s ) { std::cerr << s << std::endl; exit(1); } FileStructure* S = new FileStructure(ResolvedName, this, map, file_size); S->setModificationTime(last_change); Files.insert(std::make_pair(FileLocation(aDirectory,aFilename), S)); return S; } std::string FileCache::getAllDependenciesLine() const { std::string Result; for (unsigned int i=0; i #include #include #include #include "FileStructure.h" #include "os.h" class Sequence; class FileCache { public: FileCache(const std::string& aBaseDir); FileCache(const FileCache& anOther); virtual ~FileCache(); FileCache& operator=(const FileCache& anOther); void generate(std::ostream& theStream, const std::string& aDirectory, const std::string& aFilename); FileStructure* update(const std::string& aDirectory, const std::string& aFilename, bool isSystem); void addIncludeDir(const std::string& aBaseDir, const std::string& aDir); void addIncludeDirFromFile(const std::string& aBaseDir, const std::string& aFilename); void addExcludeDir(const std::string& aBaseDir, const std::string& aDir); std::string getAllDependenciesLine() const; void SetObjectsShouldContainDirectories() { ObjectsContainDirectories=true; }; void SetObjectsShouldNotContainDirectories() { ObjectsContainDirectories=false; }; void SetObjectsDir(const std::string& aDir) { ObjectsDir = aDir+sPathSep; } void SetCompileCommand( const std::string &cmd ); void SetQuietModeOn() {QuietMode = true; } void SetQuietModeOff() {QuietMode = false; } void addPreDefine(const std::string& aName); void inDebugMode(); private: struct FileLocation { FileLocation(const std::string& aDir, const std::string& aName) : Directory(aDir), Name(aName) { } bool operator<(const FileLocation& aLoc) const { return (Directory < aLoc.Directory) || ((Directory == aLoc.Directory) && (Name < aLoc.Name)); } std::string Directory; std::string Name; }; typedef std::map FileMap; FileMap Files; std::vector IncludeDirs; std::vector ExcludeDirs; std::vector AllDependencies; std::vector PreDefined; std::string BaseDir; std::string ObjectsDir; std::string CompileCommand; bool ObjectsContainDirectories; static bool QuietMode; bool DebugMode; bool WarnAboutNonExistingSystemHeaders; }; #endif fastdep-0.16/fastdep.cc.orig0100644000175000007640000000673607747767206013451 0ustar bvh#if defined(WIN32) #include #else #include #endif #include "getopt.h" #include #include #include "FileCache.h" #include "FileStructure.h" #include "CheckVersion.h" #define CWDBUFFERLENGTH 1024 void PrintVersion() { std::cout << "fastdep v" << FASTDEP_VERSION_MAJOR << "." << FASTDEP_VERSION_MINOR << std::endl << "copyright Bart Vanhauwaert, 2001, 2002" << std::endl << "licensed under the GNU Public License" << std::endl; } /* * Generate dependencies for all files. */ int main(int argc, char **argv) { char cwd_buffer[CWDBUFFERLENGTH+1]; cwd_buffer[0] = 0; #if defined(WIN32) _getcwd(cwd_buffer, CWDBUFFERLENGTH); #else getcwd(cwd_buffer, CWDBUFFERLENGTH); #endif FileCache Cache(cwd_buffer); Cache.addIncludeDir(cwd_buffer,"."); std::string RemakeDepTarget; std::vector ExtraRemakeDeps; std::string OutputFilename; bool doDebug = false; while (1) { int option_index = 0; static struct option long_options[] = { {"remakedeptarget", 1, 0, 0 }, {"extraremakedep", 1, 0, 0 }, {"version", 0, 0, 0 }, {"stdinclude", 2, 0, 0 }, {"compile", 1, 0, 0 }, {"extraincludes", 1, 0, 0}, {"debug",0,0,0 }, {"atleastversion",1,0,0 }, {0, 0, 0, 0} }; int c = getopt_long(argc,argv,"vI:dqo:O:D:",long_options, &option_index); if (c==-1) break; switch (c) { case 0: switch (option_index) { case 0: RemakeDepTarget = std::string(optarg); break; case 1: ExtraRemakeDeps.push_back(std::string(optarg)); break; case 2: PrintVersion(); return 0; case 3: if (optarg) { Cache.addIncludeDir(cwd_buffer, optarg); } else { Cache.addIncludeDir(cwd_buffer, "/usr/include"); } break; case 4: Cache.SetCompileCommand( std::string(optarg) ); break; case 5: Cache.addIncludeDirFromFile(cwd_buffer, optarg); break; case 6: doDebug = true; break; case 7: return atLeastVersion(optarg); break; } break; case 'I': Cache.addIncludeDir(cwd_buffer, optarg); break; case 'O': Cache.SetObjectsDir(optarg); break; case 'v': PrintVersion(); return 0; case 'd': Cache.SetObjectsShouldNotContainDirectories(); break; case 'q': Cache.SetQuietModeOn(); break; case 'o': OutputFilename = optarg; break; case 'D': Cache.addPreDefine(optarg); break; } } #if ! defined (WIN32) Cache.addExcludeDir("","/usr/include"); #endif if (optind == argc) { std::cout << "Usage : fastdep filename.c" << std::endl; return 0; } if (doDebug) Cache.inDebugMode(); std::ostream* theStream = &std::cout; if (OutputFilename != "") { theStream = new std::ofstream(OutputFilename.c_str()); if (RemakeDepTarget == "") RemakeDepTarget = OutputFilename; } for (int i=optind; i