1# Install to /usr unless otherwise specified, such as `make PREFIX=/app` 2PREFIX=/usr 3 4# What to run to install various files 5INSTALL=install -D 6# Run to install the actual binary 7INSTALL_PROGRAM=$(INSTALL) 8# Run to install application data, with differing permissions 9INSTALL_DATA=$(INSTALL) -m 644 10 11# Directories into which to install the various files 12bindir=$(DESTDIR)$(PREFIX)/bin 13sharedir=$(DESTDIR)$(PREFIX)/share 14 15# Just tell make that clean, install, and uninstall doesn't generate files 16.PHONY: clean clean-all install install-data copy-data uninstall 17 18# Build the application 19target/release/castor : src 20 cargo build --release 21 22test : 23 cargo test -- --test-threads=1 24 25install : target/release/castor install-data 26 # Install binary 27 $(INSTALL_PROGRAM) target/release/castor $(bindir)/castor 28 29# Install the data files and update the caches 30install-data : copy-data 31 # Force icon cache refresh 32 touch $(sharedir)/icons/hicolor 33 update-desktop-database 34 35# Just copy the data files, without updating caches 36copy-data : 37 # Install icons 38 $(INSTALL_DATA) data/org.typed-hole.castor.svg $(sharedir)/icons/hicolor/scalable/apps/org.typed-hole.castor.svg 39 $(INSTALL_DATA) data/org.typed-hole.castor-16.png $(sharedir)/icons/hicolor/16x16/apps/org.typed-hole.castor.png 40 $(INSTALL_DATA) data/org.typed-hole.castor-32.png $(sharedir)/icons/hicolor/32x32/apps/org.typed-hole.castor.png 41 $(INSTALL_DATA) data/org.typed-hole.castor-64.png $(sharedir)/icons/hicolor/64x64/apps/org.typed-hole.castor.png 42 $(INSTALL_DATA) data/org.typed-hole.castor-128.png $(sharedir)/icons/hicolor/128x128/apps/org.typed-hole.castor.png 43 # Install desktop file 44 $(INSTALL_DATA) data/Castor.desktop $(sharedir)/applications/Castor.desktop 45 46uninstall : 47 # Remove the .desktop 48 rm -f $(sharedir)/applications/Castor.desktop 49 # Remove the icons 50 rm -f $(sharedir)/icons/hicolor/scalable/apps/org.typed-hole.castor.svg 51 rm -f $(sharedir)/icons/hicolor/*x*/apps/org.typed-hole.castor.png 52 # Remove the binary 53 rm -f $(bindir)/castor 54 55clean : 56 cargo clean 57