Jamrules.in 8.56 KB
Newer Older
1
#
2
# Jamrules file to build BCUnit - Root Directory
3 4
# (see http://www.freetype.org/jam/index.html)
#
jds2's avatar
jds2 committed
5
# Copyright (C) 2004-2006  Jerry St.Clair
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#---------------------------------------------------------------------------

22 23
# On Linux, basic build options are set by configure.  
# See else clause below for other platforms.
jds2's avatar
jds2 committed
24
if $(OS) = LINUX || $(UNIX)
25
{
jds2's avatar
jds2 committed
26
  SLASH = / ;
27 28
  VERSION = @VERSION@ ;
  RELEASE = @RELEASE@ ;
jds2's avatar
jds2 committed
29 30 31
  VERSION_MAJOR = @VERSION_MAJOR@ ;
  VERSION_MINOR = @VERSION_MINOR@ ;
  
32 33
  # root of install path
  prefix = @prefix@ ;
34

jds2's avatar
jds2 committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
  # choice of interfaces to build into library
  if @BUILD_AUTOMATED@ = TRUE
    { BUILD_AUTOMATED = 1 ; }
  if @BUILD_BASIC@ = TRUE
    { BUILD_BASIC = 1 ; }
  if @BUILD_CONSOLE@ = TRUE
    { BUILD_CONSOLE = 1 ; }
  if @BUILD_CURSES@ != FALSE
  { 
    BUILD_CURSES = 1 ; 
    SYS_LIBS = -l@CURSES_LIB@ ;
  }
#  BUILD_WINDOWS = 1 ;
  
  # choice of whether to build examples
  if @BUILD_EXAMPLES@ = TRUE
    { BUILD_EXAMPLES = 1 ; }
  
  # choice of whether to build test program
  if @BUILD_TEST@ = TRUE
    { BUILD_TEST = 1 ; }
  
  # choice of whether to build shared library
  if @ENABLE_SHARED@ = TRUE
59
    { BUILD_SHARED_LIB = 1 ; }
60

jds2's avatar
jds2 committed
61 62 63 64
  # choice of whether to build static library
  if @ENABLE_STATIC@ = TRUE
    { BUILD_STATIC_LIB = 1 ; }

65 66 67
  # debug compilation mode
  if @ENABLE_DEBUG@ = FALSE
    { NODEBUG = 1 ; }
68

69 70 71
  # Use memory tracing
  if @ENABLE_MEMTRACE@ = TRUE
    { USE_MEMTRACE = -DMEMTRACE ; }
72

73 74
  # Recognize deprecated version 1.1 function names and build V1.1 examples
  if @ENABLE_DEPRECATED@ = TRUE
75
    { USE_DEPRECATED_NAMES = -DUSE_DEPRECATED_BCUNIT_NAMES ; }
76
}
77

78 79 80
# On other platforms, comment out the option to disable it
else
{
jds2's avatar
jds2 committed
81 82
  SLASH = \\ ;
  
83
  # Version number set manually so may be out-of-date
jds2's avatar
jds2 committed
84 85 86 87
  VERSION = 2.1 ;
  RELEASE = 0 ;
  VERSION_MAJOR = 2 ;
  VERSION_MINOR = 1 ;
88

jds2's avatar
jds2 committed
89
  # Set the root of install path
90
  prefix = c:\\dev\\BCUnit_install ;
91

jds2's avatar
jds2 committed
92 93 94 95 96 97 98 99 100 101 102 103 104
  # Comment to not include interface in library
  BUILD_AUTOMATED = 1 ; 
  BUILD_BASIC = 1 ; 
  BUILD_CONSOLE = 1 ; 
#  BUILD_CURSES = 1 ; 
  BUILD_WINDOWS = 1 ;
    
  # Comment to not build examples
  BUILD_EXAMPLES = 1 ; 
  
  # Comment to not build test program
  BUILD_TEST = 1 ; 
  
105
  # Comment to not build BCUnit shared library
jds2's avatar
jds2 committed
106 107
  BUILD_SHARED_LIB = 1 ; 

108
  # Comment to not build BCUnit static library
jds2's avatar
jds2 committed
109 110
  BUILD_STATIC_LIB = 1 ; 
  
111 112 113 114 115 116 117 118
  # Comment to compile with debugging & assertions enabled
  NODEBUG = 1 ;

  # Uncomment to perform memory tracing
  #USE_MEMTRACE = -DMEMTRACE ;

  # Uncomment to recognize deprecated version 1.1 function names
  # and build V1.1 examples
119
  #USE_DEPRECATED_NAMES = -DUSE_DEPRECATED_BCUNIT_NAMES ;
120 121
}

122 123
#---------------------------------------------------------------------------
# Options from here on should not require routine tweaking
124

125
PACKAGE = BCUnit ;
126 127

# Install locations - comment out to not install that class of file
128
INSTALL_BIN_DIR   = $(prefix)$(SLASH)bin ;
129
INSTALL_LIB_DIR   = $(prefix)$(SLASH)lib ;
130 131
INSTALL_INC_DIR   = $(prefix)$(SLASH)include$(SLASH)BCUnit ;
INSTALL_DOC_DIR   = $(prefix)$(SLASH)doc$(SLASH)BCUnit ;
132
INSTALL_MAN_DIR   = $(prefix)$(SLASH)man ;
133 134 135
INSTALL_SHARE_DIR = $(prefix)$(SLASH)share$(SLASH)BCUnit ;
#INSTALL_EXAM_DIR  = $(prefix)$(SLASH)share$(SLASH)BCUnit$(SLASH)Examples ;
#INSTALL_TEST_DIR  = $(prefix)$(SLASH)share$(SLASH)BCUnit$(SLASH)Test ;
136

137 138 139
# Build directory - - will be qualified for compiler & build type
BUILD_DIR_ROOT = $(TOP) ;

140 141
EXAMPLES_DIR   = $(TOP)$(SLASH)Examples ;

142 143
BCUNIT_HDR_DIR  = $(TOP)$(SLASH)BCUnit$(SLASH)Headers ;
BCUNIT_LIB_NAME = libbcunit ;
144 145 146

# Comment for normal jam deletion of object files after building targets
KEEPOBJS = true ;
147

148 149
if $(NODEBUG)
{
150
  CCFLAGS += -DNDEBUG ;
151 152 153 154 155 156 157
  BUILD_SUBDIR = $(SLASH)Release ;
}
else
{
  BUILD_SUBDIR = $(SLASH)Debug ;
}

158 159 160 161 162 163
if $(NT)
{
  # variables not set properly for Windows/Win9x in Jambase 2.3
  RM = del ;
  MV = move /Y ;

164 165
  SUFSHR = .dll ;

166
  # Windows-specific defines
167
  CCFLAGS = -DWIN32 -D_LIB -D_MBCS -D_DELAYTEST ;
168
  BCUNIT_WIN_DIR = $(TOP)$(SLASH)BCUnit$(SLASH)Sources$(SLASH)Win ;
169

170
  if $(BCCROOT) || ( $(TOOLSET) = BORLANDC )
171 172
  {
    CCFLAGS   += -q -d -g0 -j0 ;
173
    CCWARN    = -w -w-8004 ;
174 175
    if $(NODEBUG)
    {
176
      CCDEBUG = -v- -O2 ;
177 178 179 180 181
    }
    else
    {
      CCDEBUG = -v -y -Od ;
    }
182
    BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)bcc ;
183 184
  }

185
  else if $(MSVCNT) || ( $(TOOLSET) = VISUALC )
186 187 188 189 190
  {
    CCFLAGS   += /Ze ;
    CCWARN    = /W4 ;
    if $(NODEBUG)
    {
191
      CCDEBUG = /O2 ;
192 193 194 195 196 197 198 199 200 201 202 203 204
    }
    else
    {
      CCDEBUG = /Zi /Od ;
    }
    # Libraries are in different paths depending on VC version
    LINKFLAGS += /LIBPATH:$(VISUALC)\\lib /LIBPATH:$(VISUALC)\\PlatformSDK\\lib\\ ;
    LINKLIBS = advapi32.lib
               libc.lib
               oldnames.lib
               gdi32.lib
               user32.lib
               kernel32.lib ;
205
    BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)msvc ;
206 207
  }

