Author: cwittich Date: Thu Jan 11 23:32:20 2007 New Revision: 25429
URL: http://svn.reactos.org/svn/reactos?rev=25429&view=rev Log: added a dependencymap backend (it doesn't do anything yet)
Added: trunk/reactos/tools/rbuild/backend/dependencymap/ trunk/reactos/tools/rbuild/backend/dependencymap/dependencymap.cpp trunk/reactos/tools/rbuild/backend/dependencymap/dependencymap.h Modified: trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp trunk/reactos/tools/rbuild/rbuild.mak
Modified: trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/codebl... ============================================================================== --- trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp (original) +++ trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp Thu Jan 11 23:32:20 2007 @@ -747,7 +747,7 @@ else if ( extension == ".idl" || extension == ".IDL" ) { fprintf ( OUT, "\t\t\t<Option compile="1" />\r\n" ); - fprintf ( OUT, "\t\t\t<Option compiler="gcc" use="1" buildCommand="%s\tools\widl\widl.exe %s %s -h -H "$(TARGET_OUTPUT_DIR)\$file_c.h" -c -C "$(TARGET_OUTPUT_DIR)\$file_c.c" $file\ngcc %s -c "$(TARGET_OUTPUT_DIR)\$file_c.c" -o "$(TARGET_OUTPUT_DIR)\$file_c.o"" />\r\n", outdir.c_str(), widl_options.c_str(), windres_defines.c_str(), widl_options.c_str() ); + fprintf ( OUT, "\t\t\t<Option compiler="gcc" use="1" buildCommand="%s\tools\widl\widl.exe %s %s -h -H "$(TARGET_OUTPUT_DIR)$filetitle_c.h" -c -C "$(TARGET_OUTPUT_DIR)$filetitle_c.c" $file\ngcc %s -c "$(TARGET_OUTPUT_DIR)$filetitle_c.c" -o "$(TARGET_OUTPUT_DIR)$file_c.o"" />\r\n", outdir.c_str(), widl_options.c_str(), windres_defines.c_str(), widl_options.c_str() ); } else if ( extension == ".spec" || extension == ".SPEC" ) {
Added: trunk/reactos/tools/rbuild/backend/dependencymap/dependencymap.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/depend... ============================================================================== --- trunk/reactos/tools/rbuild/backend/dependencymap/dependencymap.cpp (added) +++ trunk/reactos/tools/rbuild/backend/dependencymap/dependencymap.cpp Thu Jan 11 23:32:20 2007 @@ -1,0 +1,127 @@ +/* + * Copyright (C) 2007 Christoph von Wittich + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifdef _MSC_VER +#pragma warning ( disable : 4786 ) +#endif//_MSC_VER + +#include <iostream> +#include <fstream> +#include <string> +#include <vector> + +#include <stdio.h> + +#include "dependencymap.h" +#include "../mingw/mingw.h" + +using std::string; +using std::vector; +using std::ifstream; + +#ifdef OUT +#undef OUT +#endif//OUT + + +static class DepMapFactory : public Backend::Factory +{ + public: + + DepMapFactory() : Factory("DepMap", "Dependency Map") {} + Backend *operator() (Project &project, + Configuration& configuration) + { + return new DepMapBackend(project, configuration); + } + +} factory; + + +DepMapBackend::DepMapBackend(Project &project, + Configuration& configuration) : Backend(project, configuration) +{ + +} + +void DepMapBackend::Process() +{ + string filename_depmap ( "dependencymap.xml" ); + printf ( "Creating dependecy map: %s\n", filename_depmap.c_str() ); + + m_DepMapFile = fopen ( filename_depmap.c_str(), "wb" ); + + if ( !m_DepMapFile ) + { + printf ( "Could not create file '%s'.\n", filename_depmap.c_str() ); + return; + } + + _generate_depmap ( m_DepMapFile ); + + fclose ( m_DepMapFile ); + printf ( "Done.\n" ); +} + +void +DepMapBackend::_clean_project_files ( void ) +{ + remove ( "dependencymap.xml" ); +} + +void +DepMapBackend::_generate_depmap ( FILE* OUT ) +{ + + /* add dependencies */ + for ( size_t i = 0; i < ProjectNode.modules.size(); i++ ) + { + Module& module = *ProjectNode.modules[i]; + + if ((module.type != Iso) && + (module.type != LiveIso) && + (module.type != IsoRegTest) && + (module.type != LiveIsoRegTest)) + { + vector<const IfableData*> ifs_list; + ifs_list.push_back ( &module.project.non_if_data ); + ifs_list.push_back ( &module.non_if_data ); + while ( ifs_list.size() ) + { + const IfableData& data = *ifs_list.back(); + ifs_list.pop_back(); + const vector<Library*>& libs = data.libraries; + for ( size_t j = 0; j < libs.size(); j++ ) + { + //add module.name and libs[j]->name + } + } + } + } + +/* save data to file + fprintf ( OUT, "\r\n" ); +*/ +} + + +DepMapConfiguration::DepMapConfiguration ( const std::string &name ) +{ + /* nothing to do here */ +} + +
Added: trunk/reactos/tools/rbuild/backend/dependencymap/dependencymap.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/depend... ============================================================================== --- trunk/reactos/tools/rbuild/backend/dependencymap/dependencymap.h (added) +++ trunk/reactos/tools/rbuild/backend/dependencymap/dependencymap.h Thu Jan 11 23:32:20 2007 @@ -1,0 +1,57 @@ +/* + * Copyright (C) 2007 Christoph von Wittich + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef __DEPMAP_H__ +#define __DEPMAP_H__ + +#include <fstream> +#include <vector> +#include <string> + +#include "../backend.h" + +class DepMapConfiguration +{ + public: + DepMapConfiguration(const std::string &name = ""); + virtual ~DepMapConfiguration() {} + std::string name; +}; + +class DepMapBackend : public Backend +{ + public: + + DepMapBackend(Project &project, + Configuration& configuration); + virtual ~DepMapBackend() {} + + virtual void Process(); + + private: + + FILE* m_DepMapFile; + + std::vector<DepMapConfiguration*> m_configurations; + void _generate_depmap ( FILE* OUT ); + void _clean_project_files ( void ); + +}; + + +#endif // __DEPMAP_H__ +
Modified: trunk/reactos/tools/rbuild/rbuild.mak URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.mak?rev... ============================================================================== --- trunk/reactos/tools/rbuild/rbuild.mak (original) +++ trunk/reactos/tools/rbuild/rbuild.mak Thu Jan 11 23:32:20 2007 @@ -119,6 +119,23 @@ ${mkdir} $@ endif
+RBUILD_DEPMAP_BASE = $(RBUILD_BACKEND_BASE_)dependencymap +RBUILD_DEPMAP_BASE_ = $(RBUILD_DEPMAP_BASE)$(SEP) +RBUILD_DEPMAP_INT = $(INTERMEDIATE_)$(RBUILD_DEPMAP_BASE) +RBUILD_DEPMAP_INT_ = $(RBUILD_DEPMAP_INT)$(SEP) +RBUILD_DEPMAP_OUT = $(OUTPUT_)$(RBUILD_DEPMAP_BASE) +RBUILD_DEPMAP_OUT_ = $(RBUILD_DEPMAP_OUT)$(SEP) + +$(RBUILD_DEPMAP_INT): | $(RBUILD_BACKEND_INT) + $(ECHO_MKDIR) + ${mkdir} $@ + +ifneq ($(INTERMEDIATE),$(OUTPUT)) +$(RBUILD_DEPMAP_OUT): | $(RBUILD_BACKEND_OUT) + $(ECHO_MKDIR) + ${mkdir} $@ +endif +
RBUILD_MSVC_BASE = $(RBUILD_BACKEND_BASE_)msvc RBUILD_MSVC_BASE_ = $(RBUILD_MSVC_BASE)$(SEP) @@ -158,6 +175,11 @@ codeblocks.cpp \ )
+RBUILD_BACKEND_DEPMAP_BASE_SOURCES = $(addprefix $(RBUILD_DEPMAP_BASE_), \ + dependencymap.cpp \ + ) + + RBUILD_BACKEND_MSVC_BASE_SOURCES = $(addprefix $(RBUILD_MSVC_BASE_), \ genguid.cpp \ msvc.cpp \ @@ -170,6 +192,7 @@ $(RBUILD_BACKEND_DEVCPP_BASE_SOURCES) \ $(RBUILD_BACKEND_MSVC_BASE_SOURCES) \ $(RBUILD_BACKEND_CODEBLOCKS_BASE_SOURCES) \ + $(RBUILD_BACKEND_DEPMAP_BASE_SOURCES) \ $(RBUILD_BACKEND_BASE_)backend.cpp
RBUILD_COMMON_SOURCES = \ @@ -225,6 +248,9 @@ RBUILD_BACKEND_CODEBLOCKS_HEADERS = \ codeblocks.h
+RBUILD_BACKEND_DEPMAP_HEADERS = \ + dependencymap.h + RBUILD_BACKEND_MINGW_HEADERS = \ mingw.h \ modulehandler.h @@ -234,7 +260,8 @@ $(addprefix devcpp$(SEP), $(RBUILD_BACKEND_DEVCPP_HEADERS)) \ $(addprefix msvc$(SEP), $(RBUILD_BACKEND_MSVC_HEADERS)) \ $(addprefix mingw$(SEP), $(RBUILD_BACKEND_MINGW_HEADERS)) \ - $(addprefix codeblocks$(SEP), $(RBUILD_BACKEND_CODEBLOCKS_HEADERS)) + $(addprefix codeblocks$(SEP), $(RBUILD_BACKEND_CODEBLOCKS_HEADERS)) \ + $(addprefix dependencymap$(SEP), $(RBUILD_BACKEND_DEPMAP_HEADERS))
RBUILD_HEADERS = \ $(addprefix $(RBUILD_BASE_), \ @@ -403,6 +430,10 @@ $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
+$(RBUILD_DEPMAP_INT_)dependencymap.o: $(RBUILD_DEPMAP_BASE_)dependencymap.cpp $(RBUILD_HEADERS) | $(RBUILD_DEPMAP_INT) + $(ECHO_CC) + ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ + $(RBUILD_MSVC_INT_)genguid.o: $(RBUILD_MSVC_BASE_)genguid.cpp $(RBUILD_HEADERS) | $(RBUILD_MSVC_INT) $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@