Chinaunix首页 | 论坛 | 博客
  • 博客访问: 409045
  • 博文数量: 117
  • 博客积分: 5235
  • 博客等级: 大校
  • 技术积分: 1775
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-12 15:51
文章分类

全部博文(117)

文章存档

2012年(9)

2011年(2)

2010年(21)

2009年(13)

2008年(72)

我的朋友

分类: LINUX

2008-11-19 17:44:45

背景:
    原来知道条件编程这回事,但从来没用过.现在需要了,而且要从Makefile获取宏.感觉不错,做以下记录.

正文:
Macro condition compile

1. macro check in source code
e.g. main.c
#ifdef MACRO1
  #include "header1.h"
#endif
#ifdef MACRO2
  #indlcude "header2.h"
#endif

2. send macro by Makefile
  include Makefile.in
  gcc -D $MAC -o $OBJ $SRC  #-D means define a macro
3. define macro in Makefile.in
MAC="MACRO1"

4. generate Makefile.in
write a bash or perl script to generate a fit Makefile.in file(multiple macros), in general this script 
is named configure and is executable.

阅读(586) | 评论(0) | 转发(0) |
0

上一篇:apt-move 制作本地源

下一篇:css 乱总结

给主人留下些什么吧!~~