How to pass macro definition from “makefile” command line arguments to C source code?
来源:互联网 发布:淘宝神店 知乎 编辑:程序博客网 时间:2024/05/18 01:32
1
2
3
4
5
6
7
8
#FILENAME:Makefile
export SAI=y
ifeq ($(SAI),y)
CFLAGS += -DSAI
endif
all:
@gcc $(CFLAGS) macro_test.c -o macro_test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*FILENAME:macro_test.c*/
#include <stdio.h>
#include <stdlib.h>
int
main(
int
argc,
char
* argv[])
{
#ifdef SAI
printf
(
"I am in SAI env\n"
);
#endif
printf
(
"hi everyone\n"
);
return
0;
}
在Makefile中 把
export SAI=y or SAI=n
就可以決定有沒有定義SAI在C code中
0 0
- How to pass macro definition from “makefile” command line arguments to C source code?
- How to pass QEMU command-line options through libvirt
- How to pass QEMU command-line options through libvirt
- How to get source code from APK
- How to pass arguments in exchange
- C argc and argv Examples to Parse Command Line Arguments
- C argc and argv Examples to Parse Command Line Arguments
- How to run FTE and FTE from command line
- How to open Firefox and chrome from command line
- How to use FTP from the command line.
- How to access Dropbox from the command line in Linux
- How to identify video formats from command line on Linux
- Ubuntu Tip:How to show desktop from command line
- How to Deleting a Storage Repository From the Command Line?
- TestNG - How to run TestNG from command line successfully
- How to find the source code of the special command?
- Passing Command Line Arguments to a Module
- How to build NCL and NCAR Graphics from source code
- Java中的字符串分割
- samba,让ubuntu与windows实现文件共享
- win7 uac的有用资料
- Palindrome Partitioning II
- 每个软件开发者必须绝对至少需要了解的Unicode和Character Sets的知识(没有借口!)
- How to pass macro definition from “makefile” command line arguments to C source code?
- Android------线程thread
- 数据结构---动态顺序表
- IOS行货自动打包
- Android之NDK开发
- 心情
- 网络上下载apk
- C# NPOI AutoSizeColumn失效解决方案
- Unity3D 编辑器功能之MonoBehaviour属性