VS2010/VS2012编译Stlport 5.2.1

来源:互联网 发布:什么是网络故障诊断 编辑:程序博客网 时间:2024/04/30 18:43
由于stlport5.2.1还没有原生支持2010和2012,需要自己添加,这里只以2012为例,

网上的其它教程都是用vc9编的,虽然不影响2010和2012直接对齐进行使用,但是也会很不爽,因为他们的dll依赖于vc9的crt库,这里采用的办法将直接依赖于vc2010或2012的crt库,另外代码中的abs函数对于2010或者2012来说是不需要的,如果你使用的时候遇到错误,直接注释该行或者用预处理指令基于MSVC_VER来屏蔽也是可以的。




configure.bat




@ECHO OFF

REM **************************************************************************

REM *

REM * configure.bat for setting up compiling STLport under Windows

REM * to see available options, call with option --help

REM *

REM * Copyright (C) 2004,2005 Michael Fink

REM *

REM **************************************************************************


REM Attention! Batch file labels only have 8 significant characters!


echo STLport Configuration Tool for Windows

echo.


REM no options at all?

if NOT "%1xyz123" == "xyz123" goto init


echo Please specify at least the compiler you are going to use,

echo use "configure --help" to see the available ones.

goto skp_comp


:init


REM initially create/overwrite config.mak

echo # STLport Configuration Tool for Windows > build\Makefiles\nmake\config.mak

echo # >> build\Makefiles\nmake\config.mak

echo # config.mak generated with command line: >> build\Makefiles\nmake\config.mak

echo # configure %1 %2 %3 %4 %5 %6 %7 %8 %9 >> build\Makefiles\nmake\config.mak

echo # >> build\Makefiles\nmake\config.mak


REM First parameter can only be help or compiler

REM help option

if "%1" == "-?" goto opt_help

if "%1" == "-h" goto opt_help

if "%1" == "/?" goto opt_help

if "%1" == "/h" goto opt_help

if "%1" == "--help" goto opt_help


REM This is necessarily a compiler

goto opt_comp


REM

REM option loop

REM

:loop


REM platform option

if "%1" == "-p" goto opt_plat

if "%1" == "/p" goto opt_plat

if "%1" == "--platform" goto opt_plat


REM cross compiling

if "%1" == "-x" goto opt_x

if "%1" == "/x" goto opt_x

if "%1" == "--cross" goto opt_x


REM C runtime library

if "%1" == "--with-static-rtl" goto opt_srtl

if "%1" == "--with-dynamic-rtl" goto opt_drtl

if "%1" == "--rtl-static" goto opt_srtl

if "%1" == "--rtl-dynamic" goto opt_drtl


REM boost support

if "%1" == "--use-boost" goto opt_bst


REM multithreading support

if "%1" == "--not-thread-safe" goto opt_st

if "%1" == "--without-thread" goto opt_st


REM rtti support

if "%1" == "--no-rtti" goto opt_rtti

if "%1" == "--without-rtti" goto opt_rtti


REM additional compiler options

if "%1" == "--extra-cxxflag" goto opt_xtra


REM library name customization

if "%1" == "--lib-motif" goto opt_motf

if "%1" == "--with-lib-motif" goto opt_motf


REM build without STLport

if "%1" == "--without-stlport" goto no_sport


REM clean rule

if "%1" == "--clean" goto opt_cln


echo Unknown option: %1


:cont_lp

echo.

shift


REM no more options?

if "%1xyz123" == "xyz123" goto end_loop


goto loop



REM **************************************************************************

REM *

REM * Help

REM *

REM **************************************************************************

:opt_help

echo The first parameter must be the compiler name, here are the available

echo keywords:

echo.

echo    msvc6    Microsoft Visual C++ 6.0

echo    msvc7    Microsoft Visual C++ .NET 2002

echo    msvc71   Microsoft Visual C++ .NET 2003

echo    msvc8    Microsoft Visual C++ 2005

echo    msvc9    Microsoft Visual C++ 2008

echo    msvc11    Microsoft Visual C++ 2012

echo    icl      Intel C++ Compiler

echo    evc3     Microsoft eMbedded Visual C++ 3 (*)

echo    evc4     Microsoft eMbedded Visual C++ .NET (*)

echo    evc8     Microsoft Visual C++ 2005 compiling for CE

echo    evc9     Microsoft Visual C++ 2008 compiling for CE

echo    evc11    Microsoft Visual C++ 2012 compiling for CE

