diff --git a/Makefile b/Makefile index 8ac2eb6..36296a7 100644 --- a/Makefile +++ b/Makefile @@ -1,52 +1,62 @@ -all: app web -app: fonts icons - flutter build apk +FLUTTER=flutter BASEHREF=/demo/ -web: fonts icons - flutter build web --base-href=$(BASEHREF) --release + +all: app web +app: assets-android + $(FLUTTER) config --no-analytics + $(FLUTTER) build apk +web: assets-web + $(FLUTTER) build web --base-href=$(BASEHREF) --release rm -rf website/demo/ cp -p -r build/web/ website/demo/ gh-pages: - flutter clean - make BASEHREF=/everest/demo/ web + $(FLUTTER) clean + $(MAKE) BASEHREF=/everest/demo/ web # assumes worktree gh-pages is checked out in ./gh-pages/ cd gh-pages && git rm -rf . --ignore-unmatch && cp -p -r ../website/* . && git add . && git commit --amend --no-edit host: cd website && python -m http.server 8000 -run: fonts icons - flutter run +run: assets-android assets-web + $(FLUTTER) run test: - flutter test test/expressions_test.dart + $(FLUTTER) test test/expressions_test.dart clean: icons-clean - flutter clean + $(FLUTTER) clean rm -rf website/demo/ -icons: android/app/src/main/res/mipmap-hdpi/ic_launcher.png website/favicon.ico web/favicon.ico web/icons/Icon-192.png web/icons/Icon-maskable-192.png web/icons/Icon-512.png web/icons/Icon-maskable-512.png -android/app/src/main/res/mipmap-hdpi/ic_launcher.png: assets/launcher_icon.png - flutter pub get - flutter pub run flutter_launcher_icons:main +assets-android: fonts icons-android +assets-web: fonts icons-web + +# rasterized icons are generated from an svg file +icons-android: android/app/src/main/res/mipmap-hdpi/ic_launcher.png assets/launcher_icon.png: assets/launcher_icon.svg - inkscape -w 1024 -h 1024 assets/launcher_icon.svg -o assets/launcher_icon.png + rsvg-convert --width=1024 --height=1024 --keep-aspect-ratio assets/launcher_icon.svg > $@ +android/app/src/main/res/mipmap-hdpi/ic_launcher.png: assets/launcher_icon.png + $(FLUTTER) pub get + $(FLUTTER) pub run flutter_launcher_icons:main + +icons-web: website/favicon.ico web/favicon.ico web/icons/Icon-192.png web/icons/Icon-maskable-192.png web/icons/Icon-512.png web/icons/Icon-maskable-512.png web/favicon.ico website/favicon.ico: assets/launcher_icon.svg magick -background none assets/launcher_icon.svg -define icon:auto-resize $@ web/icons/Icon-192.png web/icons/Icon-maskable-192.png: assets/launcher_icon.svg mkdir -p web/icons/ - inkscape -w 192 -h 192 assets/launcher_icon.svg -o $@ + rsvg-convert --width=192 --height=192 --keep-aspect-ratio assets/launcher_icon.svg > $@ web/icons/Icon-512.png web/icons/Icon-maskable-512.png: assets/launcher_icon.svg mkdir -p web/icons/ - inkscape -w 512 -h 512 assets/launcher_icon.svg -o $@ + rsvg-convert --width=512 --height=512 --keep-aspect-ratio assets/launcher_icon.svg > $@ icons-clean: rm -f android/app/src/main/res/mipmap-*/ic_launcher.png rm -f website/favicon.ico web/favicon.ico web/icons/*.png rm -f assets/launcher_icon.png +# fonts are downloaded and bundled into the app fonts: fonts/NotoSansMath-Regular.ttf fonts/NotoSansMath-Regular.ttf: | build/upstream/Noto_Sans_Math.zip mkdir -p fonts/ unzip -o build/upstream/Noto_Sans_Math.zip -d fonts/ build/upstream/Noto_Sans_Math.zip: mkdir -p build/upstream/ - wget -O build/upstream/Noto_Sans_Math.zip https://fonts.google.com/download?family=Noto%20Sans%20Math + curl --output build/upstream/Noto_Sans_Math.zip https://fonts.google.com/download?family=Noto%20Sans%20Math .INTERMEDIATE: build/upstream/Noto_Sans_Math.zip -.PHONY: all app web gh-pages host run test zip fonts icons icons-clean clean +.PHONY: all app web gh-pages host run test assets-android assets-web fonts icons-android icons-web icons-clean clean diff --git a/README.md b/README.md index a609361..2ccf779 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ A mathematical puzzle game. Try it at https://mwageringel.github.io/everest/ ## Build dependencies -Building with `make` requires `flutter, python, inkscape, imagemagick`. +Building with `make` requires `flutter, curl, rsvg-convert, imagemagick`.