1/* 2 * This file is part of the LibreOffice project. 3 * 4 * This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 * 8 * This file incorporates work covered by the following license notice: 9 * 10 * Licensed to the Apache Software Foundation (ASF) under one or more 11 * contributor license agreements. See the NOTICE file distributed 12 * with this work for additional information regarding copyright 13 * ownership. The ASF licenses this file to you under the Apache 14 * License, Version 2.0 (the "License"); you may not use this file 15 * except in compliance with the License. You may obtain a copy of 16 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 17 */ 18 19#include <types.h> 20 21namespace gb 22{ 23 using namespace types; 24 25 class LinkTarget; 26 class Library; 27 class StaticLibrary; 28 class SdiTarget; 29 class Package; 30 31 /// CObjects are never used standalone. They only exist as part of a 32 /// LinkTarget. 33 class CObject : public HasSource, public HasDependencies, public Target 34 { 35 public: 36 Path get_source(); 37 private: 38 /// CObjects do not need to be explicitly constructed. 39 /// They are named after the path of their source file (without 40 /// file extension) from the root of their source repository. 41 CObject(String name); 42 friend class LinkTarget; 43 44 /// Platformdependent command to compile a plain C object. 45 static const Command command( 46 Path objectfile, 47 String name, 48 Path sourcefile, 49 List<String> defs, 50 List<String> cxxflags, 51 List<Path> include); 52 /// Platformdependent command to generate plain C object dependencies. 53 static const Command command_dep( 54 Path depfile, 55 String name, 56 Path sourcefile, 57 List<String> defs, 58 List<String> cxxflags, 59 List<Path> include); 60 }; 61 62 /// CxxObjects are never used standalone. They only exist as part of a 63 /// LinkTarget. 64 class CxxObject : public HasSource, public HasDependencies, public Target 65 { 66 public: 67 Path get_source(); 68 private: 69 /// CxxObjects do not need to be explicitly constructed. 70 /// They are named after the path of their source file (without 71 /// file extension) from the root of their source repository. 72 CxxObject(String name); 73 friend class LinkTarget; 74 75 /// Platformdependent command to compile a C++ object. 76 static const Command command( 77 Path objectfile, 78 String name, 79 Path sourcefile, 80 List<String> defs, 81 List<String> cxxflags, 82 List<Path> include); 83 /// Platformdependent command to generate C++ object dependencies. 84 static const Command command_dep( 85 Path objectfile, 86 String name, 87 Path sourcefile, 88 List<String> defs, 89 List<String> cxxflags, 90 List<Path> include); 91 }; 92 93 class LinkTarget : public IsCleanable, public HasDependencies, public IsLinking, public DeliversHeaders, public HasCompileSettings, public Target 94 { 95 public: 96 LinkTarget(String name); 97 98 private: 99 void get_external_headers_check(); 100 void add_internal_headers(const List<Target>& internal_headers); 101 102 /// @warning Evil Hack: SELF is set to the name of the LinkTarget 103 /// in the constructor. If SELF is not set to the LinkTarget name in 104 /// the execution of the header rule, the LinkTarget is used (linked 105 /// against) but was never defined. This might work out, if the 106 /// LinkTarget has been provided by other means (for example: 107 /// build.pl/dmake), but it should never happen in a project where 108 /// all LinkTarget s are controlled by gbuild. 109 LinkTarget& SELF; 110 List<CObject> COBJECTS; 111 List<CxxObject> CXXOBJECTS; 112 List<Library> LINKED_LIBS; 113 List<Path> AUXTARGETS; 114 List<Path> INCLUDE; 115 List<StaticLibrary> LINKED_STATIC_LIBS; 116 List<String> CFLAGS; 117 List<String> CXXFLAGS; 118 List<String> DEFS; 119 List<String> LDFLAGS; 120 List<String> TARGETTYPE_FLAGS; 121 Path DLLTARGET; 122 123 /// Platformdependent command for linking. 124 static const Command command ( 125 Path linktargetfile, 126 String linktargetname, 127 List<String> linkflags, 128 List<Library> linked_libs, 129 List<StaticLibrary> linked_static_libs, 130 List<CObject> cobjects, 131 List<CxxObject> cxxobjects); 132 /// Command to collect all dependencies of this LinkTarget. 133 static const Command command_dep( 134 Path depfile, 135 String linktargetname, 136 List<CObject> cobjects, 137 List<CxxObject> cxxobjects); 138 static const List<String> DEFAULTDEFS; 139 static const List<String> CXXFLAGS; 140 static const List<String> LDFLAGS; 141 static const List<Path> INCLUDE; 142 }; 143} 144/* vim: set filetype=cpp : */ 145