echo.

echo  (*) For these compilers the target processor is determined automatically.

echo      You must run the WCE*.BAT file you wish to build STLport for before

echo      running configure.

echo.

echo Then the following options are available:

echo.

echo "-p <platform>" or "--platform <platform>"

echo    Build STLport for the specified platform. Not all existing platforms are

echo    available, only the ones that make a difference when building STLport are.

echo    The following keywords are available:

echo    win95    Windows 95 compatible

echo    win98    Windows 98 and up to Windows XP excluded

echo    winxp    Windows XP or later (default)

echo.

echo "-x"

echo    Enables cross-compiling; the result is that all built files that are

echo    normally put under "bin" and "lib" get extra subfolders depending on

echo    the compiler name.

echo.

echo "--with-static-rtl"

echo "--with-dynamic-rtl"

echo    Enables usage of static (libc.lib family) or dynamic (msvcrt.lib family)

echo    C/C++ runtime library when linking with STLport. If you want your appli/dll

echo    to link statically with STLport but using the dynamic C runtime use

echo    --with-dynamic-rtl; if you want to link dynamicaly with STLport but using the

echo    static C runtime use --with-static-rtl. See README.options for details.

echo    Don't forget to signal the link method when building your appli or dll, in

echo    stlport/stl/config/host.h set the following macro depending on the configure

echo    option:

echo    "--with-static-rtl  -> _STLP_USE_DYNAMIC_LIB"

echo    "--with-dynamic-rtl -> _STLP_USE_STATIC_LIB"

echo.

echo "--use-boost <boost install path>"

echo    Request use of boost support (www.boost.org). For the moment only the boost

echo    type_traits library is used to get type information and to implement some

echo    specific workaround not directly implemented by STLport. To use the same

echo    support when using STLport for your application don't forget to define

echo    _STLP_USE_BOOST_SUPPORT in stlport/stl/config/user_config.h file.

echo.

echo "--without-thread"

echo    Per default STLport libraries are built in order to be usable in a multithreaded

echo    context. If you don't need this you can ask for a not thread safe version with

echo    this option.

echo.

echo "--without-rtti"

echo    Remove rtti (run time type information) support if available.

echo.

echo "--extra-cxxflag <additional compilation options>"

echo    Use this option to add any compilation flag to the build system. For instance

echo    it can be used to activate a specific processor optimization depending on your

echo    processor. For Visual C++ .Net 2003, to activate pentium 3 optim you will use:

echo    --extra-cxxflag /G7

echo    If you have several options use several --extra-cxxflag options. For instance

echo    to also force use of wchar_t as an intrinsic type:

echo    --extra-cxxflag /G7 --extra-cxxflag /Zc:wchar_t

echo.

echo "--with-lib-motif <motif>"

echo   Use this option to customize the generated library name. The motif will be used

echo   in the last place before version information, separated by an underscore, ex:

echo   stlportd_MOTIF.5.0.lib

echo   stlportstld_static_MOTIF.5.1.lib

echo   Do not forget to define _STLP_LIB_NAME_MOTIF macro in STLport configuration file

echo   to the same value if you want to keep the auto link feature supported by some

echo   compilers.

echo.

echo "--without-stlport"

echo   Option specially targetting build of the unit tests project without STLport. This

echo   is a good way to challenge the C++ Standard library implementation comming with

echo   your compiler with STLport.

echo.

echo "--clean"

echo    Removes the build configuration file.

goto skp_comp


REM **************************************************************************

REM *

REM * Compiler configuration

REM *

REM **************************************************************************

:opt_comp


if "%1" == "msvc6" goto oc_msvc6

if "%1" == "msvc71" goto oc_msv71

if "%1" == "msvc7" goto oc_msvc7

if "%1" == "msvc8" goto oc_msvc8

if "%1" == "msvc9" goto oc_msvc9

if "%1" == "msvc11" goto oc_msvc11

if "%1" == "icl"   goto oc_icl


if "%1" == "evc3" goto oc_evc3

if "%1" == "evc4" goto oc_evc4

if "%1" == "evc8" goto oc_evc8

if "%1" == "evc9" goto oc_evc9

if "%1" == "evc11" goto oc_evc11


if "%1" == "watcom" goto oc_wtm


echo Unknown compiler: %1

goto oc_end


:oc_msvc6

:oc_wtm

echo Setting compiler: Microsoft Visual C++ 6.0

