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; +}