mirror_corosync/Makefile.inc
2006-06-16 19:07:28 +00:00

80 lines
1.6 KiB
Makefile

# Basic OS detection
#
UNAME=$(shell uname)
ifeq "$(UNAME)" "Linux"
OPENAIS_COMPAT=LINUX
endif
ifeq "$(UNAME)" "Darwin"
OPENAIS_COMPAT=DARWIN
endif
ifneq "" "$(findstring BSD,$(UNAME))"
OPENAIS_COMPAT=BSD
endif
ifndef OPENAIS_COMPAT
$(error "OPENAIS_COMPAT cannot be detected, it must be manually defined")
endif
# BUILD_DYNAMIC can be defined to 1 to build for dynamic loading of service
# handler modules. If the developer intends to debug, building without
# dynamic modules should provide an easier route.
ifndef BUILD_DYNAMIC
BUILD_DYNAMIC=1
endif
# OPENAIS_BUILD can be defined as RELEASE or DEBUG
#
ifndef OPENAIS_BUILD
OPENAIS_BUILD=RELEASE
endif
# OPENAIS_PROFILE
# OPENAIS_COVERAGE
# default CFLAGS, LDFLAGS
#
CFLAGS =
LDFLAGS =
DYFLAGS =
# build CFLAGS, LDFLAGS
#
ifeq (${OPENAIS_BUILD}, RELEASE)
CFLAGS += -O3 -Wall
# -Wstrict-aliasing=2 TODO sameday fix all of these
ifndef OPENAIS_PROFILE
CFLAGS += -fomit-frame-pointer
endif
LDFLAGS +=
endif
ifeq (${OPENAIS_BUILD}, DEBUG)
CFLAGS += -O0 -g -Wall -DDEBUG
LDFLAGS += -g
endif
ifdef OPENAIS_PROFILE
CFLAGS += -pg
LDFLAGS += -pg
endif
ifdef OPENAIS_COVERAGE
CFLAGS += -ftest-coverage -fprofile-arcs
LDFLAGS += -ftest-coverage -fprofile-arcs
endif
# platform specific CFLAGS, LDFLAGS
#
ifeq (${OPENAIS_COMPAT}, LINUX)
override CFLAGS += -DOPENAIS_LINUX
override LDFLAGS += -ldl -lpthread
override DYFLAGS += -rdynamic
endif
ifeq (${OPENAIS_COMPAT}, BSD)
override CFLAGS += -DOPENAIS_BSD
override LDFLAGS += -pthread
override DYFLAGS += -export-dynamic
endif
ifeq (${OPENAIS_COMPAT}, DARWIN)
override CFLAGS += -DOPENAIS_DARWIN
override LDFLAGS += -lpthread
endif