echo COMPILER_NAME=vc6 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER_VERSION=60

goto oc_msvc


:oc_msvc7

echo Setting compiler: Microsoft Visual C++ .NET 2002

echo COMPILER_NAME=vc70 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER_VERSION=70

goto oc_msvc


:oc_msv71

echo Setting compiler: Microsoft Visual C++ .NET 2003

echo COMPILER_NAME=vc71 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER_VERSION=71

goto oc_msvc


:oc_msvc8

echo Setting compiler: Microsoft Visual C++ 2005

echo COMPILER_NAME=vc8 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER_VERSION=80

goto oc_msvc


:oc_msvc9

echo Setting compiler: Microsoft Visual C++ 2008

echo COMPILER_NAME=vc9 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER_VERSION=90

goto oc_msvc


:oc_msvc11

echo Setting compiler: Microsoft Visual C++ 2012

echo COMPILER_NAME=vc11 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER_VERSION=110

goto oc_msvc


:oc_msvc

echo TARGET_OS=x86 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER=msvc

echo !include msvc.mak > .\build\lib\Makefile

echo !include msvc.mak > .\build\test\unit\Makefile

echo !include msvc.mak > .\build\test\eh\Makefile

goto oc_end


:oc_icl

echo Setting compiler: Intel C++ Compiler

echo COMPILER_NAME=icl >> build\Makefiles\nmake\config.mak

echo TARGET_OS=x86 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER=icl

echo !include icl.mak > .\build\lib\Makefile

echo !include icl.mak > .\build\test\unit\Makefile

echo !include icl.mak > .\build\test\eh\Makefile

goto oc_end


:oc_evc3

echo Setting compiler: Microsoft eMbedded Visual C++ 3

echo COMPILER_NAME=evc3 >> build\Makefiles\nmake\config.mak

rem TODO: branch on OSVERSION like below?

echo CEVERSION=300 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER_VERSION=3

goto oc_evc


:oc_evc4

echo Setting compiler: Microsoft eMbedded Visual C++ .NET

echo COMPILER_NAME=evc4 >> build\Makefiles\nmake\config.mak

if "%OSVERSION%"=="" (

    echo OSVERSION not set, assuming target is CE 4.2

    echo CEVERSION=420 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE400" (

    echo CEVERSION=400 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE420" (

    echo CEVERSION=420 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE500" (

    echo CEVERSION=500 >> build\Makefiles\nmake\config.mak

) else (

    echo Unknown value for OSVERSION.

    exit /b 1

)

set SELECTED_COMPILER_VERSION=4

goto oc_evc


:oc_evc8

echo Setting compiler: Microsoft Visual C++ .NET 2005 for Windows CE

echo COMPILER_NAME=evc8 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER_VERSION=80

if "%OSVERSION%"=="" (

    echo OSVERSION not set, assuming target is CE 5.0

    echo CEVERSION=500 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE400" (

    echo CEVERSION=400 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE420" (

    echo CEVERSION=420 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE500" (

    echo CEVERSION=500 >> build\Makefiles\nmake\config.mak

) else (

    echo Unknown value for OSVERSION.

    exit /b 1

)

set PLATFORM_SPECIFIED=1

set SELECTED_COMPILER=msvc

echo !include evc.mak > .\build\lib\Makefile

echo !include evc.mak > .\build\test\unit\Makefile

echo !include evc.mak > .\build\test\eh\Makefile

goto proc


:oc_evc9

echo Setting compiler: Microsoft Visual C++ .NET 2008 for Windows CE

echo COMPILER_NAME=evc9 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER_VERSION=90

if "%OSVERSION%"=="" (

    echo OSVERSION not set, assuming target is CE 5.0

    echo CEVERSION=500 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE400" (

    echo CEVERSION=400 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE420" (

    echo CEVERSION=420 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE500" (

    echo CEVERSION=500 >> build\Makefiles\nmake\config.mak

) else (

    echo Unknown value for OSVERSION.

    exit /b 1

)

set PLATFORM_SPECIFIED=1

set SELECTED_COMPILER=msvc

echo !include evc.mak > .\build\lib\Makefile

echo !include evc.mak > .\build\test\unit\Makefile

echo !include evc.mak > .\build\test\eh\Makefile

goto proc


:oc_evc11

echo Setting compiler: Microsoft Visual C++ .NET 2012 for Windows CE

echo COMPILER_NAME=evc11 >> build\Makefiles\nmake\config.mak

