OutputCmd.cpp revision f33f6de54db174aa679a4b6d1e040d37e95541c0
1//===- OutputCmd.cpp -----------------------------------------------------===//
2//
3//                     The MCLinker Project
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9#include <mcld/Script/OutputCmd.h>
10#include <mcld/Support/raw_ostream.h>
11#include <mcld/LinkerScript.h>
12#include <mcld/Module.h>
13
14using namespace mcld;
15
16//===----------------------------------------------------------------------===//
17// OutputCmd
18//===----------------------------------------------------------------------===//
19OutputCmd::OutputCmd(const std::string& pOutputFile)
20  : ScriptCommand(ScriptCommand::OUTPUT),
21    m_OutputFile(pOutputFile)
22{
23}
24
25OutputCmd::~OutputCmd()
26{
27}
28
29void OutputCmd::dump() const
30{
31  mcld::outs() << "OUTPUT ( " << m_OutputFile << " )\n";
32}
33
34void OutputCmd::activate(Module& pModule)
35{
36  pModule.getScript().setOutputFile(m_OutputFile);
37  // TODO: set the output name if there is no `-o filename' on the cmdline.
38  // This option is to define a default name for the output file other than the
39  // usual default of a.out.
40}
41
42