Skip to content

Instantly share code, notes, and snippets.

@wwwins
Last active August 29, 2015 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wwwins/9127628 to your computer and use it in GitHub Desktop.
Save wwwins/9127628 to your computer and use it in GitHub Desktop.
The Makefile for my iOS projects
########################################################################
#
# Makefile for the iOS projects.
#
# Remember to modify Makefile.cfg.mk configuration.
#
# Usage:
#
# To build ipa:
# $make ipa
#
# To release app:
# $make release
#
# To clean up:
# $make clean
#
# Author: flashisobar
# URL: http://isobar.logdown.com/posts/180478-makefile-for-my-ios-project
#
########################################################################
include Makefile.cfg.mk
ifdef WORKSPACE
CC_FLAG = -workspace $(WORKSPACE)
else
CC_FLAG = -project $(PROJECT)
endif
CC=xctool
BUILD=xcodebuild
RM=/bin/rm
all: clean build archive ipa
release: bump ipa
build:
$(CC) $(CC_FLAG) -scheme $(PROJECT_NAME) build
archive:
$(CC) $(CC_FLAG) -scheme $(PROJECT_NAME) archive -archivePath "$(ARCHIVES_PATH)"
ipa: clean archive
$(RM) -rf $(IPA_PATH)
$(BUILD) -exportArchive -exportFormat ipa -archivePath "$(ARCHIVES_PATH)" -exportPath "$(IPA_PATH)" -exportProvisioningProfile "$(PROVISIONING)"
@echo
@echo "Build finished. The ipa file is in the $(ARCHIVES_PATH)."
bump:
bump.sh $BASE_PATH$(PROJECT_NAME)/$(PROJECT_NAME)-Info.plist
clean:
$(CC) $(CC_FLAG) -scheme $(PROJECT_NAME) clean
$(RM) -rf $(ARCHIVES_PATH)
# project name
PROJECT_NAME=your-project-name
# provisioning profile
PROVISIONING=Provisioning-Profile
# workspace
WORKSPACE=
# project
PROJECT=$(PROJECT_NAME).xcodeproj
# archives path, default is ~/archives/
ARCHIVES_PATH=~/archives/$(PROJECT_NAME).xcarchive/
# ipa path
IPA_PATH=~/Desktop/$(PROJECT_NAME).ipa
# base path
BASE_PATH=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment