poco/build/rules/global
Chris Johnson def90185aa Added build support for stock MinGW/MSYS build of POCO.
Components now supported by default:
 Foundation {including internal PCRE lib}
 Util
 Net
 XML
 SQL
 SQL/ODBC
 SQL/SQLite
 samples/{all components supported}

Components supported with additional 3rd party MinGW/MSYS libs:
 NetSSL w/OpenSSH

Components unsupported at this time:
 testsuite: Fails to build due to TupleTest - needs slight code change MinGW can't deal with currently.  Only thing causing failure.
 CppUnit: Unable to support this due to WIN32 version of this functionality relying on MFC which does not ship with MinGW/MSYS.
 --no-wstring support due libstdc++ - will require STLPort {support coming soon}


:build/config/MinGW
 +Fixed compiler environment flags and switches
 +Linkage build supports:  SHARED, STATIC, or BOTH
 +Fixed duplicate symbol/unresolved symbol during compile
 +Added PCRE build flag for internal library build/eliminate link errors
 +Disable support of UTF-8 by default, MinGW will require STLPort 
 +Corrected system link libs for MinGW "dumb" linker

:build/rules/global
 +Added MinGW environment deduction logic

:configure
 +Fine tuned environment deduction recognizing MinGW as valid

:Data/ODBC/Makefile
 +Fixed correct ODBC libs to link

:Foundation/Makefile
 +Added logic for building correct subsystem dependency

:Util/Makefile
 +Added logic for building correct subsystem dependency
2008-02-21 09:08:44 +00:00

215 lines
3.9 KiB
Plaintext

