From bfeec38854ea77dee0c568d7770aaffae856cd91 Mon Sep 17 00:00:00 2001 From: Louay DARDOURI Date: Sat, 8 Feb 2025 22:02:51 +0100 Subject: [PATCH] Ajout du test-09 --- tests/C/test-09-handling-comment/README.md | 1 + .../C/test-09-handling-comment/bake/Bakefile | 24 +++++++++++++++++++ tests/C/test-09-handling-comment/bake/main.c | 8 +++++++ .../C/test-09-handling-comment/bake/module.c | 6 +++++ .../C/test-09-handling-comment/bake/module.h | 6 +++++ .../C/test-09-handling-comment/make/Makefile | 24 +++++++++++++++++++ tests/C/test-09-handling-comment/make/main.c | 8 +++++++ .../C/test-09-handling-comment/make/module.c | 6 +++++ .../C/test-09-handling-comment/make/module.h | 6 +++++ 9 files changed, 89 insertions(+) create mode 100644 tests/C/test-09-handling-comment/README.md create mode 100644 tests/C/test-09-handling-comment/bake/Bakefile create mode 100644 tests/C/test-09-handling-comment/bake/main.c create mode 100644 tests/C/test-09-handling-comment/bake/module.c create mode 100644 tests/C/test-09-handling-comment/bake/module.h create mode 100644 tests/C/test-09-handling-comment/make/Makefile create mode 100644 tests/C/test-09-handling-comment/make/main.c create mode 100644 tests/C/test-09-handling-comment/make/module.c create mode 100644 tests/C/test-09-handling-comment/make/module.h diff --git a/tests/C/test-09-handling-comment/README.md b/tests/C/test-09-handling-comment/README.md new file mode 100644 index 0000000..a340aa1 --- /dev/null +++ b/tests/C/test-09-handling-comment/README.md @@ -0,0 +1 @@ +On fait un test pour voir si le makefile gère bien les commentaires (ils peuvent être placée un peu partout) \ No newline at end of file diff --git a/tests/C/test-09-handling-comment/bake/Bakefile b/tests/C/test-09-handling-comment/bake/Bakefile new file mode 100644 index 0000000..59b7210 --- /dev/null +++ b/tests/C/test-09-handling-comment/bake/Bakefile @@ -0,0 +1,24 @@ +# Définition des variables +COMPILER = gcc # On utilise gcc comme compilateur +CFLAGS = -Wall -Wextra # Options de compilation +OUTPUT = program # Nom de l'exécutable + +# Liste des fichiers objets +OBJS = main.o module.o # Chaque .o correspond à un fichier source + +# Règle principale +$(OUTPUT): $(OBJS) # L'exécutable dépend des fichiers objets + $(COMPILER) $(CFLAGS) -o $(OUTPUT) $(OBJS) # Compilation finale + +# Compilation des fichiers objets +main.o: main.c # Dépendance explicite + $(COMPILER) $(CFLAGS) -c main.c -o main.o # Compilation de main.c + +module.o: module.c # Autre dépendance + $(COMPILER) $(CFLAGS) -c module.c -o module.o # Compilation de module.c + +# Nettoyage des fichiers générés +clean: # Cible pour supprimer les fichiers de compilation + rm -f $(OUTPUT) $(OBJS) # Suppression des fichiers objets et de l'exécutable + +# Fin du Bakefile diff --git a/tests/C/test-09-handling-comment/bake/main.c b/tests/C/test-09-handling-comment/bake/main.c new file mode 100644 index 0000000..c97d1b7 --- /dev/null +++ b/tests/C/test-09-handling-comment/bake/main.c @@ -0,0 +1,8 @@ +#include +#include "module.h" + +int main() { + printf("Hello from main!\n"); + print_message(); + return 0; +} diff --git a/tests/C/test-09-handling-comment/bake/module.c b/tests/C/test-09-handling-comment/bake/module.c new file mode 100644 index 0000000..c771305 --- /dev/null +++ b/tests/C/test-09-handling-comment/bake/module.c @@ -0,0 +1,6 @@ +#include +#include "module.h" + +void print_message() { + printf("Hello from module!\n"); +} diff --git a/tests/C/test-09-handling-comment/bake/module.h b/tests/C/test-09-handling-comment/bake/module.h new file mode 100644 index 0000000..2c03942 --- /dev/null +++ b/tests/C/test-09-handling-comment/bake/module.h @@ -0,0 +1,6 @@ +#ifndef MODULE_H +#define MODULE_H + +void print_message(); + +#endif diff --git a/tests/C/test-09-handling-comment/make/Makefile b/tests/C/test-09-handling-comment/make/Makefile new file mode 100644 index 0000000..59b7210 --- /dev/null +++ b/tests/C/test-09-handling-comment/make/Makefile @@ -0,0 +1,24 @@ +# Définition des variables +COMPILER = gcc # On utilise gcc comme compilateur +CFLAGS = -Wall -Wextra # Options de compilation +OUTPUT = program # Nom de l'exécutable + +# Liste des fichiers objets +OBJS = main.o module.o # Chaque .o correspond à un fichier source + +# Règle principale +$(OUTPUT): $(OBJS) # L'exécutable dépend des fichiers objets + $(COMPILER) $(CFLAGS) -o $(OUTPUT) $(OBJS) # Compilation finale + +# Compilation des fichiers objets +main.o: main.c # Dépendance explicite + $(COMPILER) $(CFLAGS) -c main.c -o main.o # Compilation de main.c + +module.o: module.c # Autre dépendance + $(COMPILER) $(CFLAGS) -c module.c -o module.o # Compilation de module.c + +# Nettoyage des fichiers générés +clean: # Cible pour supprimer les fichiers de compilation + rm -f $(OUTPUT) $(OBJS) # Suppression des fichiers objets et de l'exécutable + +# Fin du Bakefile diff --git a/tests/C/test-09-handling-comment/make/main.c b/tests/C/test-09-handling-comment/make/main.c new file mode 100644 index 0000000..c97d1b7 --- /dev/null +++ b/tests/C/test-09-handling-comment/make/main.c @@ -0,0 +1,8 @@ +#include +#include "module.h" + +int main() { + printf("Hello from main!\n"); + print_message(); + return 0; +} diff --git a/tests/C/test-09-handling-comment/make/module.c b/tests/C/test-09-handling-comment/make/module.c new file mode 100644 index 0000000..c771305 --- /dev/null +++ b/tests/C/test-09-handling-comment/make/module.c @@ -0,0 +1,6 @@ +#include +#include "module.h" + +void print_message() { + printf("Hello from module!\n"); +} diff --git a/tests/C/test-09-handling-comment/make/module.h b/tests/C/test-09-handling-comment/make/module.h new file mode 100644 index 0000000..2c03942 --- /dev/null +++ b/tests/C/test-09-handling-comment/make/module.h @@ -0,0 +1,6 @@ +#ifndef MODULE_H +#define MODULE_H + +void print_message(); + +#endif