######################################
#
# 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? := libtest.so
?
#compile and lib parameter
#
編譯參數(shù)
CC????? := gcc
LIBS??? :=
LDFLAGS:=?
DEFINES:=
INCLUDE:= -I.
CFLAGS? := -g -Wall -O3 $(DEFINES) $(INCLUDE)
CXXFLAGS:= $(CFLAGS) -DHAVE_CONFIG_H
SHARE?? := -fPIC -shared -o
?
#i think you should do anything here
#
下面的基本上不需要做任何改動了
?
#source file
#
源文件,自動找所有
.c
和
.cpp
文件,并將目標定義為同名
.o
文件
SOURCE? := $(wildcard *.c) $(wildcard *.cpp)
OBJS??? := $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCE)))
?
.PHONY : everything objs clean veryclean rebuild
?
everything : $(TARGET)
?
all : $(TARGET)
?
objs : $(OBJS)
?
rebuild: veryclean everything
???????????????
clean :
??? rm -fr *.o
???
veryclean : clean
??? rm -fr $(TARGET)
?
$(TARGET) : $(OBJS)?
??? $(CC) $(CXXFLAGS) $(SHARE) $@ $(OBJS) $(LDFLAGS) $(LIBS)
|