🔧 édition du makefile pour compilation sous linux

This commit is contained in:
Loris BALOCCHI 2024-06-07 17:14:08 +02:00
parent d42a020c63
commit 8753993349

View File

@ -2,7 +2,6 @@
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
@ -10,15 +9,14 @@ 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
all: clean compile copy-resources
# Rule to compile the java files
compile:
@echo "Compilation des fichiers source java..."
@if not exist "$(BIN_DIR)" mkdir $(BIN_DIR)
@mkdir -p $(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
@ -27,17 +25,12 @@ compile:
# 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) .
@cp -r $(RES_DIR) $(BIN_DIR)
# Rule to run the application
run: jar
run: compile copy-resources
@echo "Lancement du jeu..."
@$(JAVA) -jar $(JAR_FILE)
@$(JAVA) -cp $(BIN_DIR) $(MAIN)
# Rule to generate Javadoc
javadoc:
@ -47,6 +40,6 @@ javadoc:
# Rule to clean the project
clean:
@echo "Nettoyage en cours..."
@if exist "$(BIN_DIR)" rd /s /q $(BIN_DIR)
@rm -rf $(BIN_DIR)
.PHONY: all compile run jar javadoc clean copy-resources
.PHONY: all compile run javadoc clean copy-resources