SAE_DEV_JAVA/makefile
2024-06-07 17:10:23 +02:00

53 lines
1.6 KiB
Makefile

# Variables
SRC_DIR = src
BIN_DIR = bin
RES_DIR = $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/resources
JAR_FILE = $(BIN_DIR)/DorfJavaTik.jar
JAVAC = javac
JAVA = java
JAVADOC = javadoc
MAIN = com.charpentierbalocchi.dorfjavatik.view.FenetreDemarrage
# Compilation flags
JFLAGS = -d $(BIN_DIR) -encoding UTF-8 -sourcepath $(SRC_DIR)
JARFLAGS = cfe
# Default rule
all: clean compile copy-resources jar
# Rule to compile the java files
compile:
@echo "Compilation des fichiers source java..."
@if not exist "$(BIN_DIR)" mkdir $(BIN_DIR)
@$(JAVAC) $(JFLAGS) $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/controller/*.java
@$(JAVAC) $(JFLAGS) $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/model/*.java
@$(JAVAC) $(JFLAGS) $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/util/*.java
@$(JAVAC) $(JFLAGS) $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/view/*.java
# Rule to copy resources
copy-resources:
@echo "Copying resources..."
@xcopy /Y /I "$(RES_DIR)" "$(BIN_DIR)\com\charpentierbalocchi\dorfjavatik\resources\"
# Rule to create the jar file
jar: compile
@echo "Création du fichier .jar ..."
@jar $(JARFLAGS) $(JAR_FILE) $(MAIN) -C $(BIN_DIR) .
# Rule to run the application
run: jar
@echo "Lancement du jeu..."
@$(JAVA) -jar $(JAR_FILE)
# Rule to generate Javadoc
javadoc:
@echo "Generating Javadoc..."
@$(JAVADOC) -d $(BIN_DIR)/docs -sourcepath $(SRC_DIR) -subpackages com.charpentierbalocchi.dorfjavatik
# Rule to clean the project
clean:
@echo "Nettoyage en cours..."
@if exist "$(BIN_DIR)" rd /s /q $(BIN_DIR)
.PHONY: all compile run jar javadoc clean copy-resources