set SELECTED_COMPILER_VERSION=110

if "%OSVERSION%"=="" (

    echo OSVERSION not set, assuming target is CE 5.0

    echo CEVERSION=500 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE400" (

    echo CEVERSION=400 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE420" (

    echo CEVERSION=420 >> build\Makefiles\nmake\config.mak

) else if "%OSVERSION%"=="WCE500" (

    echo CEVERSION=500 >> build\Makefiles\nmake\config.mak

) else (

    echo Unknown value for OSVERSION.

    exit /b 1

)

set PLATFORM_SPECIFIED=1

set SELECTED_COMPILER=msvc

echo !include evc.mak > .\build\lib\Makefile

echo !include evc.mak > .\build\test\unit\Makefile

echo !include evc.mak > .\build\test\eh\Makefile

goto proc



:oc_evc

set PLATFORM_SPECIFIED=1

set SELECTED_COMPILER=evc

echo !include evc.mak > .\build\lib\Makefile

echo !include evc.mak > .\build\test\unit\Makefile

echo !include evc.mak > .\build\test\eh\Makefile

goto proc


:oc_end

goto cont_lp



REM **************************************************************************

REM *

REM * Target processor configuration (automatic)

REM *

REM **************************************************************************

:proc


if "%TARGETCPU%" == "ARM" goto pr_arm

if "%TARGETCPU%" == "ARMV4" goto pr_arm

if "%TARGETCPU%" == "ARMV4I" goto pr_arm

if "%TARGETCPU%" == "ARMV4T" goto pr_arm


if "%TARGETCPU%" == "X86" goto pr_x86

REM Type from evc3 and/or PocketPC 2002 SDK reported here

REM to correctly check the platform:

if "%TARGETCPU%" == "X86EMnset CFG=none" goto pr_emul

if "%TARGETCPU%" == "x86" goto pr_x86

if "%TARGETCPU%" == "emulator" goto pr_emul


if "%TARGETCPU%" == "R4100" goto pr_mips

if "%TARGETCPU%" == "R4111" goto pr_mips

if "%TARGETCPU%" == "R4300" goto pr_mips

if "%TARGETCPU%" == "MIPS16" goto pr_mips

if "%TARGETCPU%" == "MIPSII" goto pr_mips

if "%TARGETCPU%" == "MIPSII_FP" goto pr_mips

if "%TARGETCPU%" == "MIPSIV" goto pr_mips

if "%TARGETCPU%" == "MIPSIV_FP" goto pr_mips


if "%TARGETCPU%" == "SH3" goto pr_sh3

if "%TARGETCPU%" == "SH4" goto pr_sh4


:pr_err

echo Unknown target CPU: %TARGETCPU%

goto pr_end


:pr_arm

echo Target processor: ARM

echo TARGET_PROC=arm >> build\Makefiles\nmake\config.mak

echo TARGET_PROC_SUBTYPE=%TARGETCPU% >> build\Makefiles\nmake\config.mak

goto pr_end


:pr_x86

echo Target processor: x86

echo TARGET_PROC=x86 >> build\Makefiles\nmake\config.mak

goto pr_end


:pr_emul

echo Target processor: Emulator

echo TARGET_PROC=x86 >> build\Makefiles\nmake\config.mak

echo TARGET_PROC_SUBTYPE=emulator >> build\Makefiles\nmake\config.mak

goto pr_end


:pr_mips

echo Target processor: MIPS

echo TARGET_PROC=mips >> build\Makefiles\nmake\config.mak

echo TARGET_PROC_SUBTYPE=%TARGETCPU% >> build\Makefiles\nmake\config.mak


goto pr_end


:pr_sh3

echo Target processor: %TARGETCPU%

echo TARGET_PROC=sh3 >> build\Makefiles\nmake\config.mak

goto pr_end


:pr_sh4

echo Target processor: %TARGETCPU%

echo TARGET_PROC=sh4 >> build\Makefiles\nmake\config.mak

goto pr_end


:pr_end

goto oc_end



REM **************************************************************************

REM *

REM * Platform configuration

REM *

REM **************************************************************************

:opt_plat


if "%2" == "win95" goto op_win95

if "%2" == "win98" goto op_win98

if "%2" == "winxp" goto op_winxp


echo Unknown platform: %2

goto op_end


:op_win95

echo Setting platform: Windows 95

echo WINVER=0x0400 >> build\Makefiles\nmake\config.mak

set PLATFORM_SPECIFIED=1

goto op_end


:op_win98

echo Setting platform: Windows 98

echo WINVER=0x0410 >> build\Makefiles\nmake\config.mak

set PLATFORM_SPECIFIED=1

goto op_end


:op_winxp

echo Setting platform: Windows XP

echo WINVER=0x0501 >> build\Makefiles\nmake\config.mak

set PLATFORM_SPECIFIED=1

goto op_end


:op_end

shift


goto cont_lp



REM **************************************************************************

REM *

REM * Cross Compiling option

REM *

REM **************************************************************************


:opt_x

echo Setting up for cross compiling.

echo CROSS_COMPILING=1 >> build\Makefiles\nmake\config.mak

goto cont_lp



REM **************************************************************************

REM *

REM * C runtime library selection

REM *

REM **************************************************************************


:opt_srtl

if "%SELECTED_COMPILER%" == "msvc" goto or_sok

goto or_err


:opt_drtl

if "%SELECTED_COMPILER%" == "msvc" goto or_dok

goto or_err


:or_err

echo Error: Setting C runtime library for compiler other than microsoft ones!

goto or_end


:or_sok

echo Selecting static C runtime library for STLport

echo WITH_STATIC_RTL=1 >> build\Makefiles\nmake\config.mak

goto or_end


:or_dok

echo Selecting dynamic C runtime library for STLport

echo WITH_DYNAMIC_RTL=1 >> build\Makefiles\nmake\config.mak

goto or_end


:or_end

goto cont_lp


REM **************************************************************************

REM *

REM * boost support

REM *

REM **************************************************************************

:opt_bst

REM if (Exists("%2")) goto ob_ok

REM if !("%2" == "") goto ob_ok

goto ob_ok


echo Error: Invalid boost intallation folder ("%2").

goto ob_end


:ob_ok

echo Activating boost support using "%2" path

echo STLP_BUILD_BOOST_PATH="%2" >> build\Makefiles\nmake\config.mak


:ob_end

shift


goto cont_lp


REM **************************************************************************

REM *

REM * Multithreading support

REM *

REM **************************************************************************

:opt_st

echo Removing thread safety support

echo WITHOUT_THREAD=1 >> build\Makefiles\nmake\config.mak

goto cont_lp


REM **************************************************************************

REM *

REM * rtti support

REM *

REM **************************************************************************

:opt_rtti

echo Removing rtti support

echo WITHOUT_RTTI=1 >> build\Makefiles\nmake\config.mak

goto cont_lp


REM **************************************************************************

REM *

REM * Extra compilation flags

REM *

REM **************************************************************************

:opt_xtra

echo Adding '%2' compilation option

if "%ONE_OPTION_ADDED%" == "1" goto ox_n


echo DEFS = %2 >> build\Makefiles\nmake\config.mak

set ONE_OPTION_ADDED=1

goto ox_end


:ox_n

echo DEFS = $(DEFS) %2 >> build\Makefiles\nmake\config.mak


:ox_end

shift

goto cont_lp


REM **************************************************************************

REM *

REM * Library name configuration

REM *

REM **************************************************************************

:opt_motf

echo Using '%2' in generated library names


echo LIB_MOTIF = %2 >> build\Makefiles\nmake\config.mak


shift

goto cont_lp


REM **************************************************************************

REM *

REM * Build without STLport

REM *

REM **************************************************************************

:no_sport

echo Configured to build without STLport


echo WITHOUT_STLPORT=1 >> build\Makefiles\nmake\config.mak


shift

goto cont_lp


REM **************************************************************************

REM *

REM * Clean

REM *

REM **************************************************************************

:opt_cln

del build\Makefiles\nmake\config.mak

echo STLport configuration file removed.

goto skp_comp


REM **************************************************************************

REM *

REM * End loop

REM *

REM **************************************************************************


:end_loop


if "%PLATFORM_SPECIFIED%" == "1" goto comp

echo Setting platform: Windows XP

echo.

echo WINVER=0x0501 >> build\Makefiles\nmake\config.mak


:comp

echo Done configuring STLport.

echo.

echo Go to build/lib folder and type "nmake clean install" to build  and

echo install STLport to the "lib" and "bin" folders.

echo Go to build/test/unit folder and type nmake clean install to

echo build unit tests and install them in bin folder. 

echo.


:skp_comp

set SELECTED_COMPILER=

