2006-10-23 17:40:50 +02:00
|
|
|
#
|
2006-12-22 11:07:47 +01:00
|
|
|
# $Id: //poco/1.3/build/rules/global#3 $
|
2006-10-23 17:40:50 +02:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2006-12-22 11:07:47 +01:00
|
|
|
#
|
|
|
|
# Include some optional make configuration
|
|
|
|
#
|
|
|
|
sinclude $(POCO_BASE)/config.build
|
|
|
|
|
2006-10-23 17:40:50 +02:00
|
|
|
#
|
|
|
|
# Check for POCO_BUILD
|
|
|
|
#
|
|
|
|
ifndef POCO_BUILD
|
|
|
|
POCO_BUILD = $(POCO_BASE)
|
|
|
|
endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Determine OS
|
|
|
|
#
|
|
|
|
POCO_HOST_OSNAME = $(shell uname)
|
|
|
|
ifeq ($(findstring CYGWIN,$(POCO_HOST_OSNAME)),CYGWIN)
|
|
|
|
POCO_HOST_OSNAME = CYGWIN
|
|
|
|
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)
|
|
|
|
|
|
|
|
#
|
|
|
|
# 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)
|
|
|
|
|
|
|
|
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
|
|
|
|
#
|
2006-12-22 11:07:47 +01:00
|
|
|
COMMONFLAGS = -DPOCO_BUILD_HOST=$(HOSTNAME) $(POCO_FLAGS)
|
2006-10-23 17:40:50 +02:00
|
|
|
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)
|
|
|
|
|
2006-11-17 17:40:16 +01:00
|
|
|
#
|
|
|
|
# Strip Command definition
|
|
|
|
#
|
|
|
|
ifeq ($(strip $(STRIP)),)
|
|
|
|
STRIPCMD =
|
|
|
|
else
|
|
|
|
STRIPCMD = $(STRIP) $@
|
|
|
|
endif
|
|
|
|
|
2006-12-22 11:07:47 +01:00
|
|
|
#
|
|
|
|
# Remote debugging support
|
|
|
|
#
|
|
|
|
ifeq ($(strip $(STRIPDBG)),)
|
|
|
|
CPYDBG =
|
|
|
|
STRIPDBGCMD =
|
|
|
|
else
|
|
|
|
CPYDBG = cp $@ $@x
|
|
|
|
STRIPDBGCMD = $(STRIP) $@x
|
|
|
|
endif
|
|
|
|
|
2006-10-23 17:40:50 +02:00
|
|
|
#
|
|
|
|
# Make CC and CXX environment vars
|
|
|
|
#
|
|
|
|
export CC
|
|
|
|
export CXX
|