-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
41 lines (33 loc) · 2.56 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
INSTALL_PREFIX?=/usr/local
INSTALL_FAKENAME?=$(INSTALL_PREFIX)
.PHONY=install install-helpers clean
all: build/foreign-language-text-reader.jar
build/foreign-language-text-reader.jar:
mkdir -p build/
javac -cp resources/miglayout-4.0-swing.jar:src/fltrpackage/:./src src/FLTR.java -d build
cp resources/*.htm resources/*.png build/fltrpackage
cp resources/miglayout-4.0-swing.jar build/foreign-language-text-reader.jar
# Stupid hack because `jar` is a bad program that fails silently when I try to do this properly lol
sh -c 'cd build && jar ufe foreign-language-text-reader.jar FLTR FLTR.class FLTR\$$1.class fltrpackage/*'
install-helpers:
sed 's|INSTALL_PREFIX|$(INSTALL_FAKENAME)|g' resources/linux/foreign-language-text-reader.sh > build/foreign-language-text-reader.sh
sed 's|INSTALL_PREFIX|$(INSTALL_FAKENAME)|g' resources/linux/foreign-language-text-reader.desktop > build/foreign-language-text-reader.desktop
install: all install-helpers
install -Dm755 build/foreign-language-text-reader.sh -t $(INSTALL_PREFIX)/bin/
install -Dm644 build/foreign-language-text-reader.jar -t $(INSTALL_PREFIX)/lib/foreign-language-text-reader/
install -Dm644 build/foreign-language-text-reader.desktop -t $(INSTALL_PREFIX)/share/applications/
install -Dm644 resources/icon256.png $(INSTALL_PREFIX)/share/pixmaps/foreign-language-text-reader.png
# Remove the files since they may be generated by root
rm build/foreign-language-text-reader.sh build/foreign-language-text-reader.desktop
uninstall:
# Assumes that the directories $(INSTALL_PREFIX)/bin, $(INSTALL_PREFIX)/lib, and $(INSTALL_PREFIX)/share/applications, and $(INSTALL_PREFIX)/share/pixmaps already existed
@sh -c '[ ! -f $(INSTALL_PREFIX)/bin/foreign-language-text-reader.sh ] && echo It does not appear that foreign-language-text-reader.sh is installed && exit 1 || exit 0'
@printf 'Will remove:\n\t$(INSTALL_PREFIX)/bin/foreign-language-text-reader.sh\n\t$(INSTALL_PREFIX)/share/applications/foreign-language-text-reader.desktop\n\t$(INSTALL_PREFIX)/share/pixmaps/foreign-language-text-reader.png\n\t$(INSTALL_PREFIX)/lib/foreign-language-text-reader/\nIs this what you want to do? [y/N]: '
@bash -c 'read confirm && [ $$confirm == "y" ] || [ $$confirm = "Y" ] || exit 1'
rm $(INSTALL_PREFIX)/bin/foreign-language-text-reader.sh
rm $(INSTALL_PREFIX)/share/applications/foreign-language-text-reader.desktop
rm $(INSTALL_PREFIX)/share/pixmaps/foreign-language-text-reader.png
rm $(INSTALL_PREFIX)/lib/foreign-language-text-reader/foreign-language-text-reader.jar
rmdir $(INSTALL_PREFIX)/lib/foreign-language-text-reader/
clean:
rm -rf build/