Ajout du test-09
This commit is contained in:
parent
698b9014de
commit
bfeec38854
1
tests/C/test-09-handling-comment/README.md
Normal file
1
tests/C/test-09-handling-comment/README.md
Normal file
@ -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)
|
24
tests/C/test-09-handling-comment/bake/Bakefile
Normal file
24
tests/C/test-09-handling-comment/bake/Bakefile
Normal file
@ -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
|
8
tests/C/test-09-handling-comment/bake/main.c
Normal file
8
tests/C/test-09-handling-comment/bake/main.c
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
printf("Hello from main!\n");
|
||||||
|
print_message();
|
||||||
|
return 0;
|
||||||
|
}
|
6
tests/C/test-09-handling-comment/bake/module.c
Normal file
6
tests/C/test-09-handling-comment/bake/module.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
void print_message() {
|
||||||
|
printf("Hello from module!\n");
|
||||||
|
}
|
6
tests/C/test-09-handling-comment/bake/module.h
Normal file
6
tests/C/test-09-handling-comment/bake/module.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef MODULE_H
|
||||||
|
#define MODULE_H
|
||||||
|
|
||||||
|
void print_message();
|
||||||
|
|
||||||
|
#endif
|
24
tests/C/test-09-handling-comment/make/Makefile
Normal file
24
tests/C/test-09-handling-comment/make/Makefile
Normal file
@ -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
|
8
tests/C/test-09-handling-comment/make/main.c
Normal file
8
tests/C/test-09-handling-comment/make/main.c
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
printf("Hello from main!\n");
|
||||||
|
print_message();
|
||||||
|
return 0;
|
||||||
|
}
|
6
tests/C/test-09-handling-comment/make/module.c
Normal file
6
tests/C/test-09-handling-comment/make/module.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
void print_message() {
|
||||||
|
printf("Hello from module!\n");
|
||||||
|
}
|
6
tests/C/test-09-handling-comment/make/module.h
Normal file
6
tests/C/test-09-handling-comment/make/module.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef MODULE_H
|
||||||
|
#define MODULE_H
|
||||||
|
|
||||||
|
void print_message();
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user