# $Id: Config.kmk 2044 2008-11-03 12:29:45Z bird $ ## @file # Build Configuration. # # # Copyright (c) 2005-2008 knut st. osmundsen # # This file is part of kBuild. # # kBuild is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # kBuild 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with kBuild. If not, see # # # Enable automatic installation of what's built. KBUILD_DO_AUTO_INSTALL := 1 # # The kBuild version. # KBUILD_VERSION_MAJOR = 0 KBUILD_VERSION_MINOR = 1 KBUILD_VERSION_PATCH = 5 KBUILD_VERSION = 0.1.5 DEFS += \ KBUILD_VERSION_MAJOR=$(KBUILD_VERSION_MAJOR) \ KBUILD_VERSION_MINOR=$(KBUILD_VERSION_MINOR) \ KBUILD_VERSION_PATCH=$(KBUILD_VERSION_PATCH) # # Get the svn version. # This is shipped with the tarballs in a SvnInfo.kmk in the root. # ifneq ($(wildcard $(PATH_ROOT)/SvnInfo.kmk),) # Shipped KBUILD_SVN_INFO_KMK := $(PATH_ROOT)/SvnInfo.kmk KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK) else ifneq ($(wildcard $(PATH_ROOT)/.svn/entries),) # Generate from svn info KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK) $(PATH_OBJ)/SvnInfo.ts +| $(KBUILD_SVN_INFO_KMK): $(wildcard $(PATH_ROOT)/.svn $(PATH_ROOT)/.svn/entries $(PATH_ROOT)/.svn/all-wcprops $(PATH_ROOT)/.svn/format $(PATH_ROOT)/.svn/props $(PATH_ROOT)/.svn/prop-base ) $(call MSG_GENERATE,,$(KBUILD_SVN_INFO_KMK)) @$(RM) -f $@ $@.tmp @$(MKDIR) -p $(@D) @$(REDIRECT) -o $@.tmp -E 'LC_ALL=C' -- svn info $(DEPTH) @$(SED) \ -e 's/URL: */KBUILD_SVN_URL := /' \ -e 's/Revision: */KBUILD_SVN_REV := /' \ -e '/KBUILD_SVN_/!d' \ --append $@ \ $@.tmp @$(RM) -f $@.tmp @$(CP) --changed -fv $@ $(KBUILD_SVN_INFO_KMK) ifeq ($(DEPTH),.) OTHER_CLEAN += $(KBUILD_SVN_INFO_KMK) $(PATH_OBJ)/SvnInfo.ts endif else # Some incomplete source export... KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK) $(warning Neither SvnInfo nor .svn/* was found in the root. Will have to cook up something too keep the build happy.) $(KBUILD_SVN_INFO_KMK): $(RM) -f $@ $(MKDIR) -p $(@D) $(APPEND) $@ 'KBUILD_SVN_REV := 0' $(APPEND) $@ 'KBUILD_SVN_URL := /dev/null' ifeq ($(DEPTH),.) OTHER_CLEAN += $(KBUILD_SVN_INFO_KMK) endif endif include $(KBUILD_SVN_INFO_KMK) # # The OS and Architecture indicators. # DEFS.darwin += KBUILD_OS_DARWIN DEFS.freebsd += KBUILD_OS_FREEBSD DEFS.linux += KBUILD_OS_LINUX DEFS.netbsd += KBUILD_OS_NETBSD DEFS.openbsd += KBUILD_OS_OPENBSD DEFS.os2 += KBUILD_OS_OS2 DEFS.solaris += KBUILD_OS_SOLARIS DEFS.win += KBUILD_OS_WINDOWS DEFS.x86 += KBUILD_ARCH_X86 DEFS.amd64 += KBUILD_ARCH_AMD64 # # Check if we're building a *nix installation. # ifdef NIX_INSTALL_DIR NIX_INSTALL_DIR_BIN := $(patsubst /%,%,$(NIX_INSTALL_DIR))/bin NIX_INSTALL_DIR_SHARE := $(patsubst /%,%,$(NIX_INSTALL_DIR))/share/kBuild DEFS += \ KBUILD_PATH=\"/$(NIX_INSTALL_DIR_SHARE)\" \ KBUILD_BIN_PATH=\"/$(NIX_INSTALL_DIR_BIN)\" endif # # Where to fine the GNU Make stuff (for FreeBSD and Windows). # PATH_GNUMAKE_SRC ?= $(PATH_ROOT)/src/kmk # # Template for building commandline tools. # TEMPLATE_BIN = Commandline binary TEMPLATE_BIN_INCS = $(PATH_ROOT)/src/lib TEMPLATE_BIN_DEFS.profile = NDEBUG TEMPLATE_BIN_DEFS.release = NDEBUG ifeq ($(KBUILD_TARGET),os2) TEMPLATE_BIN_TOOL = GCC3OMF TEMPLATE_BIN_CFLAGS = -g TEMPLATE_BIN_CFLAGS.profile = -pg TEMPLATE_BIN_CFLAGS.release = -O3 TEMPLATE_BIN_LDFLAGS = -Zhigh-mem -Zstack=1024 -g ifdef NIX_INSTALL_DIR TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/ else TEMPLATE_BIN_INST = kBuild/bin/os2.x86/ endif endif ifeq ($(KBUILD_TARGET),darwin) ifndef KBUILD_MACOSX_VERSION export KBUILD_MACOSX_VERSION := $(firstword $(subst ., ,$(shell uname -r))) endif KBUILD_MACOSX_SDK ?= /Developer/SDKs/MacOSX10.4u.sdk TEMPLATE_BIN_TOOL = GCC4MACHO TEMPLATE_BIN_CFLAGS = -g -mmacosx-version-min=10.4 -isysroot $(KBUILD_MACOSX_SDK) ifeq ($(USER),bird) TEMPLATE_BIN_CFLAGS += -Wall -Wextra -pedantic -Wno-unused-parameter TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS endif TEMPLATE_BIN_CFLAGS.profile = -O3 -pg TEMPLATE_BIN_CFLAGS.release = -O3 TEMPLATE_BIN_LDFLAGS = -g -mmacosx-version-min=10.4 -Wl,-syslibroot,$(KBUILD_MACOSX_SDK) ifneq ($(int-ge $(KBUILD_MACOSX_VERSION),9),) # >= 10.5 TEMPLATE_BIN_LDFLAGS += -classic_ld endif TEMPLATE_BIN_LDFLAGS.profile = -pg ifdef NIX_INSTALL_DIR TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/ else TEMPLATE_BIN_INST = kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/ endif endif ifeq ($(filter-out win nt,$(KBUILD_TARGET)),) ifeq ($(KBUILD_TARGET_ARCH),x86) include $(KBUILD_PATH)/tools/VCC70.kmk # fixme! template expanding does something bad to _LIBS /me thinks. TEMPLATE_BIN_TOOL = VCC70 TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__ else ifeq ($(KBUILD_TARGET_ARCH),amd64) TEMPLATE_BIN_TOOL = VCC80AMD64 TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__ __WIN64__ WIN64 \ _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS endif TEMPLATE_BIN_CFLAGS = -W3 -Zi -Zl TEMPLATE_BIN_CFLAGS.release = -O2 TEMPLATE_BIN_CFLAGS.profile = -O2 -GH -Gh TEMPLATE_BIN_INCS += \ . \ $(PATH_GNUMAKE_SRC)/w32/include \ $(PATH_GNUMAKE_SRC)/glob TEMPLATE_BIN_LDFLAGS = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG ifeq ($(KBUILD_TYPE),profile) TEMPLATE_BIN_SDKS = WINPSDKINCS TEMPLATE_BIN_CFLAGS += -MT TEMPLATE_BIN_LIBS = \ D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2.lib \ D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \ $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \ $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \ $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib \ D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \ $(PATH_SDK_WINPSDKINCS_LIB)/AdvAPI32.lib \ $(PATH_SDK_WINPSDKINCS_LIB)/User32.lib else TEMPLATE_BIN_SDKS = WINPSDK TEMPLATE_BIN_CFLAGS += -MD TEMPLATE_BIN_LIBS = \ $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \ $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcrt.lib # $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcprt.lib - avoid this to save space! endif ifdef NIX_INSTALL_DIR TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/ else TEMPLATE_BIN_INST = kBuild/bin/win.$(KBUILD_TARGET_ARCH)/ endif endif ifndef TEMPLATE_BIN_TOOL # Use GCC3 when we're certain that the system is using GNU ld and ar. ifeq ($(filter-out linux freebsd openbsd netbsd,$(KBUILD_TARGET)),) TEMPLATE_BIN_TOOL = GCC3 else TEMPLATE_BIN_TOOL = GCC3PLAIN endif TEMPLATE_BIN_CFLAGS = -g ifeq ($(USER),bird) TEMPLATE_BIN_CFLAGS += -Wall -Wextra -pedantic -Wno-unused-parameter TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS endif TEMPLATE_BIN_LDFLAGS = -g TEMPLATE_BIN_LDFLAGS.profile = -pg -p TEMPLATE_BIN_CFLAGS.release = -O3 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg -p ifeq ($(KBUILD_TARGET),freebsd) TEMPLATE_BIN_INCS += $(PATH_GNUMAKE_SRC)/glob /usr/local/include endif ifeq ($(KBUILD_TARGET),linux) TEMPLATE_BIN_LIBS += rt endif TEMPLATE_BIN_CFLAGS.x86 += -m32 TEMPLATE_BIN_CFLAGS.sparc32 += -m32 TEMPLATE_BIN_CFLAGS.amd64 += -m64 TEMPLATE_BIN_CFLAGS.sparc64 += -m64 TEMPLATE_BIN_CXXFLAGS.x86 += -m32 TEMPLATE_BIN_CXXFLAGS.sparc32+= -m32 TEMPLATE_BIN_CXXFLAGS.amd64 += -m64 TEMPLATE_BIN_CXXFLAGS.sparc64+= -m64 TEMPLATE_BIN_LDFLAGS.x86 += -m32 TEMPLATE_BIN_LDFLAGS.sparc32 += -m32 TEMPLATE_BIN_LDFLAGS.amd64 += -m64 TEMPLATE_BIN_LDFLAGS.sparc64 += -m64 ifeq ($(KBUILD_TARGET),solaris) TEMPLATE_BIN_LIBS += rt TEMPLATE_BIN_LDFLAGS += -Wl,-i endif ifdef NIX_INSTALL_DIR TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/ else TEMPLATE_BIN_INST = kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/ endif endif # # Template for building libraries for the tools. # TEMPLATE_LIB = Library for Commandline binary TEMPLATE_LIB_EXTENDS = BIN TEMPLATE_LIB_INST = lib/ # for LIB_KDEP TEMPLATE_LIB_TOOL = $(TEMPLATE_BIN_TOOL) LIB_KDEP = $(PATH_OBJ)/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF) LIB_KUTIL = $(PATH_OBJ)/kUtil/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kUtil$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)