Notas de Aula - MAC 211 - Laboratório de
Programação
Aula anterior
Aula 14 - 15/4/2010
Continuando com o utilitário MAKE
Geração automática de dependências
- O makedepend
permite a criação de dependências automaticamente. Hoje em dia está
disponível dentro dos compiladores modernos.
- gcc -M
- Instead of outputting the result of preprocessing, output
a rule suitable for make describing the dependencies of the main source
file. The preprocessor outputs one make rule containing the object file
name for that source file, a colon, and the names of all the included
files, including those coming from -include or -imacros command line
options.
Unless specified explicitly (with -MT or -MQ), the object file name
consists of the name of the source file with any suffix replaced with
object file suffix and with any leading directory parts removed. If
there are many included files then the rule is split into several lines
using `\'-newline. The rule has no commands.
- ver um exemplo de uso.
- pode-se criar um target do makefile para criar um arquivo com dependências e depois usar a diretiva include para incluí-lo no makefile principal
- A explicação detalhada de como usar isso no gcc está em
no manual
das opções do pré-compilador
Próxima aula
Página de MAC211
Página do Fabio
Página do DCC