added a dependencymap backend (it doesn't do anything yet)

svn path=/trunk/; revision=25429
This commit is contained in:
Christoph von Wittich 2007-01-11 20:32:20 +00:00
parent c093c9b6b5
commit 44592e4e76
4 changed files with 217 additions and 2 deletions

View file

@ -747,7 +747,7 @@ CBBackend::_generate_cbproj ( const Module& module )
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 &quot;$(TARGET_OUTPUT_DIR)\\$file_c.h&quot; -c -C &quot;$(TARGET_OUTPUT_DIR)\\$file_c.c&quot; $file\\ngcc %s -c &quot;$(TARGET_OUTPUT_DIR)\\$file_c.c&quot; -o &quot;$(TARGET_OUTPUT_DIR)\\$file_c.o&quot;\" />\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 &quot;$(TARGET_OUTPUT_DIR)$filetitle_c.h&quot; -c -C &quot;$(TARGET_OUTPUT_DIR)$filetitle_c.c&quot; $file\\ngcc %s -c &quot;$(TARGET_OUTPUT_DIR)$filetitle_c.c&quot; -o &quot;$(TARGET_OUTPUT_DIR)$file_c.o&quot;\" />\r\n", outdir.c_str(), widl_options.c_str(), windres_defines.c_str(), widl_options.c_str() );
}
else if ( extension == ".spec" || extension == ".SPEC" )
{

View file

@ -0,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 */
}

View file

@ -0,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__

View file

@ -119,6 +119,23 @@ $(RBUILD_CODEBLOCKS_OUT): | $(RBUILD_BACKEND_OUT)
${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 @@ RBUILD_BACKEND_CODEBLOCKS_BASE_SOURCES = $(addprefix $(RBUILD_CODEBLOCKS_BASE_),
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_SOURCES = \
$(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_MSVCCPP_HEADERS = \
RBUILD_BACKEND_CODEBLOCKS_HEADERS = \
codeblocks.h
RBUILD_BACKEND_DEPMAP_HEADERS = \
dependencymap.h
RBUILD_BACKEND_MINGW_HEADERS = \
mingw.h \
modulehandler.h
@ -234,7 +260,8 @@ RBUILD_BACKEND_HEADERS = \
$(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 @@ $(RBUILD_CODEBLOCKS_INT_)codeblocks.o: $(RBUILD_CODEBLOCKS_BASE_)codeblocks.cpp
$(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 $@