BASE_DIR=$(realpath ../..) # The name of the rust binary BIN_NAME=$(shell sed -n 's/name = "\(.*\)"/\1/p' $(BASE_DIR)/Cargo.toml | head -n1) # The app id (e.g. org.example.MyApp) APP_ID=$(shell sed -n 's/id = "\(.*\)"/\1/p' $(BASE_DIR)/App.toml | head -n1) # The rust target directory TARGET_DIR=$(BASE_DIR)/target # The gtk-rust-app out directory GEN_DIR=$(BASE_DIR)/target/gra-gen ROOT=/app # The binary directory inside the flatpak container BIN_DIR=$(ROOT)/bin # The share directory SHARE_DIR=$(ROOT)/share .PHONY: .install .uninstall .install-gsettings .uninstall-gsettings uninstall: @echo Remove binary from $(BIN_DIR)/$(APP_ID) @rm $(BIN_DIR)/$(APP_ID) @echo uninstall gsettings from $(SHARE_DIR)/glib-2.0/schemas/ @rm $(SHARE_DIR)/glib-2.0/schemas/$(APP_ID).gschema.xml @glib-compile-schemas $(SHARE_DIR)/glib-2.0/schemas @echo Uninstall icons from $(SHARE_DIR)/icons/hicolor/ @rm $(SHARE_DIR)/icons/hicolor/scalable/apps/$(APP_ID).svg @rm $(SHARE_DIR)/icons/hicolor/64x64/apps/$(APP_ID).png @rm $(SHARE_DIR)/icons/hicolor/128x128/apps/$(APP_ID).png @touch $(SHARE_DIR)/icons/hicolor/ @# Force icon cache to refresh @mkdir -p $(SHARE_DIR)/applications/ @mkdir -p $(SHARE_DIR)/metainfo/ @echo Uninstall .desktop and appdata.xml from $(SHARE_DIR)/applications, $(SHARE_DIR)/metainfo @rm $(SHARE_DIR)/applications/$(APP_ID).desktop @rm $(SHARE_DIR)/metainfo/$(APP_ID).appdata.xml # Build a release binary and install everything in the flaAPP_IDtpak container install: @echo Install binary into '$(BIN_DIR)/$(APP_ID)' @strip $(TARGET_DIR)/release/$(BIN_NAME) @mkdir -p $(BIN_DIR) @install $(TARGET_DIR)/release/$(BIN_NAME) $(BIN_DIR)/$(APP_ID) @echo Install gsettings into $(SHARE_DIR)/glib-2.0/schemas/ @mkdir -p $(SHARE_DIR)/glib-2.0/schemas/ @install -m 644 -D $(GEN_DIR)/$(APP_ID).gschema.xml $(SHARE_DIR)/glib-2.0/schemas/ @glib-compile-schemas $(SHARE_DIR)/glib-2.0/schemas/ @echo Install icons into $(SHARE_DIR)/icons/hicolor/ @mkdir -p $(SHARE_DIR)/icons/hicolor/scalable/apps @mkdir -p $(SHARE_DIR)/icons/hicolor/64x64/apps @mkdir -p $(SHARE_DIR)/icons/hicolor/128x128/apps @install -m 644 $(GEN_DIR)/data/$(APP_ID).svg $(SHARE_DIR)/icons/hicolor/scalable/apps/$(APP_ID).svg @install -m 644 $(GEN_DIR)/data/$(APP_ID).64.png $(SHARE_DIR)/icons/hicolor/64x64/apps/$(APP_ID).png @install -m 644 $(GEN_DIR)/data/$(APP_ID).128.png $(SHARE_DIR)/icons/hicolor/128x128/apps/$(APP_ID).png @touch $(SHARE_DIR)/icons/hicolor/ @# Force icon cache to refresh @mkdir -p $(SHARE_DIR)/applications/ @mkdir -p $(SHARE_DIR)/metainfo/ @echo Install .desktop and appdata.xml into $(SHARE_DIR)/applications, $(SHARE_DIR)/metainfo @install -m 644 $(GEN_DIR)/data/$(APP_ID).desktop $(SHARE_DIR)/applications/$(APP_ID).desktop @install -m 644 $(GEN_DIR)/data/$(APP_ID).appdata.xml $(SHARE_DIR)/metainfo/$(APP_ID).appdata.xml install-gsettings: @install -m 644 -D $(GEN_DIR)/$(APP_ID).gschema.xml $(SHARE_DIR)/glib-2.0/schemas/$(APP_ID).gschema.xml @glib-compile-schemas $(SHARE_DIR)/glib-2.0/schemas uninstall-gsettings: rm $(SHARE_DIR)/glib-2.0/schemas/$(APP_ID).gschema.xml glib-compile-schemas $(SHARE_DIR)/glib-2.0/schemas