diff --git a/TP3_SUITE_TP2_CLONE/code_modifie/reorganisation/makefileVersion/makefileAvancee/Version_1/makefile b/TP3_SUITE_TP2_CLONE/code_modifie/reorganisation/makefileVersion/makefileAvancee/Version_1/makefile index cc9b41b249ee8f97c68ee6d15f1e7b74f445d035..b83b9695ddfa1222162a07e1ae7bfd192dbe79a4 100644 --- a/TP3_SUITE_TP2_CLONE/code_modifie/reorganisation/makefileVersion/makefileAvancee/Version_1/makefile +++ b/TP3_SUITE_TP2_CLONE/code_modifie/reorganisation/makefileVersion/makefileAvancee/Version_1/makefile @@ -9,16 +9,10 @@ $(EXEC): $(OBJETS) $(CC) $(CFLAGS) -o $@ $^ @echo "\n\033[32mCompilation éxécuté avec succès\033[0m" -main.o: io.h alea.h tri.h tableau.h remplir.h -io.o: io.h tableau.h -alea.o: alea.h tableau.h -tri.o: tri.h tableau.h -remplir.o: remplir.h tableau.h alea.h - %.o : %.c @echo "\n\033[31m--------------COMPILATION DU PROGRAMME -------------------------------------\033[0m\n" $(CC) $(CFLAGS) -c $< - + run: @echo "\n\033[31m--------------ÉXÉCUTION DU PROGRAMME ---------------------------------------\033[0m\n" ./$(EXEC) 10 1000 diff --git a/TP3_SUITE_TP2_CLONE/code_modifie/reorganisation/makefileVersion/makefileAvancee/Version_2/makefile b/TP3_SUITE_TP2_CLONE/code_modifie/reorganisation/makefileVersion/makefileAvancee/Version_2/makefile index 11b10b5c160e929d0b5c35e84343a53f6361bb7b..b047b38ec4366d10079baa8f6d390f0630555bb6 100644 --- a/TP3_SUITE_TP2_CLONE/code_modifie/reorganisation/makefileVersion/makefileAvancee/Version_2/makefile +++ b/TP3_SUITE_TP2_CLONE/code_modifie/reorganisation/makefileVersion/makefileAvancee/Version_2/makefile @@ -1,16 +1,20 @@ +BIN_DIR = bin +SRC_DIR = src +INCLUDE_DIR = include +OBJ_DIR = obj + CC = gcc -g CFLAGS = -Werror -OBJETS = main.o io.o alea.o tri.o remplir.o +OBJETS = main.o io.o alea.o tri.o remplir.o EXEC = main -all : $(EXEC) run clean +all : $(EXEC) run organisation +clean : desorganisation cleanRepertoire cleanObjMain $(EXEC): $(OBJETS) $(CC) $(CFLAGS) -o $@ $^ @echo "\n\033[32mCompilation éxécuté avec succès\033[0m" -%.o : %.h - %.o : %.c @echo "\n\033[31m--------------COMPILATION DU PROGRAMME -------------------------------------\033[0m\n" $(CC) $(CFLAGS) -c $< @@ -20,8 +24,32 @@ run: ./$(EXEC) 10 1000 @echo "\n\033[32mProgramme éxécuté avec succès\033[0m" +organisation: + @echo "\n\033[31m--------------CRÉATION DE RÉPERTOIRES ORGANISÉS ----------------------------\033[0m\n" + @mkdir -p $(BIN_DIR) $(SRC_DIR) $(INCLUDE_DIR) $(OBJ_DIR) + @mv main $(BIN_DIR) + @find . -maxdepth 1 -type f -name "*.c" ! -path "./$(SRC_DIR)/*" -exec mv {} $(SRC_DIR)/ \; + @find . -maxdepth 1 -type f -name "*.h" ! -path "./$(INCLUDE_DIR)/*" -exec mv {} $(INCLUDE_DIR)/ \; + @find . -maxdepth 1 -type f -name "*.o" ! -path "./$(OBJ_DIR)/*" -exec mv {} $(OBJ_DIR)/ \; + @echo "\n\033[32mOrganisation des fichiers avec succès\033[0m" + + +# make clean ------------------------------------------------------------------------------------------------ +desorganisation: + @echo "\n\033[31m--------------RESTORATION DES FICHIERS DANS LE REPERTOIRE COURANT ----------\033[0m\n" + @mv $(BIN_DIR)/main ./ + @mv $(SRC_DIR)/*c ./ + @mv $(INCLUDE_DIR)/*h ./ + @mv $(OBJ_DIR)/*o ./ + @echo "\n\033[32mRestoration des fichiers dans le repertoire courant avec succès\033[0m" + + +cleanRepertoire: + @echo "\n\033[31m--------------SUPPRESSION DES RÉPERTOIRES ORGANISÉS -----------------------\033[0m\n" + @rm -r $(BIN_DIR) $(SRC_DIR) $(INCLUDE_DIR) $(OBJ_DIR)* + @echo "\n\033[32mSuppression des répertoires d'organisation avec succès\033[0m" -clean: +cleanObjMain: @echo "\n\033[31m--------------SUPPRESSION DES FICHIERS OBJETS ET DU MAIN -------------------\033[0m\n" rm *.o $(EXEC) - @echo "\n\033[32mSuppression du fichier main avec succès\033[0m" + @echo "\n\033[32mSuppression des fichiers objets et du main avec succès\033[0m"