зеркало из https://github.com/microsoft/SCXcore.git
152 строки
4.6 KiB
Makefile
152 строки
4.6 KiB
Makefile
# -*- mode: Makefile; -*-
|
|
#--------------------------------------------------------------------------------
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
#--------------------------------------------------------------------------------
|
|
# 2007-08-23
|
|
#
|
|
# Settings for all POSIX platforms. Each can be overridden in a platform-
|
|
# specific file (Makefile.pf.<platform>, leaving this file to contain defaults.
|
|
#
|
|
#--------------------------------------------------------------------------------
|
|
|
|
# Define flags. (These will be submitted to all commands that use the preprocesor)
|
|
DEFINES=-DPF_DISTRO_$(PF_DISTRO) -DPF_MAJOR=$(PF_MAJOR) -DOS_MINOR=$(PF_MINOR) -D$(ARCH) -DPF_WIDTH=$(PF_WIDTH)
|
|
|
|
ifeq ($(ENABLE_SCX_SECURITY_HARDENING), 1)
|
|
DEFINES += -z noexecstack -Wl,-z,relro -Wl,-z,now -Wformat -Wformat-security -Werror=format-security -pie -D_FORTIFY_SOURCE=2
|
|
endif
|
|
|
|
ifeq ($(TRAVIS_CI), 1)
|
|
DEFINES += -DTRAVIS
|
|
endif
|
|
|
|
ifeq ($(SCX_STACK_ONLY), true)
|
|
DEFINES += -DSCX_STACK_ONLY
|
|
endif
|
|
|
|
# Compiler flags that reglulates warning levels
|
|
# OMI providers can't tolerate -pedantic (and, on RH4, -Wcast-qual as well)
|
|
CXX_WARN_STRICT_FLAGS=-pedantic
|
|
C_WARN_STRICT_FLAGS=-pedantic
|
|
|
|
CXX_WARN_FLAGS=-Wall -fno-nonansi-builtins -Woverloaded-virtual -Wformat -Wformat-security -Wfloat-equal -Wcast-align -Wconversion -Wswitch-enum -Wundef -Wshadow -Wwrite-strings -Wredundant-decls $(CXX_WARN_STRICT_FLAGS)
|
|
C_WARN_FLAGS=-Wall -fno-nonansi-builtins -Woverloaded-virtual -Wformat -Wformat-security -Wfloat-equal -Wcast-align -Wswitch-enum -Wundef -Wshadow -Wwrite-strings -Wredundant-decls $(C_WARN_STRICT_FLAGS)
|
|
|
|
NEED_MINUS_CAST_QUAL=0
|
|
NEED_MINUS_ERROR_CAST_QUAL=0
|
|
|
|
ifeq ($(PF_DISTRO)$(PF_MAJOR),SUSE12)
|
|
NEED_MINUS_ERROR_CAST_QUAL=1
|
|
else
|
|
ifneq ($(PFDISTRO)$(PF_MAJOR),REDHAT7)
|
|
NEED_MINUS_CAST_QUAL=1
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(NEED_MINUS_CAST_QUAL),1)
|
|
CXX_WARN_STRICT_FLAGS += -Wcast-qual
|
|
C_WARN_STRICT_FLAGS += -Wcast-qual
|
|
endif
|
|
|
|
ifeq ($(NEED_MINUS_ERROR_CAST_QUAL),1)
|
|
CXX_WARN_STRICT_FLAGS += -Werror=cast-qual
|
|
C_WARN_STRICT_FLAGS += -Werror=cast-qual
|
|
endif
|
|
|
|
# Compiler code-generation options
|
|
CXX_CGEN_FLAGS=-fPIC
|
|
|
|
# Compiler Optimization flags
|
|
CXX_OPTIMIZATION_FLAGS=-fstack-protector-all
|
|
|
|
# Universal Agent switches
|
|
ifeq ($(PF_DISTRO_ULINUX_R), 1)
|
|
DEFINES += -DPF_DISTRO_ULINUX_R
|
|
endif
|
|
|
|
ifeq ($(PF_DISTRO_ULINUX_D), 1)
|
|
DEFINES += -DPF_DISTRO_ULINUX_D
|
|
endif
|
|
|
|
# -fstack-protector-all not supported on Sles 9 - remove
|
|
ifeq ($(PF_DISTRO),SUSE)
|
|
ifeq ($(PF_MAJOR),9)
|
|
CXX_OPTIMIZATION_FLAGS := $(CXX_OPTIMIZATION_FLAGS:-fstack-protector-all=)
|
|
endif
|
|
endif
|
|
|
|
# -fstack-protector-all not supported on RH4 - remove
|
|
ifeq ($(PF_DISTRO),REDHAT)
|
|
ifeq ($(PF_MAJOR),4)
|
|
CXX_OPTIMIZATION_FLAGS := $(CXX_OPTIMIZATION_FLAGS:-fstack-protector-all=)
|
|
endif
|
|
endif
|
|
|
|
# Use -ggdb for release and debug build,and strip release binaries from debug binaries.
|
|
CXXFLAGS += -ggdb
|
|
|
|
# CXX Debug flags for debug builds
|
|
ifeq ($(BUILD_TYPE),Debug)
|
|
DEFINES += -D_DEBUG
|
|
else
|
|
DEFINES += -DNDEBUG
|
|
endif
|
|
|
|
# C and CXX Debug flags for release builds
|
|
ifeq ($(BUILD_TYPE),Release)
|
|
CFLAGS += -Os
|
|
CXXFLAGS += -Os -fno-enforce-eh-specs
|
|
endif
|
|
|
|
# Avoid stack frame corruption when throwing exceptions from
|
|
# callbacks by not allowing the optimizer to omit frame pointers
|
|
# (implicit with the -Os option). This bug was observed with the
|
|
# GCC 3.4.3 compiler on Red Hat 3.4.3-9. See WI-11657 for more.
|
|
CXXFLAGS += -fno-omit-frame-pointer
|
|
|
|
# CXX Compiler flags, end result
|
|
CXXFLAGS += $(DEFINES) $(CXX_OPTIMIZATION_FLAGS) $(CXX_WARN_FLAGS) $(CXX_CGEN_FLAGS)
|
|
CFLAGS += $(DEFINES) $(CXX_OPTIMIZATION_FLAGS) $(C_WARN_FLAGS) $(CXX_CGEN_FLAGS)
|
|
|
|
|
|
# Linker flags
|
|
LINK_OUTFLAG=-o $@
|
|
LINK_STATLIB_OUTFLAG=-o $@
|
|
|
|
#--------------------------------------------------------------------------------
|
|
# Tools for this platform
|
|
|
|
# Compiler for CPP files
|
|
CXX=g++
|
|
|
|
# Link command for executables
|
|
# Link an executable
|
|
|
|
LINK=g++ -L. -L$(INTERMEDIATE_DIR) -L$(SCXPAL_TARGET_DIR) -L$(SCXOMI_LIBS)
|
|
|
|
# Link command for static libraries (archives)
|
|
LINK_STATLIB=ar -rc
|
|
|
|
# Include paths for POSIX platforms
|
|
INCLUDES=-I$(SCX_SHARED_INCLUDE_DIR) -I$(INT_INCLUDE_DIR) -I$(SCXPAL_INT_INCLUDE_DIR) -I$(SCX_BRD) -I$(SCXPAL_DIR) -isystem$(SCX_SHARED_TST_EXT_INCLUDE_DIR) -I$(SCXOMI_INCLUDE)
|
|
UNITTEST_EXTRA_INCLUDES=-I$(SCXPAL_TEST_ROOT)/include -I$(SCX_SHARED_SRC_ROOT)
|
|
|
|
# No operation, i.e. suppressing a command
|
|
NOOP=@echo Step suppressed
|
|
|
|
# Command for making dependecies
|
|
MKDEP=g++ -MM
|
|
|
|
#--------------------------------------------------------------------------------
|
|
# File type suffixes
|
|
|
|
PF_OBJ_FILE_SUFFIX=o
|
|
PF_STAT_LIB_FILE_SUFFIX=a
|
|
PF_DYN_LIB_FILE_SUFFIX=so
|
|
PF_EXE_FILE_SUFFIX=
|
|
PF_KIT_FILE_SUFFIX=tgz
|
|
|
|
#-------------------------------- End of File -----------------------------------
|
|
|
|
|