summaryrefslogtreecommitdiff
path: root/rules/jlex/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'rules/jlex/Makefile')
-rw-r--r--rules/jlex/Makefile33
1 files changed, 33 insertions, 0 deletions
diff --git a/rules/jlex/Makefile b/rules/jlex/Makefile
new file mode 100644
index 0000000..79667dd
--- /dev/null
+++ b/rules/jlex/Makefile
@@ -0,0 +1,33 @@
+DESTDIR ?=
+JAR_DIR ?= /usr/share/java
+
+FAIL = exit 1
+INSTALL = install
+JAR = jar
+JAVAC = javac
+MKDIRS = mkdir -p
+RM = rm -f
+TOUCH = touch
+
+all: PHONY jlex.jar
+
+jlex.jar: classes
+ $(JAR) cfe $@ JLex.Main -C $< .
+
+classes: Main.java
+ $(RM) -r $@
+ $(MKDIRS) $@
+ $(JAVAC) -d $@ $< || { $(RM) -r $@; $(FAIL); }
+ $(TOUCH) $@
+
+install: PHONY $(DESTDIR)$(JAR_DIR)/jlex.jar
+
+$(DESTDIR)$(JAR_DIR)/%.jar: %.jar
+ $(INSTALL) -Dm644 $< $@
+
+clean: PHONY
+ $(RM) -r -- build *.jar
+
+.PHONY: PHONY
+.DELETE_ON_ERROR:
+.SECONDARY: