博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Makefile之通用模板
阅读量:4026 次
发布时间:2019-05-24

本文共 842 字,大约阅读时间需要 2 分钟。

## 一般通用Makefile模板

CC      = gccCXX     = g++CFLAGS  = -Wall -g -O2TARGET  = myTestSRCDIR  = .SOURCES = $(wildcard $(SRCDIR)/*.c $(SRCDIR)/*.cpp $(SRCDIR)/*.s)OBJS    = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCES)))LDFLAG  = -lstdc++ -lpthreadINCLUDE = -I. -I../incEXTLIBS = -L./../../../lib/LOCAL/ -ltinyxmlifeq ($(SERVER),KONTRON)CFLAGS += -DKONTRON=1endififeq ($(PROJECT),SHENHANG)CFLAGS += -DSHENHANG=1endif%.o: %.c        $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@%.o:%.cpp        $(CXX) $(CFLAGS) $(INCLUDE) -c $< -o $@all : $(TARGET)$(TARGET) : $(OBJS)        $(CC) $(OBJS) -o $@ $(LDFLAG) $(EXTLIBS) $(INCLUDE)clean:        rm -f *.o $(TARGET)

## 语句说明

1、SOURCES = $(wildcard $(SRCDIR)/*.c $(SRCDIR)/*.cpp $(SRCDIR)/*.s)   获取当前目录下的c、cpp、s的代码2、OBJS    = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCES)))   将*.c替换为*.o ,*.cpp替换为*.o的文件

转载地址:http://vcvbi.baihongyu.com/

你可能感兴趣的文章
android中对于非属性动画的整理
查看>>
一个简单的TabLayout的使用
查看>>
关于let{a}=B出现的解构赋值
查看>>
ReactNative使用Redux例子
查看>>
Promise的基本使用
查看>>
android给文字加边框(修改不能居中的问题)
查看>>
coursesa课程 Python 3 programming course_2_assessment_1
查看>>
coursesa课程 Python 3 programming 统计文件有多少单词
查看>>
coursesa课程 Python 3 programming 输出每一行句子的第三个单词
查看>>
coursesa课程 Python 3 programming Dictionary methods 字典的方法
查看>>
Returning a value from a function
查看>>
coursesa课程 Python 3 programming Functions can call other functions 函数调用另一个函数
查看>>
coursesa课程 Python 3 programming Tuple Assignment with Unpacking
查看>>
coursesa课程 Python 3 programming The while Statement
查看>>
course_2_assessment_6
查看>>
coursesa课程 Python 3 programming course_2_assessment_7 多参数函数练习题
查看>>
coursesa课程 Python 3 programming 排序函数sorted的可选参数
查看>>
coursesa课程 Python 3 programming course_2_assessment_8 sorted练习题
查看>>
visca接口转RS-232C接口线序
查看>>
在unity中建立最小的shader(Minimal Shader)
查看>>