File: Common.om

package info (click to toggle)
omake 0.10.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,076 kB
  • sloc: ml: 49,729; ansic: 5,163; makefile: 688; sh: 110
file content (184 lines) | stat: -rw-r--r-- 5,767 bytes parent folder | download | duplicates (3)
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
########################################################################
# General configuration.
#
# Copyright (C) 2003-2005 Jason Hickey and Mojave Group
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this file, to deal in the File without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the File, and to permit persons to whom the File
# is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the File.
#
# THE FILE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# FILE OR THE USE OR OTHER DEALINGS IN THE FILE.

########################################################################
# Mention a few of the other standard variables here.
#
# \begin{doc}
# \section{The OMakeroot file}
# \index{OMakeroot}
#
# The standard \File{OMakeroot} file defines the functions are rules
# for building standard projects.
#
# \subsection{Variables}
# \var{ROOT} The root directory of the current project.
# \var{CWD} The current working directory (the directory is set for each \File{OMakefile} in the project).
# \var{EMPTY} The empty string.
# \var{STDROOT} The name of the standard installed \File{OMakeroot} file.
# \end{doc}
#
ROOT  = $(dir .)
LIB   = $(dir lib)
BIN   = $(dir bin)

#
# A default sort rule
#
.ORDER: .BUILDORDER

#
# \begin{doc}
# \varlabel{ABORT_ON_COMMAND_ERROR}{ABORT\_ON\_COMMAND\_ERROR} If set to true, the construction of a target should
#   be aborted whenever one of the commands to build it fail.  This defaults to true,
#   and should normally be left that way.
#
# \varlabel{SCANNER_MODE}{SCANNER\_MODE} This variable should be defined as one of four values
#    (defaults to \verb+enabled+).
# \begin{description}
# \item[enabled] Allow the use of default \verb+.SCANNER+ rules.  Whenever a rule does
#    not specify a \verb+:scanner:+ dependency explicitly, try to find a
#    \verb+.SCANNER+ with the same target name.
# \item[disabled] Never use default \verb+.SCANNER+ rules.
# \item[warning] Allow the use of default \verb+.SCANNER+ rules, but print a warning
#    whenever one is selected.
# \item[error] Do not allow the use of default \verb+.SCANNER+ rules.  If a rule
#    does not specify a \verb+:scanner:+ dependency, and there is a default
#    \verb+.SCANNER+ rule, the build will terminate abnormally.
# \end{description}
# \end{doc}
#

# These are defined in Omake_builtin_base
# ABORT_ON_COMMAND_ERROR = true
# SCANNER_MODE = enabled

########################################################################
# Generic Unix section
#

#
# \begin{doc}
# \subsection{System variables}
#
# \var{INSTALL} The command to install a program (\verb+install+ on \verb+Unix+, \verb+cp+ on \verb+Win32+).
# \var{PATHSEP} The normal path separator (\verb+:+ on \verb+Unix+, \verb+;+ on \verb+Win32+).
# \var{DIRSEP} The normal directory separator (\verb+/+ on \verb+Unix+, \verb+\+ on \verb+Win32+).
# \varlabel{EXT_OBJ}{EXT\_OBJ} File suffix for an object file (default is \verb+.o+ on \verb+Unix+, and \verb+.obj+ on \verb+Win32+).
# \varlabel{EXT_LIB}{EXT\_LIB} File suffix for a static library (default is \verb+.a+ on \verb+Unix+, and \verb+.lib+ on \verb+Win32+).
# \varlabel{EXT_DLL}{EXT\_DLL} File suffix for a shared library (default is \verb+.so+ on \verb+Unix+, and \verb+.dll+ on \verb+Win32+).
# \varlabel{EXT_ASM}{EXT\_ASM} File suffix for an assembly file (default is \verb+.s+ on \verb+Unix+, and \verb+.asm+ on \verb+Win32+).
# \var{EXE} File suffix for executables (default is empty for \verb+Unix+, and \verb+.exe+ on \verb+Win32+ and \verb+Cygwin+).
# \end{doc}
#

#
# These commands are builtin, and they are the same on all platforms.
# The uppercase variables are defined for backwards compatibility only,
# their usage is deprecated.
#
CP = cp
MV = mv
RM = rm -f
MKDIR = mkdir
RMDIR = rmdir
CHMOD = chmod

# We now support both msvc and mingw for Win32. CCOMPTYPE is "msvc" for the
# former case and "cc" for the latter. There is some fallback code for old
# omake bootstraps, though:

if $(not $(defined CCOMPTYPE))
    if $(equal $(OSTYPE), Win32)
        CCOMPTYPE = msvc
        export
    else
        CCOMPTYPE = cc
        export
    export


#println(ccomptype: $(CCOMPTYPE))

switch $(CCOMPTYPE)
case cc
    EXT_LIB = .a
    EXT_DLL = .so            # but may be overridden below
    EXT_OBJ = .o
    EXT_ASM = .s
    EXE =                    # but may be overridden below
    export
case msvc
    EXT_LIB = .lib
    EXT_DLL = .dll
    EXT_OBJ = .obj
    EXT_ASM = .asm
    EXE = .exe
    export


if $(equal $(OSTYPE), Win32)
    #
    # Command names
    #
    INSTALL = cp
    PATHSEP = ;
    DIRSEP = \\

    #
    # Common suffixes for files
    #
    EXT_DLL = .dll
    EXE = .exe

    export
else
    #
    # Command names
    #
    INSTALL = install
    PATHSEP = :
    DIRSEP = /
    export

if $(equal $(OSTYPE), Cygwin)
    EXE = .exe
    export

declare LN
if $(not $(defined USE_SYSTEM_COMMANDS))
    if $(not $(equal $(OSTYPE), Win32))
        LN = ln -sf
        export
    export
else
    LN = ln-or-cp
    export

# XXX: JYH: this is a total hack.
# It should be the case the :scanner: $(EMPTY) turns off scanners.
#
NOSCANNER = /scan-dummy

.SCANNER: $(NOSCANNER)
    @