Skip to content

Instantly share code, notes, and snippets.

@Razzile
Created September 20, 2016 19:19
Show Gist options
  • Save Razzile/ce688b71747cf018632a521c3548070b to your computer and use it in GitHub Desktop.
Save Razzile/ce688b71747cf018632a521c3548070b to your computer and use it in GitHub Desktop.
# OS X compile stuff
_PLATFORM_CLANG = clang
ifneq ($(_THEOS_PLATFORM_ARCH),Darwin-i386)
_OSX_SDK_DIR := $(THEOS)/sdks
_OSX_SDKS := $(sort $(patsubst $(_SDK_DIR)/MacOSX%.sdk,%,$(wildcard $(_SDK_DIR)/MacOSX*.sdk)))
ifeq ($(words $(_OSX_SDKS)),0)
_OSX_NO_SDK = 1
endif
_OSX_LATEST_SDK := $(lastword $(_OSX_SDKS))
_OSX_SYSROOT = --sysroot $(THEOS)/sdks/MacOSX$(_OSX_LATEST_SDK).sdk
_PLATFORM_CLANG = $(TARGET_CC)
_OSX_MINVER = -mmacosx-version-min=$(_OSX_LATEST_SDK)
endif
mac::
ifneq ($(_OSX_NO_SDK),1)
@echo Compiling airspeaker for OS X...
@$(_PLATFORM_CLANG) $(_OSX_MINVER) $(airspeaker_FILES) $(_OSX_SYSROOT) $(airspeaker_CFLAGS) -arch x86_64 -o airspeaker_x86_64 -framework Foundation -framework AudioToolbox -framework AVFoundation -framework CFNetwork -lcrypto
@$(_PLATFORM_CLANG) $(_OSX_MINVER) $(airspeaker_FILES) $(_OSX_SYSROOT) $(airspeaker_CFLAGS_NO_ARC) -arch i386 -o airspeaker_i386 -framework Foundation -framework AudioToolbox -framework AVFoundation -framework CFNetwork -lcrypto
@$(_THEOS_PLATFORM_LIPO) -create airspeaker_x86_64 airspeaker_i386 -output airspeaker
@rm airspeaker_x86_64 airspeaker_i386
@echo Compiling airspeakerctl for OS X...
@$(_PLATFORM_CLANG) $(_OSX_MINVER) $(airspeakerctl_FILES) $(_OSX_SYSROOT) $(airspeakerctl_CFLAGS) -arch x86_64 -o airspeakerctl_x86_64
@$(_PLATFORM_CLANG) $(_OSX_MINVER) $(airspeakerctl_FILES) $(_OSX_SYSROOT) -arch i386 -o airspeakerctl_i386
@$(_THEOS_PLATFORM_LIPO) -create airspeakerctl_x86_64 airspeakerctl_i386 -output airspeakerctl
@rm airspeakerctl_x86_64 airspeakerctl_i386
else
@echo "You do not have an OS X SDK in $(_OSX_SDK_DIR). Skipping OS X AirSpeaker compile..."
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment