| [270] | 1 | # $Id: Config.kmk 869 2007-04-01 03:30:12Z bird $
 | 
|---|
 | 2 | ## @file
 | 
|---|
 | 3 | #
 | 
|---|
 | 4 | # Build Configuration.
 | 
|---|
 | 5 | #
 | 
|---|
| [785] | 6 | # Copyright (c) 2005-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
 | 
|---|
| [270] | 7 | #
 | 
|---|
 | 8 | #
 | 
|---|
 | 9 | # This file is part of kBuild.
 | 
|---|
 | 10 | #
 | 
|---|
 | 11 | # kBuild is free software; you can redistribute it and/or modify
 | 
|---|
 | 12 | # it under the terms of the GNU General Public License as published by
 | 
|---|
 | 13 | # the Free Software Foundation; either version 2 of the License, or
 | 
|---|
 | 14 | # (at your option) any later version.
 | 
|---|
 | 15 | #
 | 
|---|
 | 16 | # kBuild is distributed in the hope that it will be useful,
 | 
|---|
 | 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 19 | # GNU General Public License for more details.
 | 
|---|
 | 20 | #
 | 
|---|
 | 21 | # You should have received a copy of the GNU General Public License
 | 
|---|
 | 22 | # along with kBuild; if not, write to the Free Software
 | 
|---|
 | 23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|---|
 | 24 | #
 | 
|---|
 | 25 | #
 | 
|---|
 | 26 | 
 | 
|---|
| [467] | 27 | # Enable automatic installation of what's built.
 | 
|---|
 | 28 | KBUILD_DO_AUTO_INSTALL := 1
 | 
|---|
| [576] | 29 | 
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | #
 | 
|---|
 | 32 | # The kBuild version.
 | 
|---|
 | 33 | #
 | 
|---|
 | 34 | KBUILD_VERSION_MAJOR = 0
 | 
|---|
 | 35 | KBUILD_VERSION_MINOR = 1
 | 
|---|
 | 36 | KBUILD_VERSION_PATCH = 0
 | 
|---|
 | 37 | KBUILD_VERSION = "0.1.0"
 | 
|---|
 | 38 | DEFS += \
 | 
|---|
 | 39 |         KBUILD_VERSION_MAJOR=$(KBUILD_VERSION_MAJOR) \
 | 
|---|
 | 40 |         KBUILD_VERSION_MINOR=$(KBUILD_VERSION_MINOR) \
 | 
|---|
 | 41 |         KBUILD_VERSION_PATCH=$(KBUILD_VERSION_PATCH)
 | 
|---|
| [587] | 42 | 
 | 
|---|
 | 43 | #
 | 
|---|
 | 44 | # Check if we're building a *nix installation.
 | 
|---|
 | 45 | #
 | 
|---|
 | 46 | ifdef NIX_INSTALL_DIR
 | 
|---|
| [590] | 47 | NIX_INSTALL_DIR_BIN   := $(patsubst /%,%,$(NIX_INSTALL_DIR))/bin
 | 
|---|
 | 48 | NIX_INSTALL_DIR_SHARE := $(patsubst /%,%,$(NIX_INSTALL_DIR))/share/kBuild
 | 
|---|
| [587] | 49 | DEFS += \
 | 
|---|
| [590] | 50 |         PATH_KBUILD=\"/$(NIX_INSTALL_DIR_SHARE)\" \
 | 
|---|
| [587] | 51 |         PATH_KBUILD_BIN=\"/$(NIX_INSTALL_DIR_BIN)\"
 | 
|---|
 | 52 | endif
 | 
|---|
| [766] | 53 | 
 | 
|---|
| [270] | 54 | #
 | 
|---|
 | 55 | # Template for building commandline tools.
 | 
|---|
| [766] | 56 | #
 | 
|---|
| [270] | 57 | TEMPLATE_BIN = Commandline binary
 | 
|---|
 | 58 | 
 | 
|---|
| [400] | 59 | TEMPLATE_BIN_INCS               = $(PATH_ROOT)/src/lib
 | 
|---|
 | 60 | 
 | 
|---|
| [270] | 61 | ifeq ($(BUILD_TARGET),os2)
 | 
|---|
 | 62 | TEMPLATE_BIN_TOOL               = GCC3OMF
 | 
|---|
| [427] | 63 | TEMPLATE_BIN_CFLAGS.profile     = -pg
 | 
|---|
| [270] | 64 | TEMPLATE_BIN_CFLAGS.release     = -O3
 | 
|---|
 | 65 | TEMPLATE_BIN_LDFLAGS            = -Zhigh-mem -Zstack=1024
 | 
|---|
| [587] | 66 |  ifdef NIX_INSTALL_DIR
 | 
|---|
 | 67 | TEMPLATE_BIN_INST               = $(NIX_INSTALL_DIR_BIN)/
 | 
|---|
 | 68 |  else
 | 
|---|
| [731] | 69 | TEMPLATE_BIN_INST               = kBuild/bin/os2.x86/
 | 
|---|
| [587] | 70 |  endif
 | 
|---|
| [270] | 71 | endif
 | 
|---|
 | 72 | 
 | 
|---|
| [557] | 73 | ifeq ($(BUILD_TARGET),darwin)
 | 
|---|
| [565] | 74 | TEMPLATE_BIN_TOOL               = GCC4MACHO
 | 
|---|
| [557] | 75 | TEMPLATE_BIN_CFLAGS.profile     =
 | 
|---|
 | 76 | TEMPLATE_BIN_CFLAGS.release     = -O3
 | 
|---|
| [766] | 77 | TEMPLATE_BIN_LDFLAGS            =
 | 
|---|
| [587] | 78 |  ifdef NIX_INSTALL_DIR
 | 
|---|
 | 79 | TEMPLATE_BIN_INST               = $(NIX_INSTALL_DIR_BIN)/
 | 
|---|
 | 80 |  else
 | 
|---|
| [731] | 81 | TEMPLATE_BIN_INST               = kBuild/bin/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/
 | 
|---|
| [587] | 82 |  endif
 | 
|---|
| [557] | 83 | endif
 | 
|---|
 | 84 | 
 | 
|---|
| [731] | 85 | ifeq ($(filter-out win nt,$(BUILD_TARGET)),)
 | 
|---|
| [861] | 86 |  ifeq ($(BUILD_TARGET_ARCH),x86)
 | 
|---|
 | 87 |   include $(PATH_KBUILD)/tools/VCC70.kmk        # fixme! template expanding does something bad to _LIBS /me thinks.
 | 
|---|
 | 88 |   TEMPLATE_BIN_TOOL             = VCC70
 | 
|---|
 | 89 |   TEMPLATE_BIN_DEFS             = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__
 | 
|---|
 | 90 |  else ifeq ($(BUILD_TARGET_ARCH),amd64)
 | 
|---|
 | 91 |   TEMPLATE_BIN_TOOL             = VCC80AMD64
 | 
|---|
 | 92 |   TEMPLATE_BIN_DEFS             = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__ __WIN64__ WIN64 _CRT_SECURE_NO_DEPRECATE
 | 
|---|
 | 93 |  endif
 | 
|---|
| [809] | 94 |  TEMPLATE_BIN_DEFS.release      = NDEBUG
 | 
|---|
 | 95 |  TEMPLATE_BIN_SDKS              = WINPSDK
 | 
|---|
 | 96 |  TEMPLATE_BIN_CFLAGS            = -W3 -Zi -Zl
 | 
|---|
 | 97 |  TEMPLATE_BIN_CFLAGS.release    = -O2
 | 
|---|
 | 98 |  TEMPLATE_BIN_CFLAGS.profile    = -O2 -GH -Gh
 | 
|---|
 | 99 |  TEMPLATE_BIN_INCS             += \
 | 
|---|
| [270] | 100 |         . \
 | 
|---|
 | 101 |         $(PATH_ROOT)/src/gmake/w32/include \
 | 
|---|
| [591] | 102 |         $(PATH_ROOT)/src/gmake/glob
 | 
|---|
| [809] | 103 |  TEMPLATE_BIN_LDFLAGS           = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG
 | 
|---|
 | 104 |  ifeq (1,0)
 | 
|---|
 | 105 |  TEMPLATE_BIN_CFLAGS           += -MT
 | 
|---|
 | 106 |  TEMPLATE_BIN_LIBS              = \
 | 
|---|
| [861] | 107 |         $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
 | 
|---|
 | 108 |         $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
 | 
|---|
 | 109 |         $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib
 | 
|---|
| [809] | 110 |  else
 | 
|---|
 | 111 |  TEMPLATE_BIN_CFLAGS           += -MD
 | 
|---|
 | 112 |  TEMPLATE_BIN_LIBS              = \
 | 
|---|
| [861] | 113 |         $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
 | 
|---|
 | 114 |         $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcrt.lib
 | 
|---|
 | 115 |  #      $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcprt.lib - avoid this to save space!
 | 
|---|
| [809] | 116 |  endif
 | 
|---|
 | 117 |  TEMPLATE_BIN_LIBS.profile      = g:/coding/vbox/trunk/out/win32/debug/lib/kPrf2.lib
 | 
|---|
| [587] | 118 |  ifdef NIX_INSTALL_DIR
 | 
|---|
| [809] | 119 |  TEMPLATE_BIN_INST              = $(NIX_INSTALL_DIR_BIN)/
 | 
|---|
| [587] | 120 |  else
 | 
|---|
| [809] | 121 |  TEMPLATE_BIN_INST              = kBuild/bin/win.$(BUILD_TARGET_ARCH)/
 | 
|---|
| [587] | 122 |  endif
 | 
|---|
| [270] | 123 | endif
 | 
|---|
 | 124 | 
 | 
|---|
 | 125 | ifndef TEMPLATE_BIN_TOOL
 | 
|---|
| [826] | 126 |  # Use GCC3 when we're certain that the system is using GNU ld and ar.
 | 
|---|
 | 127 |  ifeq ($(filter-out linux freebsd openbsd netbsd,$(BUILD_TARGET)),)
 | 
|---|
 | 128 |   TEMPLATE_BIN_TOOL              = GCC3
 | 
|---|
 | 129 |  else
 | 
|---|
 | 130 |   TEMPLATE_BIN_TOOL              = GCC3PLAIN
 | 
|---|
 | 131 |  endif
 | 
|---|
| [810] | 132 |  TEMPLATE_BIN_CFLAGS.release    = -O3
 | 
|---|
| [809] | 133 |  ifeq ($(BUILD_TARGET),freebsd)
 | 
|---|
| [810] | 134 |   TEMPLATE_BIN_LIBS            += iconv intl
 | 
|---|
 | 135 |   TEMPLATE_BIN_LIBPATH         += /usr/local/lib
 | 
|---|
 | 136 |   TEMPLATE_BIN_INCS            += $(PATH_ROOT)/src/gmake/glob /usr/local/include
 | 
|---|
| [809] | 137 |  endif
 | 
|---|
 | 138 |  ifeq ($(BUILD_TARGET),linux)
 | 
|---|
| [810] | 139 |   TEMPLATE_BIN_LIBS            += rt
 | 
|---|
 | 140 |  endif
 | 
|---|
| [809] | 141 |  ifeq ($(BUILD_TARGET),solaris)
 | 
|---|
| [810] | 142 |   TEMPLATE_BIN_LIBS            += rt
 | 
|---|
| [869] | 143 |   TEMPLATE_BIN_LDFLAGS         += -Wl,-i
 | 
|---|
| [809] | 144 |  endif
 | 
|---|
| [587] | 145 |  ifdef NIX_INSTALL_DIR
 | 
|---|
| [810] | 146 |   TEMPLATE_BIN_INST             = $(NIX_INSTALL_DIR_BIN)/
 | 
|---|
| [587] | 147 |  else
 | 
|---|
| [810] | 148 |   TEMPLATE_BIN_INST             = kBuild/bin/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/
 | 
|---|
| [587] | 149 |  endif
 | 
|---|
| [270] | 150 | endif
 | 
|---|
 | 151 | 
 | 
|---|
| [393] | 152 | #
 | 
|---|
 | 153 | # Template for building libraries for the tools.
 | 
|---|
 | 154 | #
 | 
|---|
 | 155 | TEMPLATE_LIB = Library for Commandline binary
 | 
|---|
| [557] | 156 | TEMPLATE_LIB_EXTENDS = BIN
 | 
|---|
 | 157 | TEMPLATE_LIB_INST    = lib/
 | 
|---|
 | 158 | # for LIB_KDEP
 | 
|---|
 | 159 | TEMPLATE_LIB_TOOL    = $(TEMPLATE_BIN_TOOL)
 | 
|---|
| [393] | 160 | 
 | 
|---|
 | 161 | 
 | 
|---|
| [587] | 162 | LIB_KDEP = $(PATH_OBJ)/src/lib/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
 | 
|---|
| [393] | 163 | 
 | 
|---|