-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
63 lines (57 loc) · 2.78 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Metadata
PROJECT_NAME=simplesteamtinker
INSTALL_FOLDER_NAME=SimpleSteamTinker
VERSION=indev
ifeq ($(PREFIX),)
PREFIX := /usr
endif
BUILD_FOLDER := dist/
.PHONY: system install uninstall clean local
# -------------- System installation --------------
# This will create a folder structure in dist that is compatible with most package managers.
system:
@echo "Packaging project for system installation..."
# Executable
mkdir -p $(BUILD_FOLDER)$(PREFIX)/bin
install -Dm755 sst $(BUILD_FOLDER)$(PREFIX)/bin
# Modules
mkdir -p $(BUILD_FOLDER)$(PREFIX)/share/$(INSTALL_FOLDER_NAME)
install -Dm644 main.lua $(BUILD_FOLDER)$(PREFIX)/share/$(INSTALL_FOLDER_NAME)/main.lua
cp -r modules $(BUILD_FOLDER)$(PREFIX)/share/$(INSTALL_FOLDER_NAME)
# UI
mkdir -p $(BUILD_FOLDER)$(PREFIX)/share/$(INSTALL_FOLDER_NAME)/ui
install -Dm644 ui/main.ui $(BUILD_FOLDER)$(PREFIX)/share/$(INSTALL_FOLDER_NAME)/ui/main.ui
# Desktop file
mkdir -p $(BUILD_FOLDER)$(PREFIX)/share/applications
install -Dm644 assets/desktop/system.desktop $(BUILD_FOLDER)$(PREFIX)/share/applications/$(PROJECT_NAME).desktop
# Icons
mkdir -p $(BUILD_FOLDER)$(PREFIX)/share/icons/hicolor/256x256/apps
mkdir -p $(BUILD_FOLDER)$(PREFIX)/share/icons/hicolor/scalable/apps
install -Dm644 assets/icons/256x256.png $(BUILD_FOLDER)$(PREFIX)/share/icons/hicolor/256x256/apps/$(PROJECT_NAME).png
install -Dm644 assets/icons/scalable.svg $(BUILD_FOLDER)$(PREFIX)/share/icons/hicolor/scalable/apps/$(PROJECT_NAME).svg
# Should only be used as last resort, the end user should use a compatible package manager if possible instead.
# This is only here for testing purposes, and also as a general "manual" on how to install the project for package maintainers.
install: system
@echo "Installing project to system..."
cp -r $(BUILD_FOLDER)$(PREFIX)/bin/* $(PREFIX)/bin
cp -r $(BUILD_FOLDER)$(PREFIX)/share/$(INSTALL_FOLDER_NAME) $(PREFIX)/share
cp -r $(BUILD_FOLDER)$(PREFIX)/share/applications/* $(PREFIX)/share/applications
cp -r $(BUILD_FOLDER)$(PREFIX)/share/icons/hicolor/256x256/apps/* $(PREFIX)/share/icons/hicolor/256x256/apps
cp -r $(BUILD_FOLDER)$(PREFIX)/share/icons/hicolor/scalable/apps/* $(PREFIX)/share/icons/hicolor/scalable/apps
# Update icon cache
@echo "Updating icon cache..."
gtk-update-icon-cache $(PREFIX)/share/icons/hicolor
uninstall:
@echo "Uninstalling project from system..."
rm -ri $(PREFIX)/bin/sst
rm -rI $(PREFIX)/share/$(INSTALL_FOLDER_NAME)
rm -ri $(PREFIX)/share/applications/$(PROJECT_NAME).desktop
rm -ri $(PREFIX)/share/icons/hicolor/256x256/apps/$(PROJECT_NAME).png
rm -ri $(PREFIX)/share/icons/hicolor/scalable/apps/$(PROJECT_NAME).svg
# Update icon cache
@ echo "Updating icon cache..."
gtk-update-icon-cache $(PREFIX)/share/icons/hicolor
# -------------- Cleaning --------------
clean:
@echo "Cleaning up..."
rm -rf $(BUILD_FOLDER)