Makefile 2.45 KB
Newer Older
Etienne Toussaint's avatar
Etienne Toussaint committed
1 2 3 4
# This is where you specify the necessary source files

# Program packages and files
#   - The packages should be the path inside your src directory. eg: package1 package2/package3
Myriam Begel's avatar
Myriam Begel committed
5

6 7 8
PACKAGEDIRS = ${shell find . -iname '*.java' | sed 's/\.\/\|[^/]*.java//g' | sort -g | uniq}

#TESTCLASS = ${shell find . -name *Test.java | sed 's/.\/src\/\|.java//g' | sed 's/\//./g'}
Etienne Toussaint's avatar
Etienne Toussaint committed
9

10
PARSER = src/ingame_programming/Script.jj
Fardale's avatar
Fardale committed
11

Etienne Toussaint's avatar
Etienne Toussaint committed
12 13 14 15 16 17 18 19 20 21 22 23
# Java compiler
JAVAC = javac
JVM = 1.8

# Directory for compiled binaries
# - trailing slash is important!
BIN = bin/

# Directory of source files
# - trailing slash is important!
SRC = src/

Fardale's avatar
Fardale committed
24
# The lib directory
25
LIB = lib/
Fardale's avatar
Fardale committed
26

27

Etienne Toussaint's avatar
Etienne Toussaint committed
28
# Java compiler flags
29 30
JAVAFLAGS = -g -d $(BIN) -cp $(SRC):$(LIB)* -target $(JVM) -source $(JVM)
WARNINGFLAGS = -Xlint:all,-unchecked,-serial
Etienne Toussaint's avatar
Etienne Toussaint committed
31 32 33 34

# Creating a .class file
COMPILE = $(JAVAC) $(JAVAFLAGS)

35
PACKAGEFILES = $(subst $(SRC), $(EMPTY), $(foreach DIR, $(PACKAGEDIRS), $(wildcard $(DIR)*.java)))
Myriam Begel's avatar
Myriam Begel committed
36
ALL_FILES = $(PACKAGEFILES)
Etienne Toussaint's avatar
Etienne Toussaint committed
37 38 39 40

# One of these should be the "main" class listed in Runfile
CLASS_FILES = $(subst $(SRC), $(BIN), $(ALL_FILES:.java=.class))

41 42 43
# Image directory subpath
IMG = assets/

Myriam Begel's avatar
Myriam Begel committed
44
IMAGEDIRS = ${shell cd $(SRC)$(IMG); ls -d */ | sed 's/\/\///g'}
45 46

# Other image files (assuming every image file is an PNG one)
Arnaud Guerquin's avatar
Arnaud Guerquin committed
47
IMAGEFILES = $(wildcard $(SRC)$(IMG)*.png $(SRC)$(IMG)*.gif $(SRC)$(IMG)*.txt)
48

Etienne Toussaint's avatar
Etienne Toussaint committed
49
# The first target is the one that is executed when you invoke
Fardale's avatar
Fardale committed
50 51
# "make".

Fardale's avatar
Fardale committed
52
.PHONY: all clean cleandoc hack genpars
Etienne Toussaint's avatar
Etienne Toussaint committed
53

Fardale's avatar
Fardale committed
54
all : hack genpars $(addprefix $(BIN), $(CLASS_FILES))
55
	@cp -r $(addprefix $(SRC)$(IMG), $(IMAGEDIRS)) $(IMAGEFILES) $(BIN)$(IMG)
56
	@cp -r $(LIB) $(BIN)
Etienne Toussaint's avatar
Etienne Toussaint committed
57 58 59

# The line describing the action starts with <TAB>
$(BIN)%.class : $(SRC)%.java
Fardale's avatar
Fardale committed
60
	@echo $<
Etienne Toussaint's avatar
Etienne Toussaint committed
61 62
	$(COMPILE) $<

63 64 65

# Hack pour bin/
hack :
Fardale's avatar
Fardale committed
66
	@mkdir -p bin/log;
67

68
buildplay: all
69
	cd bin/; java -cp $(LIB)*:. graphics.guiSkeleton.Igniter_Main
70

71 72 73
buildplay-term: all
	cd bin/; java -cp $(LIB)*:. graphics.termSkeleton.Igniter_Main_Term

Fardale's avatar
Fardale committed
74 75
# Generate parser
genpars: $(PARSER)
76
	@cd `dirname $<` ;find . -name *.jj | while read i; do java -cp lib/javacc-6.1.2.jar javacc $$i; done
Fardale's avatar
Fardale committed
77

Fardale's avatar
Fardale committed
78
clean :
79 80 81 82 83
	rm -rf $(BIN)

cleandoc:
	rm -rf doc.html
	rm -rf docs
Fardale's avatar
Fardale committed
84

Myriam Begel's avatar
Myriam Begel committed
85 86 87
#To generate the documentation
doc-html-fr :
	doxygen Doxyfiles-htmlFR
Myriam Begel's avatar
Myriam Begel committed
88
	ln -s -i docs/html/index.html doc.html
Myriam Begel's avatar
Myriam Begel committed
89 90 91

doc-html :
	doxygen Doxyfiles-html
Myriam Begel's avatar
Myriam Begel committed
92
	ln -s -i docs/html/index.html doc.html
Myriam Begel's avatar
Myriam Begel committed
93 94 95

doc-html2 :
	doxygen Doxyfiles-html-no-graphivz
Myriam Begel's avatar
Myriam Begel committed
96
	ln -s -i docs/html/index.html doc.html
Myriam Begel's avatar
Myriam Begel committed
97 98 99

doc-html2-fr:
	doxygen Doxyfiles-html-no-graphivzFR
Myriam Begel's avatar
Myriam Begel committed
100
	ln -s -i docs/html/index.html doc.html