Subversion Repositories Programming Utils

Rev

Rev 5 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/* write.h
 *
 * $Id: write.h,v 1.1 2006/06/08 02:13:59 swm Exp $
 *
 * $Log: write.h,v $
 * Revision 1.1  2006/06/08 02:13:59  swm
 * Initial revision
 *
 */


// File: write.h
// Author: K. Reek
// Contributors: S. Marshall, rm5248
// Description: A class that writes the makefile.

#ifndef _WRITE_H
#define _WRITE_H

#include <string>
#include <iostream>
#include <map>

#include "dirlist.h"
#include "PlatformSwitcher.h"

using namespace std;

/* Class that writes the makefile
 *
 * Default configuration settings:
 *   config["c_compiler"] = cc  //the C compiler to use
 *   config["cpp_compiler"] = CC // the C++ compiler to use
 *   config["no_debug"] = false //if true, do not output debugging information
 *   config["header_file"] = header.mak //file to read in to re-define some standard flags
 *   config["program_file"] = programs.mak //file to be read in to override dependency generation
 *   config["update"] = false //are we updating a value in the makefile?
 *   config["depends"] = false //are we just updating the dependencies?
 *   config["ar"] = false //are we creating a target for archive?
 *   config["so"] = false //are we creating a target for a shared object file?
 *   config["install"] = false //are we installing?
 *   config["prefix"] = /usr/bin  //what is the installation location?
 *   config["dirs"] = (this directory) //what directories are we looking in for source files?
 *   config["executable"] = (name of this executable)
 */

class Write {
public: // Constructor

  Write( DirList &dirlist, map<string, string>* config );

private: // Helper functions

  void write_header( void );
  void write_lists( DirList &dirlist );
  void write_main_targets( DirList &dirlist );
  void write_main_target_list( const set<string> &list,
                               string compile,
                               string local_libs );
  void write_dependencies( DirList &dirlist );
  void write_archive_targets( void );
  void write_shared_obj_targets( void );
  void write_install_targets( DirList &dirlist );
  void write_trailer( DirList &dirlist, bool useGCC );

private: // Private variables

  //products is a set of all custom rules that would be defined in the 'programs.mak'
  set<string> products;
 
  //This map contains all of the configuration values.
  map<string, string>* configuration;

}; // Write

#endif