Last active
March 8, 2025 06:34
-
-
Save sunderee/2df4769230e078a5a99aea4645ba7998 to your computer and use it in GitHub Desktop.
General Makefile that can be used for development of Flutter applications
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
.PHONY: help cleanup run-build-runner run-ios build-ios build-android build-android-apk | |
.DEFAULT_GOAL := help | |
BLUE := \033[34m | |
RESET := \033[0m | |
help: ## Show this help message | |
@echo 'Usage:' | |
@echo ' make [target]' | |
@echo '' | |
@echo 'Targets:' | |
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " $(BLUE)%-20s$(RESET) %s\n", $$1, $$2}' $(MAKEFILE_LIST) | |
cleanup: ## Clean up build artifacts and dependencies | |
@echo "Cleaning up project..." | |
@flutter clean | |
@rm -rf pubspec.lock | |
@rm -rf ios/.symlinks | |
@rm -rf ios/Pods | |
@rm -f ios/Podfile.lock | |
@flutter pub get | |
@echo "Cleanup complete" | |
run-build-runner: ## Run build_runner to generate code | |
@echo "Running build_runner..." | |
@dart run build_runner build --delete-conflicting-outputs | |
run-ios: ## Run the app on an iOS device | |
@echo "Running on iOS device..." | |
@flutter run --device-id=$(shell flutter devices | awk -F'• ' '/ios/ {print $$2}' | head -n1) | |
build-ios: cleanup ## Build iOS IPA (release) | |
@echo "Building iOS IPA..." | |
@flutter build ipa --release --obfuscate --split-debug-info=build/symbols | |
@open build/ios | |
@say "iOS IPA has been built" | |
build-android: cleanup ## Build Android App Bundle (release) | |
@echo "Building Android App Bundle..." | |
@flutter build appbundle --release --obfuscate --split-debug-info=build/symbols | |
@open build/app/outputs/bundle/release | |
@say "Android App Bundle has been built" | |
build-android-apk: cleanup ## Build Android APK (release) | |
@echo "Building Android APK..." | |
@flutter build apk --release --obfuscate --split-debug-info=build/symbols | |
@open build/app/outputs/apk/release | |
@say "Android APK has been built" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment