Skip to content
Snippets Groups Projects
Commit a0f3c508 authored by Pradheep Unnikrishnan's avatar Pradheep Unnikrishnan
Browse files

Plusieurs proposition de makefile mais la Version_2 du repertoire...

Plusieurs proposition de makefile mais la Version_2 du repertoire makefileAvancee est la plus complete
parent 60fd778f
Branches
No related merge requests found
......@@ -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
......
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"
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment