[270] | 1 | # $Id: Config.kmk 1274 2007-11-29 20:45:51Z 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
|
---|
[1274] | 36 | KBUILD_VERSION_PATCH = 2
|
---|
| 37 | KBUILD_VERSION = "0.1.2"
|
---|
[576] | 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 | #
|
---|
[1251] | 44 | # The OS and Architecture indicators.
|
---|
| 45 | #
|
---|
| 46 | DEFS.darwin += KBUILD_OS_DARWIN
|
---|
| 47 | DEFS.freebsd += KBUILD_OS_FREEBSD
|
---|
| 48 | DEFS.linux += KBUILD_OS_LINUX
|
---|
| 49 | DEFS.netbsd += KBUILD_OS_NETBSD
|
---|
| 50 | DEFS.openbsd += KBUILD_OS_OPENBSD
|
---|
| 51 | DEFS.os2 += KBUILD_OS_OS2
|
---|
| 52 | DEFS.solaris += KBUILD_OS_SOLARIS
|
---|
| 53 | DEFS.win += KBUILD_OS_WINDOWS
|
---|
| 54 |
|
---|
| 55 | DEFS.x86 += KBUILD_ARCH_X86
|
---|
| 56 | DEFS.amd64 += KBUILD_ARCH_AMD64
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | #
|
---|
[587] | 60 | # Check if we're building a *nix installation.
|
---|
| 61 | #
|
---|
| 62 | ifdef NIX_INSTALL_DIR
|
---|
[590] | 63 | NIX_INSTALL_DIR_BIN := $(patsubst /%,%,$(NIX_INSTALL_DIR))/bin
|
---|
| 64 | NIX_INSTALL_DIR_SHARE := $(patsubst /%,%,$(NIX_INSTALL_DIR))/share/kBuild
|
---|
[587] | 65 | DEFS += \
|
---|
[590] | 66 | PATH_KBUILD=\"/$(NIX_INSTALL_DIR_SHARE)\" \
|
---|
[587] | 67 | PATH_KBUILD_BIN=\"/$(NIX_INSTALL_DIR_BIN)\"
|
---|
| 68 | endif
|
---|
[766] | 69 |
|
---|
[270] | 70 | #
|
---|
[906] | 71 | # Where to fine the GNU Make stuff (for FreeBSD and Windows).
|
---|
| 72 | #
|
---|
[952] | 73 | PATH_GNUMAKE_SRC ?= $(PATH_ROOT)/src/kmk
|
---|
[906] | 74 |
|
---|
| 75 |
|
---|
| 76 | #
|
---|
[270] | 77 | # Template for building commandline tools.
|
---|
[766] | 78 | #
|
---|
[270] | 79 | TEMPLATE_BIN = Commandline binary
|
---|
| 80 |
|
---|
[400] | 81 | TEMPLATE_BIN_INCS = $(PATH_ROOT)/src/lib
|
---|
| 82 |
|
---|
[270] | 83 | ifeq ($(BUILD_TARGET),os2)
|
---|
| 84 | TEMPLATE_BIN_TOOL = GCC3OMF
|
---|
[427] | 85 | TEMPLATE_BIN_CFLAGS.profile = -pg
|
---|
[270] | 86 | TEMPLATE_BIN_CFLAGS.release = -O3
|
---|
| 87 | TEMPLATE_BIN_LDFLAGS = -Zhigh-mem -Zstack=1024
|
---|
[587] | 88 | ifdef NIX_INSTALL_DIR
|
---|
| 89 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
| 90 | else
|
---|
[731] | 91 | TEMPLATE_BIN_INST = kBuild/bin/os2.x86/
|
---|
[587] | 92 | endif
|
---|
[270] | 93 | endif
|
---|
| 94 |
|
---|
[557] | 95 | ifeq ($(BUILD_TARGET),darwin)
|
---|
[565] | 96 | TEMPLATE_BIN_TOOL = GCC4MACHO
|
---|
[557] | 97 | TEMPLATE_BIN_CFLAGS.profile =
|
---|
| 98 | TEMPLATE_BIN_CFLAGS.release = -O3
|
---|
[766] | 99 | TEMPLATE_BIN_LDFLAGS =
|
---|
[587] | 100 | ifdef NIX_INSTALL_DIR
|
---|
| 101 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
| 102 | else
|
---|
[731] | 103 | TEMPLATE_BIN_INST = kBuild/bin/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/
|
---|
[587] | 104 | endif
|
---|
[557] | 105 | endif
|
---|
| 106 |
|
---|
[731] | 107 | ifeq ($(filter-out win nt,$(BUILD_TARGET)),)
|
---|
[861] | 108 | ifeq ($(BUILD_TARGET_ARCH),x86)
|
---|
| 109 | include $(PATH_KBUILD)/tools/VCC70.kmk # fixme! template expanding does something bad to _LIBS /me thinks.
|
---|
| 110 | TEMPLATE_BIN_TOOL = VCC70
|
---|
| 111 | TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__
|
---|
| 112 | else ifeq ($(BUILD_TARGET_ARCH),amd64)
|
---|
| 113 | TEMPLATE_BIN_TOOL = VCC80AMD64
|
---|
[1082] | 114 | TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__ __WIN64__ WIN64 \
|
---|
| 115 | _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS
|
---|
[861] | 116 | endif
|
---|
[809] | 117 | TEMPLATE_BIN_DEFS.release = NDEBUG
|
---|
| 118 | TEMPLATE_BIN_SDKS = WINPSDK
|
---|
| 119 | TEMPLATE_BIN_CFLAGS = -W3 -Zi -Zl
|
---|
| 120 | TEMPLATE_BIN_CFLAGS.release = -O2
|
---|
| 121 | TEMPLATE_BIN_CFLAGS.profile = -O2 -GH -Gh
|
---|
| 122 | TEMPLATE_BIN_INCS += \
|
---|
[270] | 123 | . \
|
---|
[906] | 124 | $(PATH_GNUMAKE_SRC)/w32/include \
|
---|
| 125 | $(PATH_GNUMAKE_SRC)/glob
|
---|
[809] | 126 | TEMPLATE_BIN_LDFLAGS = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG
|
---|
| 127 | ifeq (1,0)
|
---|
| 128 | TEMPLATE_BIN_CFLAGS += -MT
|
---|
| 129 | TEMPLATE_BIN_LIBS = \
|
---|
[861] | 130 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
|
---|
| 131 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
|
---|
| 132 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib
|
---|
[809] | 133 | else
|
---|
| 134 | TEMPLATE_BIN_CFLAGS += -MD
|
---|
| 135 | TEMPLATE_BIN_LIBS = \
|
---|
[861] | 136 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
|
---|
| 137 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcrt.lib
|
---|
| 138 | # $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcprt.lib - avoid this to save space!
|
---|
[809] | 139 | endif
|
---|
[1123] | 140 | TEMPLATE_BIN_LIBS.profile = Y:/coding/libc/svn/trunk/out/win.$(BUILD_TARGET_ARCH)/debug/kStuff/lib/kPrf2.lib
|
---|
[587] | 141 | ifdef NIX_INSTALL_DIR
|
---|
[809] | 142 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
[587] | 143 | else
|
---|
[809] | 144 | TEMPLATE_BIN_INST = kBuild/bin/win.$(BUILD_TARGET_ARCH)/
|
---|
[587] | 145 | endif
|
---|
[270] | 146 | endif
|
---|
| 147 |
|
---|
| 148 | ifndef TEMPLATE_BIN_TOOL
|
---|
[826] | 149 | # Use GCC3 when we're certain that the system is using GNU ld and ar.
|
---|
| 150 | ifeq ($(filter-out linux freebsd openbsd netbsd,$(BUILD_TARGET)),)
|
---|
| 151 | TEMPLATE_BIN_TOOL = GCC3
|
---|
| 152 | else
|
---|
| 153 | TEMPLATE_BIN_TOOL = GCC3PLAIN
|
---|
| 154 | endif
|
---|
[810] | 155 | TEMPLATE_BIN_CFLAGS.release = -O3
|
---|
[809] | 156 | ifeq ($(BUILD_TARGET),freebsd)
|
---|
[906] | 157 | TEMPLATE_BIN_INCS += $(PATH_GNUMAKE_SRC)/glob /usr/local/include
|
---|
[809] | 158 | endif
|
---|
| 159 | ifeq ($(BUILD_TARGET),linux)
|
---|
[810] | 160 | TEMPLATE_BIN_LIBS += rt
|
---|
| 161 | endif
|
---|
[809] | 162 | ifeq ($(BUILD_TARGET),solaris)
|
---|
[1245] | 163 | TEMPLATE_BIN_CFLAGS.x86 += -m32
|
---|
| 164 | TEMPLATE_BIN_CFLAGS.amd64 += -m64
|
---|
| 165 | TEMPLATE_BIN_CXXFLAGS.x86 += -m32
|
---|
| 166 | TEMPLATE_BIN_CXXFLAGS.amd64 += -m64
|
---|
| 167 | TEMPLATE_BIN_LDFLAGS.x86 += -m32
|
---|
| 168 | TEMPLATE_BIN_LDFLAGS.amd64 += -m64
|
---|
[810] | 169 | TEMPLATE_BIN_LIBS += rt
|
---|
[869] | 170 | TEMPLATE_BIN_LDFLAGS += -Wl,-i
|
---|
[809] | 171 | endif
|
---|
[587] | 172 | ifdef NIX_INSTALL_DIR
|
---|
[810] | 173 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
[587] | 174 | else
|
---|
[810] | 175 | TEMPLATE_BIN_INST = kBuild/bin/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/
|
---|
[587] | 176 | endif
|
---|
[270] | 177 | endif
|
---|
| 178 |
|
---|
[393] | 179 | #
|
---|
| 180 | # Template for building libraries for the tools.
|
---|
| 181 | #
|
---|
| 182 | TEMPLATE_LIB = Library for Commandline binary
|
---|
[557] | 183 | TEMPLATE_LIB_EXTENDS = BIN
|
---|
| 184 | TEMPLATE_LIB_INST = lib/
|
---|
| 185 | # for LIB_KDEP
|
---|
| 186 | TEMPLATE_LIB_TOOL = $(TEMPLATE_BIN_TOOL)
|
---|
[393] | 187 |
|
---|
| 188 |
|
---|
[587] | 189 | LIB_KDEP = $(PATH_OBJ)/src/lib/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
|
---|
[1010] | 190 | LIB_KUTIL = $(PATH_OBJ)/src/lib/kUtil/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kUtil$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
|
---|
[393] | 191 |
|
---|