diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..adcf723 --- /dev/null +++ b/Makefile @@ -0,0 +1,56 @@ +# Variables +JC = javac +JVM = java +SRCDIR = src +BINDIR = bin +MAINCLASS1 = MainJeu +MAINCLASS2 = MainCreation +SRCFILES := $(wildcard $(SRCDIR)/*.java) +CLASSFILES := $(patsubst $(SRCDIR)/%.java,$(BINDIR)/%.class,$(SRCFILES)) + +# Règles de compilation pour les fichiers Java dans le répertoire src +$(BINDIR)/%.class: $(SRCDIR)/%.java | $(BINDIR) + $(JC) -d $(BINDIR) $< + +# Crée le répertoire bin s'il n'existe pas +$(BINDIR): + mkdir -p $(BINDIR) + +# Règle pour exécuter le premier programme +runJeu: $(CLASSFILES) + $(JVM) -cp $(BINDIR) $(MAINCLASS1) + +# Règle pour exécuter le deuxième programme +runCreation: $(CLASSFILES) + $(JVM) -cp $(BINDIR) $(MAINCLASS2) + +# Règle pour nettoyer les fichiers compilés +clean: + rm -rf $(BINDIR)/* + +# Règle pour créer la documentation +doc: + javadoc -d docs $(SRCDIR)/*.java + +# Règle pour visualiser la documentation +seedoc: + firefox docs/index.html & + +# Définir les cibles factices +.PHONY: build runJeu runCreation clean doc seedoc + +# Règle par défaut +.DEFAULT_GOAL := build + +# Règle pour compiler AutomatiqueActionListener avec ses dépendances +$(BINDIR)/AutomatiqueActionListener.class: $(SRCDIR)/AutomatiqueActionListener.java $(BINDIR)/GenerateurSudoku.class $(BINDIR)/FenetrePrincipale.class $(BINDIR)/Resolveur.class + $(JC) -d $(BINDIR) $< + +# Règle pour compiler FenetrePrincipale avec ses dépendances +$(BINDIR)/FenetrePrincipale.class: $(SRCDIR)/FenetrePrincipale.java $(BINDIR)/SaisieGrille.class $(BINDIR)/ReinitialiserActionListener.class + $(JC) -d $(BINDIR) $< + +# Règle pour compiler SaisieGrille avec ses dépendances +$(BINDIR)/SaisieGrille.class: $(SRCDIR)/SaisieGrille.java $(BINDIR)/CaseMouseListener.class $(BINDIR)/GrillePainter.class + $(JC) -d $(BINDIR) $< + diff --git a/GenerateurSudoku.class b/bin/GenerateurSudoku.class similarity index 100% rename from GenerateurSudoku.class rename to bin/GenerateurSudoku.class diff --git a/AutomatiqueActionListener.java b/src/AutomatiqueActionListener.java similarity index 100% rename from AutomatiqueActionListener.java rename to src/AutomatiqueActionListener.java diff --git a/CaseMouseListener.java b/src/CaseMouseListener.java similarity index 100% rename from CaseMouseListener.java rename to src/CaseMouseListener.java diff --git a/FenetreChoix.java b/src/FenetreChoix.java similarity index 100% rename from FenetreChoix.java rename to src/FenetreChoix.java diff --git a/FenetrePrincipale.java b/src/FenetrePrincipale.java similarity index 100% rename from FenetrePrincipale.java rename to src/FenetrePrincipale.java diff --git a/GenerateurSudoku.java b/src/GenerateurSudoku.java similarity index 100% rename from GenerateurSudoku.java rename to src/GenerateurSudoku.java diff --git a/GrillePainter.java b/src/GrillePainter.java similarity index 100% rename from GrillePainter.java rename to src/GrillePainter.java diff --git a/GrilleSudokuDessin.java b/src/GrilleSudokuDessin.java similarity index 100% rename from GrilleSudokuDessin.java rename to src/GrilleSudokuDessin.java diff --git a/Grilles.java b/src/Grilles.java similarity index 100% rename from Grilles.java rename to src/Grilles.java diff --git a/Lecteur.java b/src/Lecteur.java similarity index 100% rename from Lecteur.java rename to src/Lecteur.java diff --git a/MainCreation.java b/src/MainCreation.java similarity index 100% rename from MainCreation.java rename to src/MainCreation.java diff --git a/Main.java b/src/MainJeu.java similarity index 89% rename from Main.java rename to src/MainJeu.java index 1699f78..8641b8e 100644 --- a/Main.java +++ b/src/MainJeu.java @@ -1,5 +1,5 @@ -public class Main { +public class MainJeu { public static void main(String[] args) { System.out.println("Le programme Main a démarré."); diff --git a/ManuelActionListener.java b/src/ManuelActionListener.java similarity index 100% rename from ManuelActionListener.java rename to src/ManuelActionListener.java diff --git a/OuvertureFichier.java b/src/OuvertureFichier.java similarity index 100% rename from OuvertureFichier.java rename to src/OuvertureFichier.java diff --git a/Register.java b/src/Register.java similarity index 100% rename from Register.java rename to src/Register.java diff --git a/Reinitialiser.java b/src/Reinitialiser.java similarity index 100% rename from Reinitialiser.java rename to src/Reinitialiser.java diff --git a/ReinitialiserActionListener.java b/src/ReinitialiserActionListener.java similarity index 100% rename from ReinitialiserActionListener.java rename to src/ReinitialiserActionListener.java diff --git a/Resolveur.java b/src/Resolveur.java similarity index 100% rename from Resolveur.java rename to src/Resolveur.java diff --git a/SaisieGrille.java b/src/SaisieGrille.java similarity index 100% rename from SaisieGrille.java rename to src/SaisieGrille.java diff --git a/SudokuGenerator.java b/src/SudokuGenerator.java similarity index 100% rename from SudokuGenerator.java rename to src/SudokuGenerator.java