1/*
2 * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#ifndef PROJECTCOMPILER_H
18#define PROJECTCOMPILER_H
19
20#include "compiler.h"
21#include <QObject>
22#include <QFile>
23
24class Project;
25class ProjectCompiler : public Compiler
26{
27 Q_OBJECT
28public:
29 ProjectCompiler(std::shared_ptr<Project> project, bool silent,bool onlyCheckSyntax);
30 void buildMakeFile();
31
32 bool onlyClean() const;
33 void setOnlyClean(bool newOnlyClean);
34
35private:
36 void createStandardMakeFile();
37 void createStaticMakeFile();
38 void createDynamicMakeFile();
39 void newMakeFile(QFile& file);
40 void writeMakeHeader(QFile& file);
41 void writeMakeDefines(QFile& file);
42 void writeMakeTarget(QFile& file);
43 void writeMakeIncludes(QFile& file);
44 void writeMakeClean(QFile& file);
45 void writeMakeObjFilesRules(QFile& file);
46 void writeln(QFile& file, const QString& s="");
47 // Compiler interface
48private:
49 bool mOnlyClean;
50protected:
51 bool prepareForCompile() override;
52 bool prepareForRebuild() override;
53};
54
55#endif // PROJECTCOMPILER_H
56