diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-03-04 18:57:10 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-03-04 18:57:10 -0500 |
commit | 2e156299711a95825eec5b0a11608a27725e9731 (patch) | |
tree | 2bc203602cb9186f1b828b74e849cd8c3da34790 /rules | |
parent | ae11895c01e95136f8253db6e4f53f74b893d49b (diff) |
add cup and jlex build rules
Diffstat (limited to 'rules')
-rw-r--r-- | rules/cup/Makefile | 38 | ||||
-rw-r--r-- | rules/jlex/Makefile | 33 |
2 files changed, 71 insertions, 0 deletions
diff --git a/rules/cup/Makefile b/rules/cup/Makefile new file mode 100644 index 0000000..7d60a02 --- /dev/null +++ b/rules/cup/Makefile @@ -0,0 +1,38 @@ +DESTDIR ?= +JAR_DIR ?= /usr/share/java + +FAIL = exit 1 +FIND = find +INSTALL = install +JAR = jar +JAVAC = javac +MKDIRS = mkdir -p +RM = rm -f +TOUCH = touch + +dep_dir = $1 $(shell $(FIND) $1 2>/dev/null) + +all: PHONY java_cup.jar + +java_cup.jar: classes + $(JAR) cfe $@ java_cup.Main -C $< . + $(TOUCH) $< + +classes: . $(wildcard *.java) $(call dep_dir,runtime simple_calc) + $(RM) -r $@ + $(MKDIRS) $@ + $(JAVAC) -d $@ $(filter %.java,$^) || { $(RM) -r $@; $(FAIL); } + $(TOUCH) $@ + $(TOUCH) . + +install: PHONY $(DESTDIR)$(JAR_DIR)/java_cup.jar + +$(DESTDIR)$(JAR_DIR)/%.jar: %.jar + $(INSTALL) -Dm644 $< $@ + +clean: PHONY + $(RM) -r -- build *.jar + +.PHONY: PHONY +.DELETE_ON_ERROR: +.SECONDARY: 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: |