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
14namespace mcld {
15
16//===----------------------------------------------------------------------===//
17// OutputCmd
18//===----------------------------------------------------------------------===//
19OutputCmd::OutputCmd(const std::string& pOutputFile)
20    : ScriptCommand(ScriptCommand::OUTPUT), m_OutputFile(pOutputFile) {
21}
22
23OutputCmd::~OutputCmd() {
24}
25
26void OutputCmd::dump() const {
27  mcld::outs() << "OUTPUT ( " << m_OutputFile << " )\n";
28}
29
30void OutputCmd::activate(Module& pModule) {
31  pModule.getScript().setOutputFile(m_OutputFile);
32  // TODO: set the output name if there is no `-o filename' on the cmdline.
33  // This option is to define a default name for the output file other than the
34  // usual default of a.out.
35}
36
37}  // namespace mcld
38