| mcc -c module1.c -o module1.o |
| NOMEM int i; |
|
#define NOMEM /* rien */ #include "vars.h" |
|
#define NOMEM extern #include "vars.h" |
| Rationnel.h |
operations.h |
entrees-sorties.h |
rationnel.c |
|---|---|---|---|
| typedef struct { int num, den; } Rationnel; |
#include "Rationnel.h" Rationnel ajoute( Rationnel, Rationnel ); |
#include "Rationnel.h" void affiche( Rationnel ); |
#include "operations.h" #include "entrees-sorties.h" |
|
#ifndef _RATIONNEL_H #define _RATIONNEL_H typedef struct { int num, den; } Rationnel; #endif |
| mcc -lm -o executable module1.o ... moduleN.o |
# definitions du projet
TARGET = exe
OBJECTS = main.o proc.o
#
# premiere regle: commande d'edition de liens
$(TARGET) : $(OBJECTS)
$(CC) $(LFLAGS) -o $@ $(OBJECTS)
#
# dependances d'includes
main.o : main.h prototypes.h
proc.o : proc.h prototypes.h
#
# commande generale de compilation
%.o : %.c
$(CC) $(CFLAGS) -o $@ -c $<
#
# parametres de gcc
CC = gcc
CFLAGS = -ansi -pedantic -W -Wall
LFLAGS = -lm
#
# commandes de nettoyage
TOCLEAN = $(OBJECTS) *~
clean :
rm $(TOCLEAN)
cleanall :
rm $(TARGET) $(TOCLEAN)
|