-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (24 loc) · 830 Bytes
/
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
# Name of the class containing the main function
main = YifySub
# Name to give to the jar file created
jar_name = yifysub.jar
# Where to install the jar file
jar_dir = "/usr/share/java/"
# Where to install the script that runs the jar file
script = "/usr/bin/yifysub"
all: $(jar_name)
# Compile the source files, add them
# to the archive and then delete them
$(jar_name): *.java Makefile
javac *.java
echo Main-Class: $(main) > MANIFEST.MF
jar cfm $(jar_name) MANIFEST.MF *.class
rm *.class MANIFEST.MF
# Copy the jar file to its designated location
# Create the script that runs the jar file and set its permissions
install: $(jar_name) Makefile
cp $(jar_name) $(jar_dir)
echo "#!/bin/bash" > $(script)
echo >> $(script)
echo "java -jar $(jar_dir)"$(jar_name) '"$$@"' >> $(script)
chmod +x $(script)