summaryrefslogtreecommitdiff
path: root/solenv/doc/gbuild/solenv/gbuild/linktarget.mk
blob: 5fb7ead86b8328b0a1257c57ef0535219fee08f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include <types.h>

namespace gb
{
    using namespace types;

    class LinkTarget;
    class Library;
    class StaticLibrary;
    class SdiTarget;
    class Package;

    /// CObjects are never used standalone. They only exist as part of a 
    /// LinkTarget.
    class CObject : public HasSource, public HasDependencies, public Target
    {
        public:
            Path get_source();
        private:
            /// CObjects do not need to be explicitly constructed.
            /// They are named after the path of their source file (without
            /// file extension) from the root of their source repository.
            CObject(String name);
            friend class LinkTarget;

            /// Platformdependent command to compile a plain C object.
            static const Command command(
                Path objectfile,
                String name,
                Path sourcefile,
                List<String> defs,
                List<String> cxxflags,
                List<Path> include);
            /// Platformdependent command to generate plain C object dependencies.
            static const Command command_dep(
                Path depfile,
                String name,
                Path sourcefile,
                List<String> defs,
                List<String> cxxflags,
                List<Path> include);
    };

    /// CxxObjects are never used standalone. They only exist as part of a 
    /// LinkTarget.
    class CxxObject : public HasSource, public HasDependencies, public Target
    {
        public:
            Path get_source();
        private:
            /// CxxObjects do not need to be explicitly constructed.
            /// They are named after the path of their source file (without
            /// file extension) from the root of their source repository.
            CxxObject(String name);
            friend class LinkTarget;

            /// Platformdependent command to compile a C++ object.
            static const Command command(
                Path objectfile,
                String name,
                Path sourcefile,
                List<String> defs,
                List<String> cxxflags,
                List<Path> include);
            /// Platformdependent command to generate C++ object dependencies.
            static const Command command_dep(
                Path objectfile,
                String name,
                Path sourcefile,
                List<String> defs,
                List<String> cxxflags,
                List<Path> include);
    };

    class LinkTarget : public IsCleanable, public HasDependencies, public IsLinking, public DeliversHeaders, public HasCompileSettings, public Target
    {
        public:
            LinkTarget(String name);

        private:
            void get_external_headers_check();
            void add_internal_headers(const List<Target>& internal_headers);

            /// @warning Evil Hack: SELF is set to the name of the LinkTarget
            /// in the constructor. If SELF is not set to the LinkTarget name in
            /// the execution of the header rule, the LinkTarget is used (linked
            /// against) but was never defined. This might work out, if the
            /// LinkTarget has been provided by other means (for example:
            /// build.pl/dmake), but it should never happen in a project where
            /// all LinkTarget s are controlled by gbuild.
            LinkTarget& SELF;
            List<CObject> COBJECTS;
            List<CxxObject> CXXOBJECTS;
            List<Library> LINKED_LIBS;
            List<Path> AUXTARGETS;
            List<Path> INCLUDE;
            List<Path> INCLUDE_STL;
            List<StaticLibrary> LINKED_STATIC_LIBS;
            List<String> CFLAGS;
            List<String> CXXFLAGS;
            List<String> DEFS;
            List<String> LDFLAGS;
            List<String> TARGETTYPE_FLAGS;
            Path DLLTARGET;

            /// Platformdependent command for linking.
            static const Command command (
                Path linktargetfile,
                String linktargetname,
                List<String> linkflags,
                List<Library> linked_libs,
                List<StaticLibrary> linked_static_libs,
                List<CObject> cobjects,
                List<CxxObject> cxxobjects);
            /// Command to collect all dependencies of this LinkTarget.
            static const Command command_dep(
                Path depfile,
                String linktargetname,
                List<CObject> cobjects,
                List<CxxObject> cxxobjects);
            static const List<String> DEFAULTDEFS;
            static const List<String> CXXFLAGS;
            static const List<String> LDFLAGS;
            static const List<Path> INCLUDE;
            static const List<Path> INCLUDE_STL;
    };
}
/* vim: set filetype=cpp : */