Chinaunix首页 | 论坛 | 博客
  • 博客访问: 90047
  • 博文数量: 22
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 240
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-03 11:02
文章分类

全部博文(22)

文章存档

2011年(1)

2010年(21)

我的朋友

分类: LINUX

2011-07-28 11:50:46


#this make file can auto maticly make all c and cpp files in a folder.
#no need to modify this file, it can work well.
#autor: Chunrui Wang
#date: 2011-07-28



# The executeable file name
APP = Target

# source file name . include C and Cpp
SRCS = $(wildcard *.cpp) $(wildcard *.c)

#object files
OBJS = $(patsubst %.cpp,%.o,$(patsubst %.c,%.o,$(SRCS)))

#header depandence files.
DEPS = $(patsubst %.cpp,%.d~,$(patsubst %.c,%.d~,$(SRCS)))

        
#support mutiple target here.
.PHONY : all
all : $(APP)

$(APP):$(OBJS)
    #$(CXX) $(CFLAGS) -o $(APP) $(OBJS) $(LDFLAGS)
    #$(AR) r "lib$(APP).a" $(OBJS)
    $(CXX) -shared -o "lib$(APP).so" $(OBJS)




#generate the header depandence for each cpp file.
#Delete the hint rule of makefile for Cpp file.
.SUFFIXES : .cpp
.cpp.o:
    $(CXX) $(CFLGAS) -MMD -MF $*.d~ -c -o $@ $<


#generate the header depandence for each c file.
#Delete the hint rule of makefile for C file.
.SUFFIXES : .c
.c.o:
    $(CXX) $(CFLGAS) -MMD -MF $*.d~ -c -o $@ $<


#this is very important
-include $(DEPS)



#Deleting some files to make the project clean.
.PHONY : clean
clean :
    rm -rf *.o
    rm -rf $(APP)
    rm -rf *~



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

上一篇:Win7下打开dbgPrint

下一篇:没有了

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