projtec:make
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| projtec:make [2020/09/15 16:21] – orel | projtec:make [2024/03/18 15:06] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 24: | Line 24: | ||
| CFLAGS=-Wall -g -std=c99 | CFLAGS=-Wall -g -std=c99 | ||
| LDFLAGS= | LDFLAGS= | ||
| - | LDLIBS=-lm | + | LDLIBS=-lm |
| CPPFLAGS= | CPPFLAGS= | ||
| Line 32: | Line 32: | ||
| # règle spécifique pour générer l' | # règle spécifique pour générer l' | ||
| toto: toto.o tutu.o tata.o | toto: toto.o tutu.o tata.o | ||
| - | $(CC) $^ -o $@ $(LDFLAGS) | + | |
| # règle générique de compilation des fichiers C (implicite) | # règle générique de compilation des fichiers C (implicite) | ||
| Line 74: | Line 74: | ||
| CC=gcc | CC=gcc | ||
| CFLAGS=-Wall -g -std=c99 | CFLAGS=-Wall -g -std=c99 | ||
| - | LDFLAGS=-lm # options de link | + | LDFLAGS= |
| + | LDLIBS=-lm | ||
| CPPFLAGS= | CPPFLAGS= | ||
| Line 82: | Line 83: | ||
| # règle spécifique pour générer l' | # règle spécifique pour générer l' | ||
| toto: toto.o tutu.o tata.o | toto: toto.o tutu.o tata.o | ||
| - | $(CC) $^ -o $@ $(LDFLAGS) | + | |
| # dépendances explicites | # dépendances explicites | ||
| Line 93: | Line 94: | ||
| rm -f *.o *~ toto | rm -f *.o *~ toto | ||
| </ | </ | ||
| + | |||
| + | Plus d'info sur les régles implicites : https:// | ||
| + | |||
| + | ==== Pour aller un peu plus loin ==== | ||
| L' | L' | ||
| Line 109: | Line 114: | ||
| CC=gcc | CC=gcc | ||
| CFLAGS=-Wall -g -std=c99 | CFLAGS=-Wall -g -std=c99 | ||
| - | LDFLAGS=-lm # options de link | + | LDFLAGS= |
| + | LDLIBS=-lm | ||
| CPPFLAGS= | CPPFLAGS= | ||
| Line 117: | Line 123: | ||
| # règle spécifique pour générer l' | # règle spécifique pour générer l' | ||
| toto: toto.o tutu.o tata.o | toto: toto.o tutu.o tata.o | ||
| - | $(CC) $^ -o $@ $(LDFLAGS) | + | |
| .PHONY: clean dep | .PHONY: clean dep | ||
| Line 134: | Line 140: | ||
| Dans ce cas, il faut commencer par faire "make dep" pour générer le fichier des dépendances, | Dans ce cas, il faut commencer par faire "make dep" pour générer le fichier des dépendances, | ||
| - | ==== Pour aller un peu plus loin ==== | + | ==== Pour aller encore |
| //Parler de Makefile recursif avec "make -C subdir" | //Parler de Makefile recursif avec "make -C subdir" | ||
| Line 142: | Line 148: | ||
| SOURCES | SOURCES | ||
| INCLUDES := $(wildcard *.h) | INCLUDES := $(wildcard *.h) | ||
| - | OBJECTS | + | OBJECTS |
| </ | </ | ||
| + | |||
| + | ==== Nota Bene ==== | ||
| + | |||
| + | //Quelques astuces...// | ||
| + | |||
| + | * @ suppresses the normal ' | ||
| + | * - means ignore the exit status of the command that is executed (normally, a non-zero exit status would stop that part of the build). | ||
| + | * + means ' | ||
| + | |||
| + | Plus d'info : https:// | ||
projtec/make.1600186875.txt.gz · Last modified: 2024/03/18 15:05 (external edit)
