Cleaned up makefile to support OSX builds with the clang compiler
This commit is contained in:
parent
ce716f93f6
commit
c7f778ca79
1 changed files with 13 additions and 2 deletions
13
makefile
13
makefile
|
@ -67,6 +67,7 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
|
||||||
OSNAME = windows-build
|
OSNAME = windows-build
|
||||||
endif
|
endif
|
||||||
GCC_VERSION = $(shell $(GCC) -v /dev/null 2>&1 | grep 'gcc version' | awk '{ print $$3 }')
|
GCC_VERSION = $(shell $(GCC) -v /dev/null 2>&1 | grep 'gcc version' | awk '{ print $$3 }')
|
||||||
|
COMPILER_NAME = GCC Version: $(GCC_VERSION)
|
||||||
LTO_EXCLUDE_VERSIONS =
|
LTO_EXCLUDE_VERSIONS =
|
||||||
PCAPLIB = pcap
|
PCAPLIB = pcap
|
||||||
ifeq (agcc,$(findstring agcc,$(GCC))) # Android target build?
|
ifeq (agcc,$(findstring agcc,$(GCC))) # Android target build?
|
||||||
|
@ -88,6 +89,12 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
|
||||||
ifeq (,$(shell $(GCC) -v /dev/null 2>&1 | grep '\-\-enable-lto'))
|
ifeq (,$(shell $(GCC) -v /dev/null 2>&1 | grep '\-\-enable-lto'))
|
||||||
LTO_EXCLUDE_VERSIONS += $(GCC_VERSION)
|
LTO_EXCLUDE_VERSIONS += $(GCC_VERSION)
|
||||||
endif
|
endif
|
||||||
|
# OSX's clang compiler has different means of determining options than gcc
|
||||||
|
# gccm so hard set options here
|
||||||
|
ifneq (,$(shell $(GCC) -v /dev/null 2>&1 | grep 'clang version'))
|
||||||
|
COMPILER_NAME = Apple clang version $(shell $(GCC) -v /dev/null 2>&1 | grep 'clang version' | awk '{ print $$4 }')
|
||||||
|
CFLAGS_O = -Wno-comment -Wno-parentheses
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
ifeq (Linux,$(OSTYPE))
|
ifeq (Linux,$(OSTYPE))
|
||||||
LIBPATH := $(sort $(foreach lib,$(shell /sbin/ldconfig -p | grep ' => /' | sed 's/^.* => //'),$(dir $(lib))))
|
LIBPATH := $(sort $(foreach lib,$(shell /sbin/ldconfig -p | grep ' => /' | sed 's/^.* => //'),$(dir $(lib))))
|
||||||
|
@ -304,7 +311,11 @@ ifneq ($(DEBUG),)
|
||||||
CFLAGS_O = -O0
|
CFLAGS_O = -O0
|
||||||
BUILD_FEATURES = - debugging support
|
BUILD_FEATURES = - debugging support
|
||||||
else
|
else
|
||||||
|
ifneq (clang,$(findstring clang,$(COMPILER_NAME)))
|
||||||
CFLAGS_O = -O2
|
CFLAGS_O = -O2
|
||||||
|
else
|
||||||
|
CFLAGS_O := -O4 $(CFLAGS_O) -fno-strict-overflow -flto -fwhole-program
|
||||||
|
endif
|
||||||
LDFLAGS_O =
|
LDFLAGS_O =
|
||||||
GCC_MAJOR_VERSION = $(firstword $(subst ., ,$(GCC_VERSION)))
|
GCC_MAJOR_VERSION = $(firstword $(subst ., ,$(GCC_VERSION)))
|
||||||
ifneq (3,$(GCC_MAJOR_VERSION))
|
ifneq (3,$(GCC_MAJOR_VERSION))
|
||||||
|
@ -351,7 +362,7 @@ ifneq (3,$(GCC_MAJOR_VERSION))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifneq (clean,$(MAKECMDGOALS))
|
ifneq (clean,$(MAKECMDGOALS))
|
||||||
BUILD_FEATURES := $(BUILD_FEATURES). GCC Version: $(GCC_VERSION)
|
BUILD_FEATURES := $(BUILD_FEATURES). $(COMPILER_NAME)
|
||||||
$(info ***)
|
$(info ***)
|
||||||
$(info *** $(BUILD_SINGLE)Simulator$(BUILD_MULTIPLE) being built with:)
|
$(info *** $(BUILD_SINGLE)Simulator$(BUILD_MULTIPLE) being built with:)
|
||||||
$(info *** $(BUILD_FEATURES).)
|
$(info *** $(BUILD_FEATURES).)
|
||||||
|
|
Loading…
Add table
Reference in a new issue