set SELECTED_COMPILER_VERSION=

set ONE_OPTION_ADDED=

set PLATFORM_SPECIFIED=








--------------------------------------------------------------------------

build/lib/msvc.mak



!if !EXIST(..\Makefiles\nmake\config.mak)

!error No config file found, please run 'configure --help' first.

!endif


!include ..\Makefiles\nmake\config.mak


!ifndef COMPILER_NAME

!error No compiler set, please run 'configure --help' first and chose a compiler.

!endif


!if (("$(COMPILER_NAME)" != "vc6") && \

     ("$(COMPILER_NAME)" != "vc70") && \

     ("$(COMPILER_NAME)" != "vc71") && \

     ("$(COMPILER_NAME)" != "vc8") && \

     ("$(COMPILER_NAME)" != "vc9") && \

("$(COMPILER_NAME)" != "vc11") && \

     ("$(COMPILER_NAME)" != "icl"))

!error '$(COMPILER_NAME)' not supported by this make file, please rerun 'configure' script and follow instructions.

!endif


SRCROOT=..


STLPORT_INCLUDE_DIR = ../../stlport

!include Makefile.inc


INCLUDES=$(INCLUDES) /I$(STLPORT_INCLUDE_DIR)


RC_FLAGS_REL = /I$(STLPORT_INCLUDE_DIR) /D "COMP=$(COMPILER_NAME)"

RC_FLAGS_DBG = /I$(STLPORT_INCLUDE_DIR) /D "COMP=$(COMPILER_NAME)"

RC_FLAGS_STLDBG = /I$(STLPORT_INCLUDE_DIR) /D "COMP=$(COMPILER_NAME)"


#Even if pure release and dbg targets do not need additionnal memory

#to be built they might if user wants to build a STL safe release build

#for instance.

OPT = /Zm800


!include $(SRCROOT)/Makefiles/nmake/top.mak





build/makefiles/nmake/vc11.mak




CFLAGS_COMMON = /nologo /W4 /EHsc

CXXFLAGS_COMMON = /nologo /W4 /EHsc


DEFS_STLDBG = /GS

DEFS_STATIC_STLDBG = /GS


OPT_REL = $(OPT_REL) /GL

LDFLAGS_REL = $(LDFLAGS_REL) /LTCG



!include vc-common.mak




build/makefiles/nmake/targets.mak


# Time-stamp: <04/05/01 00:45:03 ptr>

# $Id$


# dependency output parser

#!include ${RULESBASE}/dparser-$(COMPILER_NAME).mak


# if sources disposed in several dirs, calculate

# appropriate rules; here is recursive call!


#DIRS_UNIQUE_SRC := $(dir $(SRC_CPP) $(SRC_CC) $(SRC_C) )

#DIRS_UNIQUE_SRC := $(sort $(DIRS_UNIQUE_SRC) )

#include ${RULESBASE}/dirsrc.mak

!include $(RULESBASE)/$(USE_MAKE)/rules-o.mak


#ALLBASE    := $(basename $(notdir $(SRC_CC) $(SRC_CPP) $(SRC_C)))

ALLBASE    = $(SRC_CC) $(SRC_CPP) $(SRC_C)

#ALLOBJS    := $(addsuffix .o,$(ALLBASE))


# assemble objectfiles by concatenating sourcefiles and replacing extension with .o

# follow tricks to avoid leading space if one of the macro undefined:

# SRC_CC, SRC_CPP or SRC_C

!ifdef SRC_CC

ALLOBJS    = $(SRC_CC:.cc=.o)

!endif

!ifdef SRC_CPP

!ifdef ALLOBJS

ALLOBJS = $(ALLOBJS) $(SRC_CPP:.cpp=.o)

!else

ALLOBJS = $(SRC_CPP:.cpp=.o)

!endif

!endif

!ifdef SRC_C

!ifdef ALLOBJS

ALLOBJS = $(ALLOBJS) $(SRC_C:.c=.o)

!else

ALLOBJS = $(SRC_C:.c=.o)

!endif

!endif


!ifdef SRC_RC

ALLRESS = $(SRC_RC:.rc=.res)

#ALLRESS = $(ALLRESS:../=)

!endif

# ALLOBJS = $(ALLOBJS:somedir/=)


!if EXIST( .\nmake-src-prefix.mak )

# Include strip of path to sources, i.e. macro like

#   ALLOBJS = $(ALLOBJS:..\..\..\..\..\..\explore/../extern/boost/libs/test/src/=)