#
# $Id: //poco/Main/build/rules/global#20 $
#
# global
#
# Global build configuration
#
# Environment variables:
# POCO_BASE: Path to POCO source tree. Must be defined.
# POCO_BUILD: Path to directory where build files are put.
# Defaults to $(POCO_BASE)
# POCO_CONFIG: Build configuration to use.
# Defaults to `uname`.
# POCO_TARGET_OSNAME: Target system operating system name (for cross builds)
# POCO_TARGET_OSARCH: Target system architecture (forr cross builds)
#
#
# Check for POCO_BASE
#
ifndef POCO_BASE
$(error POCO_BASE is not defined.)
endif
#
# Include some optional make configuration
#
sinclude $(POCO_BASE)/config.build
#
# Check for PROJECT_BASE
#
ifndef PROJECT_BASE
PROJECT_BASE = $(POCO_BASE)
endif
export PROJECT_BASE
#
# Check for POCO_BUILD
#
ifndef POCO_BUILD
POCO_BUILD = $(PROJECT_BASE)
endif
export POCO_BUILD
#
# Determine OS
#
POCO_HOST_OSNAME = $(shell uname)
ifeq ($(findstring CYGWIN,$(POCO_HOST_OSNAME)),CYGWIN)
POCO_HOST_OSNAME = CYGWIN
endif
ifeq ($(findstring MINGW,$(POCO_HOST_OSNAME)),MINGW)
POCO_HOST_OSNAME = MinGW
endif
#
# If POCO_CONFIG is not set, use the OS name as configuration name
#
ifndef POCO_CONFIG
POCO_CONFIG = $(POCO_HOST_OSNAME)
endif
#
# Check if a 64bit build is requested
#
ifndef OSARCH_64BITS
OSARCH_64BITS = 0
endif
ifeq ($(OSARCH_64BITS),1)
OSARCH_POSTFIX = 64
else
OSARCH_POSTFIX =
endif
#
# Include System Specific Settings
#
include $(POCO_BASE)/build/config/$(POCO_CONFIG)
#
# Determine operating system
#
ifndef POCO_TARGET_OSNAME
OSNAME := $(POCO_HOST_OSNAME)
else
OSNAME := $(POCO_TARGET_OSNAME)
endif
ifndef POCO_TARGET_OSARCH
OSARCH := $(subst /,-,$(shell uname -m | tr ' ' _))
else
OSARCH := $(POCO_TARGET_OSARCH)
endif
HOSTNAME := $(shell hostname)
#
# Find out current component
#
COMPONENT := $(shell $(POCO_BASE)/build/script/projname "$(PROJECT_BASE)")
#
# Define standard directories
#
SRCDIR = src
INCDIR = include
LIBDIR = lib/$(OSNAME)/$(OSARCH)
BINDIR = bin/$(OSNAME)/$(OSARCH)
OBJDIR = obj/$(OSNAME)/$(OSARCH)
DEPDIR = .dep/$(OSNAME)/$(OSARCH)
LIBPATH = $(POCO_BUILD)/$(LIBDIR)
BINPATH = $(POCO_BUILD)/$(COMPONENT)/$(BINDIR)
OBJPATH = $(POCO_BUILD)/$(COMPONENT)/$(OBJDIR)
DEPPATH = $(POCO_BUILD)/$(COMPONENT)/$(DEPDIR)
ifeq ($(POCO_BASE),$(PROJECT_BASE))
POCO_LIBRARY =
else
POCO_LIBRARY = -L$(POCO_BASE)/$(LIBDIR)
endif
ifndef LIBPREFIX
LIBPREFIX = lib
endif
#
# Build component list
#
COMPONENTS := $(shell cat $(POCO_BASE)/components)
#
# Read global library version number
#
LIBVERSION := $(shell cat $(POCO_BASE)/libversion)
#
# Determine link mode
#
ifndef LINKMODE
LINKMODE = BOTH
endif
ifeq ($(LINKMODE),SHARED)
DEFAULT_TARGET = all_shared
endif
ifeq ($(LINKMODE),STATIC)
DEFAULT_TARGET = all_static
endif
ifeq ($(LINKMODE),BOTH)
DEFAULT_TARGET = all_static all_shared
endif
#
# Compose compiler flags
#
COMMONFLAGS = -DPOCO_BUILD_HOST=$(HOSTNAME) $(POCO_FLAGS)
CFLAGS += $(COMMONFLAGS) $(SYSFLAGS)
CXXFLAGS += $(COMMONFLAGS) $(SYSFLAGS)
LINKFLAGS += $(COMMONFLAGS) $(SYSFLAGS)
ifeq ($(OSARCH_64BITS),1)
CFLAGS += $(CFLAGS64)
CXXFLAGS += $(CXXFLAGS64)
LINKFLAGS += $(LINKFLAGS64)
else
CFLAGS += $(CFLAGS32)
CXXFLAGS += $(CXXFLAGS32)
LINKFLAGS += $(LINKFLAGS32)
endif
#
# Compose object file path
#
OBJPATH_RELEASE_STATIC = $(OBJPATH)/release_static$(OSARCH_POSTFIX)
OBJPATH_DEBUG_STATIC = $(OBJPATH)/debug_static$(OSARCH_POSTFIX)
OBJPATH_RELEASE_SHARED = $(OBJPATH)/release_shared$(OSARCH_POSTFIX)
OBJPATH_DEBUG_SHARED = $(OBJPATH)/debug_shared$(OSARCH_POSTFIX)
#
# Build Include directory List
#
INCLUDE = -Iinclude $(foreach p,$(COMPONENTS),-I$(POCO_BASE)/$(p)/$(INCDIR))
#
# Build Library Directory List
#
LIBRARY = -L$(LIBPATH) $(POCO_LIBRARY)
#
# Strip Command definition
#
ifeq ($(strip $(STRIP)),)
STRIPCMD =
else
STRIPCMD = $(STRIP) $@*
endif
#
# Remote debugging support
#
ifeq ($(strip $(STRIPDBG)),)
CPYDBG =
STRIPDBGCMD =
else
CPYDBG = cp $@ $@x
STRIPDBGCMD = $(STRIP) $@x
endif
#
# Make CC and CXX environment vars
#
export CC
export CXX