# # $Id: //poco/1.1.0/build/rules/global#1 $ # # global # # Global build configuration # # # Check for POCO_BASE # ifndef POCO_BASE $(error POCO_BASE is not defined.) endif POCO_BUILD = $(POCO_BASE)/build # # If POCO_CONFIG is not set, use the OS name as configuration name # ifndef POCO_CONFIG POCO_CONFIG = $(shell uname) 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_BUILD)/config/$(POCO_CONFIG) # # Determine operating system # ifndef POCO_TARGET_OSNAME OSNAME := $(shell uname) 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_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_BASE)/$(LIBDIR) BINPATH = $(POCO_BASE)/$(COMPONENT)/$(BINDIR) OBJPATH = $(POCO_BASE)/$(COMPONENT)/$(OBJDIR) DEPPATH = $(POCO_BASE)/$(COMPONENT)/$(DEPDIR) # # Build component list # COMPONENTS := $(shell cat $(POCO_BASE)/components) # # 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) 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) # # Make CC and CXX environment vars # export CC export CXX