#   ALLOBJS = $(ALLOBJS:../=)

#   ALLRESS = $(ALLRESS:../=)

# Be careful about path spelling!

# Pay attention the order of this macro! THE ORDER IS SIGNIFICANT!

!include .\nmake-src-prefix.mak

!endif


ALLDEPS    = $(SRC_CC:.cc=.d) $(SRC_CPP:.cpp=.d) $(SRC_C:.c=.d)


#!if [echo ALLOBJS -$(ALLOBJS)-]

#!endif


# Following code adds a marker ('@') everywhere the path needs to be added.

# The code searches for '.o' followed by whitespace and replaces it with '.o @'.

# In a second stage, it removes all whitespace after an '@' sign, to cater for

# the case where more than one whitespace character was separating objectfiles.


# set marker (spaces are significant here!):

OBJ_MARKED=$(ALLOBJS:.o =.o @)

RES_MARKED=$(ALLRESS:.res =.res @)


# remove unwanted space as result of line extending, like

# target: dep1.cpp dep2.cpp \

#         dep3.cpp

# (note, that if write '... dep2.cpp\', no white space happens)

OBJ_MARKED=$(OBJ_MARKED:@ =@)

RES_MARKED=$(RES_MARKED:@ =@)


# unless empty, add marker at the beginning

!if "$(OBJ_MARKED)"!=""

OBJ_MARKED=@$(OBJ_MARKED)

!endif

!if "$(RES_MARKED)"!=""

RES_MARKED=@$(RES_MARKED)

!endif



# second step, insert compiler/CPU part to path

# Transform 'foo.o bar.o baz.o' to 'cc-xy/foo.o cc-xy/bar.o cc-xy/baz.o',

# i.e. to add a prefix path to every objectfile. Now, the problem is that

# nmake can't make substitutions where a string is replaced with the content

# of a variable. IOW, this wont work:

#OBJ=$(OBJ:@=%OUTPUT_DIR%/)

# instead, we have to cater for every possible combination of compiler (and

# target cpu when cross-compiling) by appropriate if/else clauses.


!if "$(COMPILER_NAME)" == "evc4"

!if "$(TARGET_PROC)" == "arm"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc4-arm\@)

RES_MARKED=$(RES_MARKED:@=obj\evc4-arm\@)

!elseif "$(TARGET_PROC)" == "x86"

!if "$(TARGET_PROC_SUBTYPE)" == "emulator"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc4-emulator\@)

RES_MARKED=$(RES_MARKED:@=obj\evc4-emulator\@)

!else

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc4-x86\@)

RES_MARKED=$(RES_MARKED:@=obj\evc4-x86\@)

!endif

!elseif "$(TARGET_PROC)" == "mips"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc4-mips\@)

RES_MARKED=$(RES_MARKED:@=obj\evc4-mips\@)

!elseif "$(TARGET_PROC)" == "sh3"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc4-sh3\@)

RES_MARKED=$(RES_MARKED:@=obj\evc4-sh3\@)

!elseif "$(TARGET_PROC)" == "sh4"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc4-sh4\@)

RES_MARKED=$(RES_MARKED:@=obj\evc4-sh4\@)

!else

!error No target processor configured!

!endif


!elseif "$(COMPILER_NAME)" == "evc3"

!if "$(TARGET_PROC)" == "arm"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc3-arm\@)

RES_MARKED=$(RES_MARKED:@=obj\evc3-arm\@)

!elseif "$(TARGET_PROC)" == "x86"

!if "$(TARGET_PROC_SUBTYPE)" == "emulator"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc3-emulator\@)

RES_MARKED=$(RES_MARKED:@=obj\evc3-emulator\@)

!else

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc3-x86\@)

RES_MARKED=$(RES_MARKED:@=obj\evc3-x86\@)

!endif

!elseif "$(TARGET_PROC)" == "mips"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc3-mips\@)

RES_MARKED=$(RES_MARKED:@=obj\evc3-mips\@)

!elseif "$(TARGET_PROC)" == "sh3"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc3-sh3\@)

RES_MARKED=$(RES_MARKED:@=obj\evc3-sh3\@)

!elseif "$(TARGET_PROC)" == "sh4"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc3-sh4\@)

RES_MARKED=$(RES_MARKED:@=obj\evc3-sh4\@)

!else

!error No target processor configured!

!endif


!elseif "$(COMPILER_NAME)" == "evc8"

