-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava.makefile
More file actions
35 lines (28 loc) · 928 Bytes
/
Copy pathjava.makefile
File metadata and controls
35 lines (28 loc) · 928 Bytes
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
# @Author: Daimiao Chen
# This is a makefile for compiling java files without project management tools
# It assumet this project has blow structure:
# ./src/ : java source files
# ./bin/ : java class files
# ./lib/ : java libraries
# ./doc/ : java documentations
project_path = $(path)
src_path = $(project_path)./src/
bin_path = $(project_path)./bin/
lib_path = $(project_path)./lib/
doc_path = $(project_path)./doc/
java_files = $(wildcard $(src_path)*.java)
java_class = $(patsubst $(src_path)%.java, $(bin_path)%.class, $(java_files))
main_class = $(target)
$(java_class): $(java_files)
# Since java doesn't have header files, we need to compile all java files at once
javac -d $(bin_path) -cp $(lib_path) $(java_files)
all: $(java_class)
clean:
rm -rf $(bin_path)*
run:
java -cp $(bin_path):$(lib_path) $(main_class)
print:
@echo $(java_files)
@echo $(java_class)
@echo $(project_path)
@echo $(src_path)