208 209 210 211 212 213 214

  else if $(MINGW) || ( $(TOOLSET) = MINGW )
  {
    # uncomment to select desired warning level and ansi-strictness
    CCWARN += -Wall ;
    CCWARN += -W ;
    CCWARN += -pedantic ;
jds2's avatar
jds2 committed
215 216
    CCWARN += -Wshadow ;
    CCWARN += -ansi ;
217

218 219
    if $(NODEBUG)
    {
220
      CCDEBUG = -O3 ;
221 222 223 224 225
    }
    else
    {
      CCDEBUG = -g -O0 ;
    }
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
    BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)mingw ;
  }

  else if $(WATCOM) || ( $(TOOLSET) = WATCOM )
  {
    CCFLAGS += /fr ;
    CCWARN    = /wx ;
    if $(NODEBUG)
    {
      CCDEBUG = /ox ;
    }
    else
    {
      CCDEBUG = /od /d2 ;
    }
    BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)watcom ;
  }
}

else if $(OS) = LINUX
{
247 248
  SUFSHR = .so ;

249 250 251 252
  # uncomment to select desired warning level and ansi-strictness
  CCWARN += -Wall ;
  CCWARN += -W ;
  CCWARN += -pedantic ;
jds2's avatar
jds2 committed
253
  CCWARN += -Wshadow ;
254
  CCWARN += -ansi ;
255 256 257 258 259 260 261 262 263 264

  if $(NODEBUG)
  {
    CCDEBUG = -O3 ;
  }
  else
  {
    CCDEBUG = -g -O0 ;
  }
  BUILD_SUBDIR = $(BUILD_SUBDIR)$(SLASH)linux ;
265 266
}

267 268 269
CCFLAGS  += $(USE_MEMTRACE) $(CCWARN) $(CCDEBUG) ;
C++FLAGS += $(CCFLAGS) ;
BUILD_DIR = $(BUILD_DIR_ROOT)$(BUILD_SUBDIR) ;
270 271

#----------------------------------------------------------------------
272
# BCUnit-specific rules & actions
273
#----------------------------------------------------------------------
274 275 276 277 278 279 280
# If anyone can figure out a better way, good for you
# (and let me (jds) know)!  Here's the problem...
# The built-in Jam install rules all convert the grist of
# the source file to (:G=installed).  As a result, they
# seem unable to handle files having the same name in
# different directories.  If we want to install such files
# as the Jamfile's or Makefile.am's or README's, the built-ins
281
# can't handle it (in my hands, anyway).  As a workaround,
282 283 284 285 286
# we define a new rule which does not monkey with the grist
# in this way.  Duplicate file names will need to explicitly
# use grist so Jam knows the difference, but the standard
# <$(SOURCE_GRIST)> works in most cases.
#
287
rule DoInstallBCUnitFile
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
{
    local i t ;

    t = $(>:D=$(<)) ;

    DEPENDS install : $(t) ;
    DEPENDS $(t) : $(>) ;
    SEARCH on $(>) = $(SEARCH_SOURCE) ;
    MakeLocate $(t) : $(<) ;

    # Arrange for jam uninstall

    Clean uninstall : $(t) ;

    for i in $(>)
    {
        Install $(i:D=$(<)) : $(i) ;
        Chmod $(i:D=$(<)) ;
    }
307

308 309 310 311 312 313 314
    if $(UNIX)
    {
        if $(OWNER) { Chown $(t) ; OWNER on $(t) = $(OWNER) ; }
        if $(GROUP) { Chgrp $(t) ; GROUP on $(t) = $(GROUP) ; }
    }
}

315
rule InstallBCUnitBin
316
{
317
    DoInstallBCUnitFile $(<) : $(>) ;
318 319 320
    MODE on $(>:D=$(<)) = $(EXEMODE) ;
}

321
rule InstallBCUnitFile
322
{
323
    DoInstallBCUnitFile $(<) : $(>) ;
324 325
    MODE on $(>:D=$(<)) = $(FILEMODE) ;
}
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345

#----------------------------------------------------------
# MakeImportLibrary
#
# This is a dummy rule.  Import libraries are built in
# the dll linking directive.  However, jam doesn't know
# that, so we provide a rule which does nothing more
# than define a dependency.
#
# Parameters:
#
# 1 - name of the dll
# 2 - name of the import library
#----------------------------------------------------------
rule MakeImportLibrary
{
  DEPENDS $(>) : $(<) ;
  LOCATE on $(>) = $(BUILD_DIR) ;
}