!if "$(TARGET_PROC)" == ""

!error No target processor configured!

!elseif "$(TARGET_PROC)" == "arm"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc8-arm\@)

RES_MARKED=$(RES_MARKED:@=obj\evc8-arm\@)

!elseif "$(TARGET_PROC)" == "x86"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc8-x86\@)

RES_MARKED=$(RES_MARKED:@=obj\evc8-x86\@)

!elseif "$(TARGET_PROC)" == "mips"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc8-mips\@)

RES_MARKED=$(RES_MARKED:@=obj\evc8-mips\@)

!elseif "$(TARGET_PROC)" == "sh4"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc8-sh4\@)

RES_MARKED=$(RES_MARKED:@=obj\evc8-sh4\@)

!else

!error Unknown target processor configured!

!endif


!elseif "$(COMPILER_NAME)" == "evc9"

!if "$(TARGET_PROC)" == ""

!error No target processor configured!

!elseif "$(TARGET_PROC)" == "arm"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc9-arm\@)

RES_MARKED=$(RES_MARKED:@=obj\evc9-arm\@)

!elseif "$(TARGET_PROC)" == "x86"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc9-x86\@)

RES_MARKED=$(RES_MARKED:@=obj\evc9-x86\@)

!elseif "$(TARGET_PROC)" == "mips"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc9-mips\@)

RES_MARKED=$(RES_MARKED:@=obj\evc9-mips\@)

!elseif "$(TARGET_PROC)" == "sh4"

OBJ_MARKED=$(OBJ_MARKED:@=obj\evc9-sh4\@)

RES_MARKED=$(RES_MARKED:@=obj\evc9-sh4\@)

!else

!error Unknown target processor configured!

!endif


!elseif "$(COMPILER_NAME)" == "vc6"

OBJ_MARKED=$(OBJ_MARKED:@=obj\vc6\@)

RES_MARKED=$(RES_MARKED:@=obj\vc6\@)


!elseif "$(COMPILER_NAME)" == "vc70"

OBJ_MARKED=$(OBJ_MARKED:@=obj\vc70\@)

RES_MARKED=$(RES_MARKED:@=obj\vc70\@)


!elseif "$(COMPILER_NAME)" == "vc71"

OBJ_MARKED=$(OBJ_MARKED:@=obj\vc71\@)

RES_MARKED=$(RES_MARKED:@=obj\vc71\@)


!elseif "$(COMPILER_NAME)" == "vc8"

OBJ_MARKED=$(OBJ_MARKED:@=obj\vc8\@)

RES_MARKED=$(RES_MARKED:@=obj\vc8\@)


!elseif "$(COMPILER_NAME)" == "vc9"

OBJ_MARKED=$(OBJ_MARKED:@=obj\vc9\@)

RES_MARKED=$(RES_MARKED:@=obj\vc9\@)


!elseif "$(COMPILER_NAME)" == "vc11"

OBJ_MARKED=$(OBJ_MARKED:@=obj\vc11\@)

RES_MARKED=$(RES_MARKED:@=obj\vc11\@)


!elseif "$(COMPILER_NAME)" == "icl"

OBJ_MARKED=$(OBJ_MARKED:@=obj\icl\@)

RES_MARKED=$(RES_MARKED:@=obj\icl\@)

!else

!error No compiler configured

!endif


# last step, insert the linkage (shared/static) and release mode

# (release/debug/stldebug) into the path

OBJ=$(OBJ_MARKED:@=shared\)

OBJ_DBG=$(OBJ_MARKED:@=shared-g\)

OBJ_STLDBG=$(OBJ_MARKED:@=shared-stlg\)

OBJ_A=$(OBJ_MARKED:@=static\)

OBJ_A_DBG=$(OBJ_MARKED:@=static-g\)

OBJ_A_STLDBG=$(OBJ_MARKED:@=static-stlg\)

RES=$(RES_MARKED:@=shared\)

RES_DBG=$(RES_MARKED:@=shared-g\)

RES_STLDBG=$(RES_MARKED:@=shared-stlg\)



build/makefiles/nmake/lib/vc11.mak


# -*- makefile -*- Time-stamp: <03/10/17 14:09:57 ptr>

# $Id: vc11.mak 2403 2006-06-02 20:20:44Z dums $


!include vc-common.mak



转自:http://hi.baidu.com/dbfr2011818/item/d21e23d9f804211c20e2502f

0 0