diff --git a/Makefile b/Makefile index 474c881..80e19af 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# === Variables globales === +# === Global variables === MAIN_CLASS = fr.iutfbleau.papillon.Start BUILD_DIR = build SRC_DIR = src/fr/iutfbleau/papillon @@ -6,14 +6,17 @@ SRC_BUILD = fr\iutfbleau\papillon LIB_DIR := lib LIB := $(LIB_DIR)/mariadb JAR_NAME = papillon.jar +DOC_DIR = doc -# === Detection de l'OS === +# === OS detection === ifeq ($(OS),Windows_NT) SEP = ; RM = del /Q + RMDIR = rmdir /S /Q else SEP = : RM = rm -f + RMDIR = rm -rf endif # === Compilation === @@ -22,7 +25,16 @@ compile: javac -encoding UTF-8 -cp "$(LIB_DIR)$(SEP)$(LIB_DIR)/org/mariadb/jdbc" -d $(BUILD_DIR) $(SRC_DIR)/*.java @echo Compilation terminee -# === Creation du JAR === +# === Run the program === +run: + @echo === Execution du programme === +ifeq ($(OS),Windows_NT) + java -cp "$(BUILD_DIR);$(LIB_DIR);$(LIB_DIR)/mariadb;$(LIB_DIR)/mariadb/org/mariadb/jdbc" $(MAIN_CLASS) +else + java -cp "$(BUILD_DIR):$(LIB_DIR):$(LIB_DIR)/mariadb:$(LIB_DIR)/mariadb/org/mariadb/jdbc" $(MAIN_CLASS) +endif + +# === Create JAR === jar: compile @echo === Creation du JAR autonome === echo Main-Class: $(MAIN_CLASS) > manifest.txt @@ -30,7 +42,7 @@ jar: compile @$(RM) manifest.txt 2>nul || true @echo JAR cree avec succes: $(JAR_NAME) -# === Execution multiplateforme === +# === Run from JAR === run-jar: @echo === Execution du JAR === ifeq ($(OS),Windows_NT) @@ -38,19 +50,3 @@ ifeq ($(OS),Windows_NT) else java -cp "$(JAR_NAME):$(LIB_DIR):$(LIB_DIR)/mariadb:$(LIB_DIR)/mariadb/org/mariadb/jdbc" $(MAIN_CLASS) endif - -# === Generation de la documentation === -doc: - @echo === Generation de la documentation Javadoc === - javadoc -d doc -encoding UTF-8 -cp "$(LIB_DIR)$(SEP)$(LIB_DIR)/org/mariadb/jdbc" $(SRC_DIR)/*.java - @echo Documentation generee dans le dossier doc/ - -# === Nettoyage === -clean: - @echo === Nettoyage des fichiers compiles === -ifeq ($(OS),Windows_NT) - $(RM) $(BUILD_DIR)\$(SRC_BUILD)\*.class -else - $(RM) $(BUILD_DIR)/fr/iutfbleau/papillon/*.class -endif - @echo Nettoyage termine \ No newline at end of file