Makefile
###################################### # # Generic makefile # # by Coon Xu # email: coonxu@126.com # # Copyright (c) 2005 Coon Xu # All rights reserved. # # No warranty, no liability; # you use this at your own risk. # # You are free to modify and # distribute this without giving # credit to the original author. # ###################################### #source file # 源文件,自动找所有 .c 和 .cpp 文件,并将目标定义为同名 .o 文件 SOURCE OBJS #target you can change test to what you want # 目标文件名,输入任意你想要的执行文件名 TARGET #compile and lib parameter # 编译参数 CC LIBS LDFLAGS:= DEFINES:= INCLUDE:= -I. CFLAGS CXXFLAGS:= $(CFLAGS) -DHAVE_CONFIG_H #i think you should do anything here # 下面的基本上不需要做任何改动了 .PHONY : everything objs clean veryclean rebuild everything : $(TARGET) all : $(TARGET) objs : $(OBJS) rebuild: veryclean everything clean : veryclean : clean $(TARGET) : $(OBJS) |
###################################### # # Generic Static Library makefile # # by Coon Xu # email: coonxu@126.com # # Copyright (c) 2005 Coon Xu # All rights reserved. # # No warranty, no liability; # you use this at your own risk. # # You are free to modify and # distribute this without giving # credit to the original author. # ###################################### #target you can change test to what you want # 共享库文件名, lib*.a TARGET #compile and lib parameter # 编译参数 CC AR RANLIB LIBS LDFLAGS:= DEFINES:= INCLUDE:= -I. CFLAGS CXXFLAGS:= $(CFLAGS) -DHAVE_CONFIG_H #i think you should do anything here # 下面的基本上不需要做任何改动了 #source file # 源文件,自动找所有 .c 和 .cpp 文件,并将目标定义为同名 .o 文件 SOURCE OBJS .PHONY : everything objs clean veryclean rebuild everything : $(TARGET) all : $(TARGET) objs : $(OBJS) rebuild: veryclean everything clean : veryclean : clean $(TARGET) : $(OBJS) |
######################################
#
# Generic Share Library makefile
#
# by Coon Xu
# email: coonxu@126.com
#
# Copyright (c) 2005 Coon Xu
# All rights reserved.
#
# No warranty, no liability;
# you use this at your own risk.
#
# You are free to modify and
# distribute this without giving
# credit to the original author.
#
######################################
#target you can change test to what you want
# 共享库文件名, lib*.so
TARGET
#compile and lib parameter
# 编译参数
CC
LIBS
LDFLAGS:=
DEFINES:=
INCLUDE:= -I.
CFLAGS
CXXFLAGS:= $(CFLAGS) -DHAVE_CONFIG_H
SHARE
#i think you should do anything here
# 下面的基本上不需要做任何改动了
#source file
# 源文件,自动找所有 .c 和 .cpp 文件,并将目标定义为同名 .o 文件
SOURCE
OBJS
.PHONY : everything objs clean veryclean rebuild
everything : $(TARGET)
all : $(TARGET)
objs : $(OBJS)
rebuild: veryclean everything
clean :
veryclean : clean
$(TARGET) : $(OBJS)
来源:http://blog.sina.com.cn/s/blog_4e3c6b480100th47.html