1f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines//===- OutputCmd.cpp -----------------------------------------------------===//
2f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines//
3f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines//                     The MCLinker Project
4f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines//
5f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines// This file is distributed under the University of Illinois Open Source
6f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines// License. See LICENSE.TXT for details.
7f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines//
8f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines//===----------------------------------------------------------------------===//
937b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Script/OutputCmd.h"
1037b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Support/raw_ostream.h"
1137b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/LinkerScript.h"
1237b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Module.h"
13f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines
1437b74a387bb3993387029859c2d9d051c41c724eStephen Hinesnamespace mcld {
15f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines
16f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines//===----------------------------------------------------------------------===//
17f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines// OutputCmd
18f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines//===----------------------------------------------------------------------===//
19f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen HinesOutputCmd::OutputCmd(const std::string& pOutputFile)
2037b74a387bb3993387029859c2d9d051c41c724eStephen Hines    : ScriptCommand(ScriptCommand::OUTPUT), m_OutputFile(pOutputFile) {
21f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines}
22f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines
2337b74a387bb3993387029859c2d9d051c41c724eStephen HinesOutputCmd::~OutputCmd() {
24f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines}
25f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines
2637b74a387bb3993387029859c2d9d051c41c724eStephen Hinesvoid OutputCmd::dump() const {
27f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines  mcld::outs() << "OUTPUT ( " << m_OutputFile << " )\n";
28f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines}
29f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines
3037b74a387bb3993387029859c2d9d051c41c724eStephen Hinesvoid OutputCmd::activate(Module& pModule) {
31f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines  pModule.getScript().setOutputFile(m_OutputFile);
32f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines  // TODO: set the output name if there is no `-o filename' on the cmdline.
33f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines  // This option is to define a default name for the output file other than the
34f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines  // usual default of a.out.
35f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines}
36f33f6de54db174aa679a4b6d1e040d37e95541c0Stephen Hines
3737b74a387bb3993387029859c2d9d051c41c724eStephen Hines}  // namespace mcld
38