-
-
Save mlavergn/d1e7df1dee875ab74fee707312924658 to your computer and use it in GitHub Desktop.
Xcode switcher which uses Make as it's interpreter while leveraging xcodebuild and xcode-select
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/make -f | |
.DEFAULT_GOAL := main | |
# eval trick to avoid re-execing variable | |
SEL = $(eval SEL := $$(shell read sel && echo $$$$sel))$(SEL) | |
102: | |
sudo xcode-select -s /Applications/Xcode-102-10E125.app | |
xcodebuild -version | |
110: | |
sudo xcode-select -s /Applications/Xcode-110-11A420a.app | |
xcodebuild -version | |
112: | |
sudo xcode-select -s /Applications/Xcode-112-11B52.app | |
xcodebuild -version | |
main: prompt select | |
prompt: | |
@echo "Current $(shell xcodebuild -version)" | |
@echo "Xcode version" | |
@echo "\t1) 10.2" | |
@echo "\t2) 11.0" | |
@echo "\t3) 11.2" | |
@echo -n 'Selection: ' | |
select: | |
@if [ ${SEL} = 1 ]; then\ | |
$(MAKE) -f xc 102;\ | |
fi;\ | |
if [ ${SEL} = 2 ]; then\ | |
$(MAKE) -f xc 110;\ | |
fi;\ | |
if [ ${SEL} = 3 ]; then\ | |
$(MAKE) -f xc 112;\ | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment