Skip to content

Commit

Permalink
Set CFLAGS, CXXFLAGS and perlasm FLAVOUR when building for iOS.
Browse files Browse the repository at this point in the history
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
  • Loading branch information
pietro authored and briansmith committed May 25, 2016
1 parent d9b7262 commit f185fe5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mk/ring.mk
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ PERL_EXECUTABLE ?= perl
# The British spelling "flavour" is used for consistency with perlasm's code.
ifeq ($(findstring darwin,$(TARGET_SYS)),darwin)
PERLASM_FLAVOUR ?= macosx
else ifeq ($(TARGET_SYS),ios)
ifeq ($(findstring arm,$(TARGET_ARCH_NORMAL)),arm)
PERLASM_FLAVOUR ?= ios32
else ifeq ($(TARGET_ARCH_NORMAL),aarch64)
PERLASM_FLAVOUR ?= ios64
else
PERLASM_FLAVOUR ?= macosx
endif
else ifeq ($(TARGET_ARCH_NORMAL),aarch64)
PERLASM_FLAVOUR ?= linux64
else ifeq ($(TARGET_ARCH_NORMAL),arm)
Expand Down
22 changes: 22 additions & 0 deletions mk/top_of_makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,28 @@ CXXFLAGS_STD ?= -std=c++0x
CFLAGS += $(CFLAGS_STD)
CXXFLAGS += $(CXXFLAGS_STD)

# Add flags needed for ios.
ifeq ($(TARGET_SYS),ios)
IOS_MIN_VERSION = 7.0
ifeq ($(findstring x86,$(TARGET_ARCH_NORMAL)),x86)
IOS_SDK = iphonesimulator
IOS_VERSION_FLAG = -mios-simulator-version-min=$(IOS_MIN_VERSION)
else
IOS_SDK = iphoneos
IOS_VERSION_FLAG = -mios-version-min=$(IOS_MIN_VERSION)
ifeq ($(TARGET_ARCH_BASE),aarch64)
CFLAGS += -arch arm64
CXXFLAGS += -arch arm64
else
CFLAGS += -arch $(TARGET_ARCH_BASE)
CXXFLAGS += -arch $(TARGET_ARCH_BASE)
endif
endif
IOS_SDK_PATH = $(shell xcrun --show-sdk-path -sdk $(IOS_SDK))
CFLAGS += $(DEFAULT_TARGET_ARCH) -isysroot $(IOS_SDK_PATH) $(IOS_VERSION_FLAG)
CXXFLAGS += $(DEFAULT_TARGET_ARCH) -isysroot $(IOS_SDK_PATH) $(IOS_VERSION_FLAG)
endif

# Always add full debug info and strip dead code.
CPPFLAGS += -fpic -fdata-sections -ffunction-sections
ifeq ($(findstring darwin,$(TARGET_SYS)),darwin)
Expand Down

0 comments on commit f185fe5

Please sign in to comment.