Files
SAE31_2024/TestV1/TestEnAttendantResolutionBug/Makefile

41 lines
993 B
Makefile
Raw Normal View History

2024-11-18 21:51:18 +01:00
# Directories
SRC_DIR = src
BIN_DIR = bin
2024-11-18 21:51:18 +01:00
# Find all source files and corresponding class files
SOURCES = $(shell find $(SRC_DIR) -name "*.java")
CLASSES = $(SOURCES:$(SRC_DIR)/%.java=$(BIN_DIR)/%.class)
# Main class for execution
MAIN_CLASS = controller.Main
2024-11-18 21:51:18 +01:00
# Java compiler and runner
JAVAC = javac
JAVA = java
JFLAGS = -d $(BIN_DIR) -cp $(SRC_DIR):$(BIN_DIR) # Ajout du classpath src/ et bin/
2024-11-18 21:51:18 +01:00
# Default target: Compile and run
all: clean compile run
2024-11-18 21:51:18 +01:00
# Compile all Java source files
compile: $(CLASSES)
@echo "Compilation terminée."
2024-11-18 21:51:18 +01:00
# Rule to compile each .java file to a .class file
$(BIN_DIR)/%.class: $(SRC_DIR)/%.java
@mkdir -p $(@D)
$(JAVAC) $(JFLAGS) $<
# Run the application
run:
2024-11-18 21:51:18 +01:00
@echo "Exécution de l'application..."
$(JAVA) -cp $(BIN_DIR):$(SRC_DIR) $(MAIN_CLASS)
2024-11-18 21:51:18 +01:00
# Clean compiled files
clean:
@echo "Nettoyage des fichiers compilés..."
2024-11-18 21:51:18 +01:00
rm -rf $(BIN_DIR)/*
# Phony targets to avoid conflicts
.PHONY: all compile run clean