🔧 é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 SRC_DIR = src
BIN_DIR = bin BIN_DIR = bin
RES_DIR = $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/resources RES_DIR = $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/resources
JAR_FILE = $(BIN_DIR)/DorfJavaTik.jar
JAVAC = javac JAVAC = javac
JAVA = java JAVA = java
JAVADOC = javadoc JAVADOC = javadoc
@ -10,15 +9,14 @@ MAIN = com.charpentierbalocchi.dorfjavatik.view.FenetreDemarrage
# Compilation flags # Compilation flags
JFLAGS = -d $(BIN_DIR) -encoding UTF-8 -sourcepath $(SRC_DIR) JFLAGS = -d $(BIN_DIR) -encoding UTF-8 -sourcepath $(SRC_DIR)
JARFLAGS = cfe
# Default rule # Default rule
all: clean compile copy-resources jar all: clean compile copy-resources
# Rule to compile the java files # Rule to compile the java files
compile: compile:
@echo "Compilation des fichiers source java..." @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/controller/*.java
@$(JAVAC) $(JFLAGS) $(SRC_DIR)/com/charpentierbalocchi/dorfjavatik/model/*.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/util/*.java
@ -27,17 +25,12 @@ compile:
# Rule to copy resources # Rule to copy resources
copy-resources: copy-resources:
@echo "Copying resources..." @echo "Copying resources..."
@xcopy /Y /I "$(RES_DIR)" "$(BIN_DIR)\com\charpentierbalocchi\dorfjavatik\resources\" @cp -r $(RES_DIR) $(BIN_DIR)
# 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 # Rule to run the application
run: jar run: compile copy-resources
@echo "Lancement du jeu..." @echo "Lancement du jeu..."
@$(JAVA) -jar $(JAR_FILE) @$(JAVA) -cp $(BIN_DIR) $(MAIN)
# Rule to generate Javadoc # Rule to generate Javadoc
javadoc: javadoc:
@ -47,6 +40,6 @@ javadoc:
# Rule to clean the project # Rule to clean the project
clean: clean:
@echo "Nettoyage en cours..." @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