forked from febo/myra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (41 loc) · 1.27 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
SRC=src/main/java
OUTPUT=target
PACKAGES=\
myra\
myra/interval\
myra/rule\
myra/rule/function\
myra/rule/irl\
myra/rule/pittsburgh\
myra/rule/pittsburgh/unordered\
myra/rule/shell\
myra/rule/shell/command\
myra/tree\
myra/util
SRC_DIR=$(addprefix $(SRC)/,$(PACKAGES))
JAVA_FILES=$(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.java))
CLASS_FILES=$(JAVA_FILES:.java=.class)
JAVAC=javac
JAR=jar
JAR_FILE=myra-`grep -m 1 '<version>' pom.xml | cut -d '>' -f 2 | cut -d '<' -f 1`.jar
GIT_FILE=$(OUTPUT)/classes/myra-git.properties
.PHONY: all
all: jar
.PHONY: clean
clean:
@echo "--> Removing generated files "
@rm -rf $(OUTPUT)/*
@echo "[done]"
jar: $(CLASS_FILES)
@echo "--> Building jar file"
@echo "git.commit.id.describe-short=`git describe --always --abbrev --dirty=-DEV`" > $(GIT_FILE)
@echo "git.commit.id.abbrev=`git rev-parse --short HEAD`" >> $(GIT_FILE)
@echo "git.commit.id.describe=`git describe --always --dirty=-DEV`" >> $(GIT_FILE)
@echo "git.commit.id=`git rev-parse HEAD`" >> $(GIT_FILE)
@cp -r src/main/resources/* $(OUTPUT)/classes
@$(JAR) cf $(OUTPUT)/$(JAR_FILE) -C $(OUTPUT)/classes/ .
@echo "[done]"
%.class: %.java
@mkdir -p $(OUTPUT)/classes
@echo "Compiling $<"
@$(JAVAC) -source 7 -target 7 -Xlint:-options -cp $(SRC) -d $(OUTPUT)/classes $<