all:
	/bin/bash ../../../scripts/check-env.sh
	/usr/bin/python3 ../../../scripts/update_version.py
	$(MAKE) -C ../../../vendor build
	xcodegen generate
	xcodebuild -configuration Release -alltargets SYMROOT="$(CURDIR)/build"

clean:
	rm -fr *.xcodeproj
	rm -fr build

run:
	bash ../../../scripts/codesign.sh build/Release
	open ./build/Release/Karabiner-Elements.app

xcode:
	open *.xcodeproj

codesign: all
	bash ../../../scripts/codesign.sh build/Release

install: codesign
	sudo rsync -a --delete \
		build/Release/Karabiner-Elements.app \
		/Applications
	sudo chown -R root:wheel /Applications/Karabiner-Elements.app
