From b2ebd69808e4729cc268609a385bf6b2ef143959 Mon Sep 17 00:00:00 2001
From: Moncef STITI <moncef.stiti@etu.u-pec.fr>
Date: Sun, 9 Feb 2025 17:59:59 +0100
Subject: [PATCH] =?UTF-8?q?Ajout=20du=20test=20n=C2=B014=20pour=20v=C3=A9r?=
 =?UTF-8?q?ifier=20la=20suppression=20d'un=20fichier=20source=20et=20la=20?=
 =?UTF-8?q?recompilation=20avec=20Bake=20et=20Make?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../README.md                                 | 63 +++++++++++++++++++
 .../bake/Bakefile                             |  5 ++
 .../bake/test.c                               |  6 ++
 .../make/Makefile                             |  5 ++
 .../make/test.c                               |  6 ++
 5 files changed, 85 insertions(+)
 create mode 100644 tests/C/test-14-remove-source-and-rebuild/README.md
 create mode 100644 tests/C/test-14-remove-source-and-rebuild/bake/Bakefile
 create mode 100644 tests/C/test-14-remove-source-and-rebuild/bake/test.c
 create mode 100644 tests/C/test-14-remove-source-and-rebuild/make/Makefile
 create mode 100644 tests/C/test-14-remove-source-and-rebuild/make/test.c

diff --git a/tests/C/test-14-remove-source-and-rebuild/README.md b/tests/C/test-14-remove-source-and-rebuild/README.md
new file mode 100644
index 0000000..e1a6436
--- /dev/null
+++ b/tests/C/test-14-remove-source-and-rebuild/README.md
@@ -0,0 +1,63 @@
+# Test n°14 -  Suppression d'un fichier source et recompilation
+
+## Objectif
+Ce test a pour but de vérifier comment **Bake** et **Make** réagissent lorsque le fichier source `.c` est supprimé après la première compilation et qu'une recompilation est demandée.
+
+## Structure du projet
+Le test est organisé en deux répertoires :
+
+```
+.
+├── bake
+│   ├── Bakefile         # Fichier de build pour Bake
+│   ├── bakefile.jar     # Fichier Bake pré-compilé
+│   └── test.c           # Fichier source C
+├── bakefile.jar         # Copie du fichier Bake
+└── make
+    ├── Makefile         # Fichier de build pour Make
+    └── test.c           # Fichier source C
+```
+
+## Étapes du test
+
+### 1. Compilation initiale
+#### **Avec Bake**
+Exécutez les commandes suivantes :
+```sh
+cd bake
+java -cp bakefile.jar fr.monlouyan.bakefile.Main
+```
+Vous devriez voir la compilation de `test.c` en `test.o`.
+
+#### **Avec Make**
+Exécutez les commandes suivantes :
+```sh
+cd ../make
+make
+```
+Cela devrait également compiler `test.c` en `test.o`.
+
+### 2. Suppression du fichier source
+Dans chaque répertoire (`bake/` et `make/`), supprimez `test.c` :
+```sh
+rm test.c
+```
+
+### 3. Recompilation
+#### **Avec Bake**
+```sh
+java -cp bakefile.jar fr.monlouyan.bakefile.Main
+```
+#### **Avec Make**
+```sh
+make
+```
+
+## Résultats attendus
+Si `Bake` fonctionne comme `Make`, nous devrions observer une erreur de compilation, car `test.c` est manquant.
+
+Exemple de sortie attendue :
+```
+make: *** No rule to make target `test.c', needed by `test.o'.  Stop.
+```
+
diff --git a/tests/C/test-14-remove-source-and-rebuild/bake/Bakefile b/tests/C/test-14-remove-source-and-rebuild/bake/Bakefile
new file mode 100644
index 0000000..e9aa47d
--- /dev/null
+++ b/tests/C/test-14-remove-source-and-rebuild/bake/Bakefile
@@ -0,0 +1,5 @@
+CC = gcc
+CFLAGS = -Wall -Wextra -c
+
+test.o: test.c
+	$(CC) $(CFLAGS) -o test.o test.c
diff --git a/tests/C/test-14-remove-source-and-rebuild/bake/test.c b/tests/C/test-14-remove-source-and-rebuild/bake/test.c
new file mode 100644
index 0000000..8e411a7
--- /dev/null
+++ b/tests/C/test-14-remove-source-and-rebuild/bake/test.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void) {
+    printf("Hello, Bake!\n");
+    return 0;
+}
diff --git a/tests/C/test-14-remove-source-and-rebuild/make/Makefile b/tests/C/test-14-remove-source-and-rebuild/make/Makefile
new file mode 100644
index 0000000..e9aa47d
--- /dev/null
+++ b/tests/C/test-14-remove-source-and-rebuild/make/Makefile
@@ -0,0 +1,5 @@
+CC = gcc
+CFLAGS = -Wall -Wextra -c
+
+test.o: test.c
+	$(CC) $(CFLAGS) -o test.o test.c
diff --git a/tests/C/test-14-remove-source-and-rebuild/make/test.c b/tests/C/test-14-remove-source-and-rebuild/make/test.c
new file mode 100644
index 0000000..8e411a7
--- /dev/null
+++ b/tests/C/test-14-remove-source-and-rebuild/make/test.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void) {
+    printf("Hello, Bake!\n");
+    return 0;
+}