Makefile 2.73 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# Install to /usr unless otherwise specified, such as `make PREFIX=/app`
PREFIX=/usr

# What to run to install various files
INSTALL=install
# Run to install the actual binary
INSTALL_PROGRAM=$(INSTALL)
# Run to install application data, with differing permissions
INSTALL_DATA=$(INSTALL) -m 644

# Directories into which to install the various files
bindir=$(DESTDIR)$(PREFIX)/bin
sharedir=$(DESTDIR)$(PREFIX)/share

# These targets have no associated build files.
16 17 18
.PHONY : clean clean-all install uninstall

# Build the application
19
target/release/gDiceRoller : src
20 21 22
	cargo build --release

# Install onto the system
23
install : target/release/gDiceRoller
24 25
	# Create the bindir, if need be
	mkdir -p $(bindir)
26
	# Install binary
27
	$(INSTALL_PROGRAM) target/release/gDiceRoller $(bindir)/codes.nora.gDiceRoller
28 29
	# Create the sharedir and subfolders, if need be
	mkdir -p $(sharedir)/icons/hicolor/scalable/apps/
30 31
	mkdir -p $(sharedir)/icons/hicolor/64x64/apps/
	mkdir -p $(sharedir)/icons/hicolor/128x128/apps/
32
	mkdir -p $(sharedir)/applications/
33
	mkdir -p $(sharedir)/metainfo/
34 35
	# Install icons
	$(INSTALL_DATA) data/codes.nora.gDiceRoller.svg $(sharedir)/icons/hicolor/scalable/apps/codes.nora.gDiceRoller.svg
36 37 38
	$(INSTALL_DATA) data/codes.nora.gDiceRoller.64.png $(sharedir)/icons/hicolor/64x64/apps/codes.nora.gDiceRoller.png
	$(INSTALL_DATA) data/codes.nora.gDiceRoller.128.png $(sharedir)/icons/hicolor/128x128/apps/codes.nora.gDiceRoller.png
	# Force icon cache refresh
39
	touch $(sharedir)/icons/hicolor
40
	# Install application meta-data
41
	$(INSTALL_DATA) data/codes.nora.gDiceRoller.appdata.xml $(sharedir)/metainfo/codes.nora.gDiceRoller.appdata.xml
42
	# Install desktop file
43
	$(INSTALL_DATA) data/codes.nora.gDiceRoller.desktop $(sharedir)/applications/codes.nora.gDiceRoller.desktop
44 45 46

# Remove an existing install from the system
uninstall :
47
	# Remove the desktop file
48
	rm -f $(sharedir)/applications/codes.nora.gDiceRoller.desktop
49
	# Remove the application metadata
50
	rm -f $(sharedir)/metainfo/codes.nora.gDiceRoller.appdata.xml
51
	# Remove the icon
52
	rm -f $(sharedir)/icons/hicolor/scalable/apps/codes.nora.gDiceRoller.svg
53 54
	rm -f $(sharedir)/icons/hicolor/64x64/apps/codes.nora.gDiceRoller.png
	rm -f $(sharedir)/icons/hicolor/128x128/apps/codes.nora.gDiceRoller.png
55
	# Remove the binary
56
	rm -f $(bindir)/bin/codes.nora.gDiceRoller
57 58

# Build a Flatpak package
59 60
flatpak-development: target/release/gDiceRoller
	mkdir -p flatpak-development
Leonora Tindall's avatar
Leonora Tindall committed
61
	flatpak-builder flatpak-development data/codes.nora.gDiceRoller-development.json
62 63

flatpak-release : target/release/gDiceRoller
64
	mkdir -p flatpak
65
	flatpak-builder flatpak data/codes.nora.gDiceRoller.json
66 67 68 69 70 71 72

# Remove all files
clean-all : clean
	cargo clean

# Remove supplemental build files
clean :
73
	rm -rf flatpak/ flatpak-development/
74
	rm -rf snap/ *.snap
75