projtec:make
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| projtec:make [2016/09/21 11:03] – orel | projtec:make [2024/03/18 15:06] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 23: | Line 23: | ||
| 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 31: | 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 73: | 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 81: | 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 92: | 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 108: | 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 116: | 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 131: | Line 138: | ||
| </ | </ | ||
| - | 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 encore plus loin ==== | ||
| + | |||
| + | //Parler de Makefile recursif avec "make -C subdir" | ||
| + | |||
| + | |||
| + | <code bash Makefile> | ||
| + | SOURCES | ||
| + | INCLUDES := $(wildcard *.h) | ||
| + | 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:// | ||
| - | __Todo__ : //Parler de Makefile recursif avec "make -C subdir" | ||
projtec/make.1474455824.txt.gz · Last modified: 2024/03/18 15:05 (external edit)
