Makefile
Makefile source for Making faces, 65 lines. Raw file
# FaceMaker
#
# make debug build into ./build/FaceMaker.app
# make run build and launch
# make check compile only
# make test run the tests
# make release release build into ./build/FaceMaker.app
# make clean remove the build folders
#
# Before the first build, fetch ONNX Runtime and the models:
# ./Vendor/download.sh
# ./models/download.sh
#
# The build is `swift build` plus ./build.sh, which assembles and signs the .app.
# No Xcode project is needed; Xcode or the swift.org toolchain only provides swift.
SWIFT ?= swift
CONFIG := debug
APP_NAME := FaceMaker
APP := build/$(APP_NAME).app
VERSION ?= $(shell sed -n '1p' VERSION | tr -d '[:space:]')
DEV_IDENTITY ?= -
ICON_SCRIPT := scripts/make-icon.swift
APP_ICON := build/AppIcon.icns
.PHONY: all build release run check test icon clean deps
all: build
deps:
@[ -f Vendor/onnxruntime/lib/libonnxruntime.1.30.0.dylib ] || { \
echo "✗ ONNX Runtime is missing: run ./Vendor/download.sh"; exit 1; }
@[ -f models/mobilestylegan_ffhq_v2-synth.onnx ] || \
echo " (no models yet: run ./models/download.sh before using the app)"
# The app icon, rendered at every macOS size and packaged by iconutil.
$(APP_ICON): $(ICON_SCRIPT) Resources/AppIconSource.png
@mkdir -p build
@$(SWIFT) $(ICON_SCRIPT)
@iconutil -c icns build/AppIcon.iconset -o $(APP_ICON)
@echo "✓ $(APP_ICON)"
icon: $(APP_ICON)
build: deps $(APP_ICON)
SWIFT="$(SWIFT)" SIGN_IDENTITY="$(DEV_IDENTITY)" VERSION="$(VERSION)" ./build.sh $(CONFIG)
release: deps $(APP_ICON)
SWIFT="$(SWIFT)" SIGN_IDENTITY="$(DEV_IDENTITY)" VERSION="$(VERSION)" ./build.sh release
run: build
open "$(APP)"
check: deps
$(SWIFT) build -c $(CONFIG) --scratch-path .build-make
@echo "✓ compiles ($(CONFIG))"
test: deps
$(SWIFT) test --scratch-path .build-make
@echo "✓ tests pass"
clean:
rm -rf build .build .build-make
@echo "✓ removed build/, .build/ and .build-make/"