C实战:项目构建Make,Automake,CMake在本系列文章《C实战:强大的程序调试工具GDB》中我们简要学习了流行的调试工具GDB的使用方法。本文继续“C实战”的主题,对同样非常流行的构建工具Make的用法和原理一探究竟,并顺便看一下一些高级衍生产品。1.Make基础首先我们编写一个简单的C项目,以此项目在实战中学习Make的相关知识。更全面的介绍请参考官方手册。cdai@vm /syspace/2-ccpp/24-pragmatic/build-tool/make $ tree
.
├── hello.c
├── hello.h
├── main.c
└── Makefile0directories,4files整个程序的逻辑非常简单:main.c中包含一个main方法,调用了hello.c中的sayHello()函数,打印了一句话到控制台上。// cat main.c hello.h hello.c// ----- main.c -----#include "hello.h"intmain(void)
{
sayHello("Make");return1;
}// ----- hello.h -----#ifndef _HELLO_H_#define _HELLO_H_voidsayHello(char*name);#endif// ----- hello.c
...
继续阅读
(168)