-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
62 lines (50 loc) · 1.81 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
# SPDX-License-Identifier: MIT
# Copyright (C) 2021 Artem Senichev <[email protected]>
THIS_FILE := $(lastword $(MAKEFILE_LIST))
THIS_DIR := $(abspath $(dir $(THIS_FILE)))
# default installation prefix
PREFIX := /usr
# version of the application
VERSION := $(shell git describe --tags --long --always | sed 's/-g.*//;s/^v//;s/-/./')
# path to extra files (mans, icon, desktop, etc)
EXTRA_DIR := $(THIS_DIR)/extra
# path to the intermediate dir
TARGET_DIR := $(THIS_DIR)/target
# path to the application binary
TARGET_BIN := $(TARGET_DIR)/release/xvi
# app image
APPIMG_DIR := $(TARGET_DIR)/appimg
APPIMG_TOOL := $(TARGET_DIR)/linuxdeploy-x86_64.AppImage
APPIMG_BIN := $(THIS_DIR)/xvi-$(VERSION)-x86_64.AppImage
all: $(TARGET_BIN)
$(TARGET_BIN):
cargo build --release
clean:
rm -rf $(TARGET_DIR) $(APPIMG_BIN)
version:
@echo "$(VERSION)"
install: $(TARGET_BIN)
install -D -m 755 $(TARGET_BIN) $(PREFIX)/bin/$(notdir $(TARGET_BIN))
install -D -m 644 $(EXTRA_DIR)/xvi.1 $(PREFIX)/share/man/man1/xvi.1
install -D -m 644 $(EXTRA_DIR)/xvirc.5 $(PREFIX)/share/man/man5/xvirc.5
uninstall:
rm -f "$(PREFIX)/bin/$(notdir $(TARGET_BIN))"
rm -f "$(PREFIX)/share/man/man1/xvi.1"
rm -f "$(PREFIX)/share/man/man5/xvirc.5"
appimage: $(APPIMG_BIN)
$(APPIMG_BIN): $(APPIMG_TOOL)
rm -rf $(APPIMG_DIR)/*
$(MAKE) PREFIX=$(APPIMG_DIR)/$(PREFIX) install
install -D -m 644 $(EXTRA_DIR)/xvi.appdata.xml $(APPIMG_DIR)/$(PREFIX)/share/metainfo/xvi.appdata.xml
$(APPIMG_TOOL) --appdir $(APPIMG_DIR) \
--desktop-file $(EXTRA_DIR)/xvi.desktop \
--icon-file $(EXTRA_DIR)/xvi.png \
--output appimage
mv xvi-*-x86_64.AppImage $@
$(APPIMG_TOOL):
mkdir -p $(@D)
wget \
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage \
-O $@
chmod 0755 $@
.PHONY: all clean version install uninstall appimage