makefile模板
2014-08-13 17:57
218 查看
1.动态库的编译
#############################################################
# Makefile for shared library.
# 编译动态链接库
#############################################################
#set your own environment option
CC = g++
CC_FLAG = -D_NOMNG -D_FILELINE
#set your inc and lib
INC =
LIB = -lpthread -L./ -lsvrtool
#make target lib and relevant obj
PRG = libsvrtool.so
OBJ = Log.o
#all target
all:$(PRG)
$(PRG):$(OBJ)
$(CC) -shared -o $@ $(OBJ) $(LIB)
.SUFFIXES: .c .o .cpp
.cpp.o:
$(CC) $(CC_FLAG) $(INC) -c $*.cpp -o $*.o
.PRONY:clean
clean:
@echo "Removing linked and compiled files......;
rm -f $(OBJ) $(PRG)
2.静态库的编译
#############################################################
# Makefile for static library.
# 编译静态链接库
#############################################################
#set your own environment option
CC = g++
CC_FLAG = -D_NOMNG -D_FILELINE
#static library use 'ar' command
AR = ar
#set your inc and lib
INC =
LIB = -lpthread -L./ -lsvrtool
#make target lib and relevant obj
PRG = libsvrtool.a
OBJ = Log.o
#all target
all:$(PRG)
$(PRG):$(OBJ)
${AR} rv ${PRG} $?
.SUFFIXES: .c .o .cpp
.cpp.o:
$(CC) $(CC_FLAG) $(INC) -c $*.cpp -o $*.o
.PRONY:clean
clean:
@echo "Removing linked and compiled files......"
rm -f $(OBJ) $(PRG)
3.可执行程序
###########################################
#Makefile for simple programs
###########################################
INC=
LIB= -lpthread
CC=CC
CC_FLAG=-Wall
PRG=threadpooltest
OBJ=CThreadManage.o CThreadPool.o CThread.o CWorkerThread.o threadpooltest.o
$(PRG):$(OBJ)
$(CC) $(INC) $(LIB) -o $@ $(OBJ)
.SUFFIXES: .c .o .cpp
.cpp.o:
$(CC) $(CC_FLAG) $(INC) -c $*.cpp -o $*.o
.PRONY:clean
clean:
@echo "Removing linked and compiled files......"
rm -f $(OBJ) $(PRG)
#############################################################
# Makefile for shared library.
# 编译动态链接库
#############################################################
#set your own environment option
CC = g++
CC_FLAG = -D_NOMNG -D_FILELINE
#set your inc and lib
INC =
LIB = -lpthread -L./ -lsvrtool
#make target lib and relevant obj
PRG = libsvrtool.so
OBJ = Log.o
#all target
all:$(PRG)
$(PRG):$(OBJ)
$(CC) -shared -o $@ $(OBJ) $(LIB)
.SUFFIXES: .c .o .cpp
.cpp.o:
$(CC) $(CC_FLAG) $(INC) -c $*.cpp -o $*.o
.PRONY:clean
clean:
@echo "Removing linked and compiled files......;
rm -f $(OBJ) $(PRG)
2.静态库的编译
#############################################################
# Makefile for static library.
# 编译静态链接库
#############################################################
#set your own environment option
CC = g++
CC_FLAG = -D_NOMNG -D_FILELINE
#static library use 'ar' command
AR = ar
#set your inc and lib
INC =
LIB = -lpthread -L./ -lsvrtool
#make target lib and relevant obj
PRG = libsvrtool.a
OBJ = Log.o
#all target
all:$(PRG)
$(PRG):$(OBJ)
${AR} rv ${PRG} $?
.SUFFIXES: .c .o .cpp
.cpp.o:
$(CC) $(CC_FLAG) $(INC) -c $*.cpp -o $*.o
.PRONY:clean
clean:
@echo "Removing linked and compiled files......"
rm -f $(OBJ) $(PRG)
3.可执行程序
###########################################
#Makefile for simple programs
###########################################
INC=
LIB= -lpthread
CC=CC
CC_FLAG=-Wall
PRG=threadpooltest
OBJ=CThreadManage.o CThreadPool.o CThread.o CWorkerThread.o threadpooltest.o
$(PRG):$(OBJ)
$(CC) $(INC) $(LIB) -o $@ $(OBJ)
.SUFFIXES: .c .o .cpp
.cpp.o:
$(CC) $(CC_FLAG) $(INC) -c $*.cpp -o $*.o
.PRONY:clean
clean:
@echo "Removing linked and compiled files......"
rm -f $(OBJ) $(PRG)
相关文章推荐
- Makefile常用万能模板(包括静态链接库、动态链接库、可执行文件)
- 写驱动时交叉编译之makefile编写模板(tiny6410)
- makefile编写---单个子目录编译自动变量模板ok
- 我的makefile模板
- makefile模板(应用程序)
- 交叉编译的Makefile模板
- Android makefile文件语法规范及使用模板
- 一个linux下g++使用的 makefile 模板
- .mod.c是什么文件,及内核模块Makefile模板
- 我的常用Makefile 模板
- PC上简单驱动的Makefile模板
- 一个通用的Makefile模板
- 写驱动时交叉编译之makefile编写模板(tiny6410)
- GNU/Linux智能Makefile模板(多目录,多文件)
- Makefile的简单使用与最简单模板
- Vim编程下自创Makefile模板
- Makefile常用万能模板(包括静态链接库、动态链接库、可执行文件)
- linux makefile模板
- Makefile 一点一滴(一)—— 从最简单的makefile模板写起
- linux: 几个常用makefile模板