• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Benjamin

            靜以修身,儉以養(yǎng)德,非澹薄無以明志,非寧靜無以致遠(yuǎn)。
            隨筆 - 397, 文章 - 0, 評論 - 196, 引用 - 0
            數(shù)據(jù)加載中……

            linux常用makefile模板

             

             一、通用的編譯c、c++單工程makefile模板。
            1、MY_LIBS是添加靜態(tài)庫選項
            2、MY_CFLAGS一般添加include文件路徑,這個路徑被用在了c和c++文件編譯時,對c和c++都有效;如果想分開控制,請定義兩個類似的變量
            3、PROGRAM是最終生成的文件名,默認(rèn)的是文件夾名字,也可自己指定
            4、如果一個項目有多個工程,在頂層執(zhí)行這個文件,會導(dǎo)致進入這個文件夾兩次,第一次產(chǎn)生.d依賴文件,由于此時.o文件尚未生成,所以什么也沒做,
            第二次進入這個目錄,會生成o文件,最終連接成可執(zhí)行文件。.d(depend)依賴文件;如果以后在編譯時,請不要刪除這些.d文件,以后有了改動,
            比如更改了.h文件中的宏變量,則此時可根據(jù).depend中的依賴關(guān)系只生成對應(yīng)的.o文件了。總之,.d文件可要可不要。默認(rèn)的,*.d依賴文件不刪除。
            不需要d文件,將sinclude $(DEPS)注釋掉即可
            5、如果源文件在別的目錄,請設(shè)置VPATH

              1#############################################################
              2# Generic Makefile for C/C++ Program
              3#
              4# License: GPL (General Public License)
              5# Author:  whyglinux <whyglinux AT gmail DOT com>
              6# Date:    2006/03/04 (version 0.1)
              7#          2007/03/24 (version 0.2)
              8#          2007/04/09 (version 0.3)
              9#          2007/06/26 (version 0.4)
             10#          2008/04/05 (version 0.5)
             11#
             12# Description:
             13------------
             14# This is an easily customizable makefile template. The purpose is to
             15# provide an instant building environment for C/C++ programs.
             16#
             17# It searches all the C/C++ source files in the specified directories,
             18# makes dependencies, compiles and links to form an executable.
             19#
             20# Besides its default ability to build C/C++ programs which use only
             21# standard C/C++ libraries, you can customize the Makefile to build
             22# those using other libraries. Once done, without any changes you can
             23# then build programs using the same or less libraries, even if source
             24# files are renamed, added or removed. Therefore, it is particularly
             25# convenient to use it to build codes for experimental or study use.
             26#
             27# GNU make is expected to use the Makefile. Other versions of makes
             28# may or may not work.
             29#
             30# Usage:
             31------
             321. Copy the Makefile to your program directory.
             332. Customize in the "Customizable Section" only if necessary:
             34#    * to use non-standard C/C++ libraries, set pre-processor or compiler
             35#      options to <MY_CFLAGS> and linker ones to <MY_LIBS>
             36#      (See Makefile.gtk+-2.0 for an example)
             37#    * to search sources in more directories, set to <SRCDIRS>
             38#    * to specify your favorite program name, set to <PROGRAM>
             393. Type make to start building your program.
             40#
             41# Make Target:
             42------------
             43# The Makefile provides the following targets to make:
             44#   $ make           compile and link
             45#   $ make NODEP=yes compile and link without generating dependencies
             46#   $ make objs      compile only (no linking)
             47#   $ make tags      create tags for Emacs editor
             48#   $ make ctags     create ctags for VI editor
             49#   $ make clean     clean objects and the executable file
             50#   $ make distclean clean objects, the executable and dependencies
             51#   $ make help      get the usage of the makefile
             52#
             53#===========================================================================
             54
             55## Customizable Section: adapt those variables to suit your program.
             56##==========================================================================
             57
             58# The pre-processor and compiler options.
             59MY_CFLAGS =
             60
             61# The linker options.
             62MY_LIBS   =
             63
             64# The pre-processor options used by the cpp (man cpp for more).
             65CPPFLAGS  = -Wall
             66
             67# The options used in linking as well as in any direct use of ld.
             68LDFLAGS   =
             69
             70# The directories in which source files reside.
             71# If not specified, only the current directory will be serached.
             72SRCDIRS   =
             73
             74# The executable file name.
             75# If not specified, current directory name or `a.out' will be used.
             76PROGRAM   =
             77
             78## Implicit Section: change the following only when necessary.
             79##==========================================================================
             80
             81# The source file types (headers excluded).
             82# .c indicates C source files, and others C++ ones.
             83SRCEXTS = .c .C .cc .cpp .CPP .c++ .cxx .cp
             84
             85# The header file types.
             86HDREXTS = .h .H .hh .hpp .HPP .h++ .hxx .hp
             87
             88# The pre-processor and compiler options.
             89# Users can override those variables from the command line.
             90CFLAGS  = --O2
             91CXXFLAGS= --O2
             92
             93# The C program compiler.
             94#CC     = gcc
             95
             96# The C++ program compiler.
             97#CXX    = g++
             98
             99# Un-comment the following line to compile C programs as C++ ones.
            100#CC     = $(CXX)
            101
            102# The command used to delete file.
            103#RM     = rm -f
            104
            105ETAGS = etags
            106ETAGSFLAGS =
            107
            108CTAGS = ctags
            109CTAGSFLAGS =
            110
            111## Stable Section: usually no need to be changed. But you can add more.
            112##==========================================================================
            113SHELL   = /bin/sh
            114EMPTY   =
            115SPACE   = $(EMPTY) $(EMPTY)
            116ifeq ($(PROGRAM),)
            117  CUR_PATH_NAMES = $(subst /,$(SPACE),$(subst $(SPACE),_,$(CURDIR)))
            118  PROGRAM = $(word $(words $(CUR_PATH_NAMES)),$(CUR_PATH_NAMES))
            119  ifeq ($(PROGRAM),)
            120    PROGRAM = a.out
            121  endif
            122endif
            123ifeq ($(SRCDIRS),)
            124  SRCDIRS = .
            125endif
            126SOURCES = $(foreach d,$(SRCDIRS),$(wildcard $(addprefix $(d)/*,$(SRCEXTS))))
            127HEADERS = $(foreach d,$(SRCDIRS),$(wildcard $(addprefix $(d)/*,$(HDREXTS))))
            128SRC_CXX = $(filter-out %.c,$(SOURCES))
            129OBJS    = $(addsuffix .o, $(basename $(SOURCES)))
            130DEPS    = $(OBJS:.o=.d)
            131
            132## Define some useful variables.
            133DEP_OPT = $(shell if `$(CC) --version | grep "GCC" >/dev/null`; then \
            134                  echo "-MM -MP"; else echo "-M"; fi )
            135DEPEND      = $(CC)  $(DEP_OPT)  $(MY_CFLAGS) $(CFLAGS) $(CPPFLAGS)
            136DEPEND.d    = $(subst -g ,,$(DEPEND))
            137COMPILE.c   = $(CC)  $(MY_CFLAGS) $(CFLAGS)   $(CPPFLAGS) -c
            138COMPILE.cxx = $(CXX) $(MY_CFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c
            139LINK.c      = $(CC)  $(MY_CFLAGS) $(CFLAGS)   $(CPPFLAGS) $(LDFLAGS)
            140LINK.cxx    = $(CXX) $(MY_CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
            141
            142.PHONY: all objs tags ctags clean distclean help show
            143
            144# Delete the default suffixes
            145.SUFFIXES:
            146
            147all: $(PROGRAM)
            148
            149# Rules for creating dependency files (.d).
            150#------------------------------------------
            151
            152%.d:%.c
            153 @echo -n $(dir $<) > $@
            154 @$(DEPEND.d) $< >> $@
            155
            156%.d:%.C
            157 @echo -n $(dir $<) > $@
            158 @$(DEPEND.d) $< >> $@
            159
            160%.d:%.cc
            161 @echo -n $(dir $<) > $@
            162 @$(DEPEND.d) $< >> $@
            163
            164%.d:%.cpp
            165 @echo -n $(dir $<) > $@
            166 @$(DEPEND.d) $< >> $@
            167
            168%.d:%.CPP
            169 @echo -n $(dir $<) > $@
            170 @$(DEPEND.d) $< >> $@
            171
            172%.d:%.c++
            173 @echo -n $(dir $<) > $@
            174 @$(DEPEND.d) $< >> $@
            175
            176%.d:%.cp
            177 @echo -n $(dir $<) > $@
            178 @$(DEPEND.d) $< >> $@
            179
            180%.d:%.cxx
            181 @echo -n $(dir $<) > $@
            182 @$(DEPEND.d) $< >> $@
            183
            184# Rules for generating object files (.o).
            185#----------------------------------------
            186objs:$(OBJS)
            187
            188%.o:%.c
            189 $(COMPILE.c) $< -o $@
            190
            191%.o:%.C
            192 $(COMPILE.cxx) $< -o $@
            193
            194%.o:%.cc
            195 $(COMPILE.cxx) $< -o $@
            196
            197%.o:%.cpp
            198 $(COMPILE.cxx) $< -o $@
            199
            200%.o:%.CPP
            201 $(COMPILE.cxx) $< -o $@
            202
            203%.o:%.c++
            204 $(COMPILE.cxx) $< -o $@
            205
            206%.o:%.cp
            207 $(COMPILE.cxx) $< -o $@
            208
            209%.o:%.cxx
            210 $(COMPILE.cxx) $< -o $@
            211
            212# Rules for generating the tags.
            213#-------------------------------------
            214tags: $(HEADERS) $(SOURCES)
            215 $(ETAGS) $(ETAGSFLAGS) $(HEADERS) $(SOURCES)
            216
            217ctags: $(HEADERS) $(SOURCES)
            218 $(CTAGS) $(CTAGSFLAGS) $(HEADERS) $(SOURCES)
            219
            220# Rules for generating the executable.
            221#-------------------------------------
            222$(PROGRAM):$(OBJS)
            223ifeq ($(SRC_CXX),)              # C program
            224 $(LINK.c)   $(OBJS) $(MY_LIBS) -o $@
            225 @echo Type ./$@ to execute the program.
            226else                            # C++ program
            227 $(LINK.cxx) $(OBJS) $(MY_LIBS) -o $@
            228 @echo Type ./$@ to execute the program.
            229endif
            230
            231ifndef NODEP
            232ifneq ($(DEPS),)
            233  sinclude $(DEPS)
            234endif
            235endif
            236
            237clean:
            238 $(RM) $(OBJS) $(PROGRAM) $(PROGRAM).exe
            239
            240distclean: clean
            241 $(RM) $(DEPS) TAGS
            242
            243# Show help.
            244help:
            245 @echo 'Generic Makefile for C/C++ Programs (gcmakefile) version 0.5'
            246 @echo 'Copyright (C) 2007, 2008 whyglinux <whyglinux@hotmail.com>'
            247 @echo
            248 @echo 'Usage: make [TARGET]'
            249 @echo 'TARGETS:'
            250 @echo '  all       (=make) compile and link.'
            251 @echo '  NODEP=yes make without generating dependencies.'
            252 @echo '  objs      compile only (no linking).'
            253 @echo '  tags      create tags for Emacs editor.'
            254 @echo '  ctags     create ctags for VI editor.'
            255 @echo '  clean     clean objects and the executable file.'
            256 @echo '  distclean clean objects, the executable and dependencies.'
            257 @echo '  show      show variables (for debug use only).'
            258 @echo '  help      print this message.'
            259 @echo
            260 @echo 'Report bugs to <whyglinux AT gmail DOT com>.'
            261
            262# Show variables (for debug use only.)
            263show:
            264 @echo 'PROGRAM     :' $(PROGRAM)
            265 @echo 'SRCDIRS     :' $(SRCDIRS)
            266 @echo 'HEADERS     :' $(HEADERS)
            267 @echo 'SOURCES     :' $(SOURCES)
            268 @echo 'SRC_CXX     :' $(SRC_CXX)
            269 @echo 'OBJS        :' $(OBJS)
            270 @echo 'DEPS        :' $(DEPS)
            271 @echo 'DEPEND      :' $(DEPEND)
            272 @echo 'COMPILE.c   :' $(COMPILE.c)
            273 @echo 'COMPILE.cxx :' $(COMPILE.cxx)
            274 @echo 'link.c      :' $(LINK.c)
            275 @echo 'link.cxx    :' $(LINK.cxx)
            276
            277## End of the Makefile ##  Suggestions are welcome  ## All rights reserved ##
            278##############################################################
            279
            280

            二、多項目工程(頂層)makefile模板:這里采用遍歷子文件夾,在有Makefile文件的文件夾下執(zhí)行make命令
            1、make  ver=$(ver)這里是版本控制,比如make ver=r就是release版本,默認(rèn)是debug,
            版本控制也需要在子項目的Makefile文件中體現(xiàn),這是由用戶自己定義控制
            2、make默認(rèn)是打開w,輸出運行makefile之前和之后的信息,可以用--no-print-directory禁止輸出這個trace信息
            例如:如果采用上面的c、c++工程makefile模板,屏幕會打印進出文件夾的信息,通過這選項可以禁止輸出這些信息。
            3、這里檢測的是各個文件夾下的Makefile文件是否存在,也可以檢測其他文件。

             1# Top Makefile 
             2DIR = /software/project    #也可以DIR:= `ls .`
             3MODULES = $(shell ls $(DIR)) #也可以MODULES:=`pwd`
             4
             5all : $(MODULES)
             6 @for subdir in $(MODULES); \
             7 do \
             8 if test -f $(DIR)/$$subdir/Makefile;then\
             9  cd $(DIR)/$$subdir;\
            10 make  ver=$(ver) ;\
            11 cd  $(DIR);\
            12 fi;\
            13done
            14
            15clean :
            16 @for subdir in $(MODULES); \
            17do \
            18 if test -f $(DIR)/$$subdir/Makefile;then\
            19  cd $(DIR)/$$subdir;\
            20 make --no-print-directory clean ver=$(ver) ;\
            21 cd  $(DIR);\
            22 fi;\
            23done
            24
            25tags:
            26 ctags -R
            27
            28
            29.PHONY : all clean distclean tags help
            30
            31


            三、多項目工程(頂層)makefile模板,采用路徑來表示,不用再檢測是否有makefile文件;這邊版本可以靈活的添加

             1# Top Makefile for C program
             2
             3all :
             4 #version control.default is debug
             5
             6 $(MAKE) ver=$(ver) -/home/project/baseframe 
             7 $(MAKE) ver=$(ver) -/home/project/logic  
             8 $(MAKE) ver=$(ver) -C  /home/project/login 
             9 $(MAKE) ver=$(ver) -/home/project/db 
            10tags:
            11 ctags -R
            12
            13help:
            14 @echo "=====================A common Makefilefor c programs===================="
            15 @echo "Copyright (C) 2014"
            16 @echo "The following targets aresupport:"
            17 @echo
            18 @echo " all              - (==make) compile and link"
            19 @echo " obj              - just compile, withoutlink"
            20 @echo " clean            - clean target"
            21 @echo " distclean        - clean target and otherinformation"
            22 @echo " tags             - create ctags for vimeditor"
            23 @echo " help             - print help information"
            24 @echo
            25 @echo "To make a target, do 'make[target]'"
            26 @echo "========================= Version2.0 ==================================="
            27
            28clean :
            29
            30 $(MAKE) ver=$(ver) -/home/project/baseframe   clean
            31 $(MAKE) ver=$(ver) -/home/project/logic   clean
            32 $(MAKE) ver=$(ver) -/home/project/Login clean 
            33 $(MAKE) ver=$(ver) -/home/project/db    clean 
            34
            35distclean:
            36 $(MAKE) -/home/project/baseframe distclean
            37 $(MAKE) -/home/project/logic distclean
            38 $(MAKE) -/home/project/Login distclean
            39 $(MAKE) -/home/project/db distclean
            40
            41  
            42.PHONY : all clean distclean tags help
            43


             四、通用的c、c++混合編譯模板

              1#
              2# c.cpp混合編譯的makefile模板
              3#
              4#
              5
              6BIN = liblua.so
              7CC = gcc
              8CPP = g++
              9#系統(tǒng)庫的包含路徑、庫列表
             10INCS = 
             11LIBS = 
             12SUBDIRS =
             13
             14#源文件包含路徑、庫列表
             15SOURCEINC = 
             16#
             17#
             18#maintest.c tree/rbtree.c  多了子目錄,那就直接添加 目錄/*.c即可   所有的源文件--  .c文件列表
             19CSRCS = $(wildcard  ./*.c )
             20CPPSRCS = $(wildcard ./*.cpp)
             21
             22#
             23#
             24#所有的.o文件列表
             25COBJS := $(CSRCS:.c=.o)
             26CPPOBJS := $(CPPSRCS:.cpp=.o)
             27#
             28#生成依賴信息 -MM是只生成自己的頭文件信息,-M 包含了標(biāo)準(zhǔn)庫頭文件信息。
             29#-MT 或 -MQ都可以改變生成的依賴  xxx.o:src/xxx.h 為 src/xxx.o:src/xxx.h 當(dāng)然。前面的 src/xxx.o需自己指定
             30#格式為 -MM 輸入.c或.cpp  查找依賴路徑  -MT或-MQ  生成規(guī)則,比如src/xxx.o 
             31MAKEDEPEND = gcc -MM -MT
             32CFLAGS =
             33CPPFLAGS =
             34
             35#-g 生成調(diào)試信息
             36#-pedantic參數(shù)與-ansi一起使用 會自動拒絕編譯非ANSI程序
             37#-fomit-frame-pointer 去除函數(shù)框架
             38#-Wmissing-prototypes -Wstrict-prototypes 檢查函數(shù)原型
             39#針對每個.c文件的.d依賴文件列表
             40CDEF = $(CSRCS:.c=.d)
             41CPPDEF = $(CPPSRCS:.cpp=.d)
             42
             43PLATS = win32-debug win32-release linux-debug linux-release
             44none:
             45 @echo "Please choose a platform:"
             46 @echo " $(PLATS)"
             47
             48win32-debug:
             49 $(MAKE) all INCS=-I"c:/mingw/include" LIBS=-L"c:/mingw/lib" CFLAGS="-Wall -DWIN32 -DDEBUG -g" CPPFLAGS="-Wall -DWIN32 -DDEBUG -g"
             50
             51win32-release:
             52 $(MAKE) all INCS=-I"c:/mingw/include" LIBS=-L"c:/mingw/lib" CFLAGS="-Wall -DWIN32 -DNDEBUG -O2" CPPFLAGS="-Wall -DWIN32 -DNDEBUG -O2"
             53 
             54linux-debug:
             55 $(MAKE) all INCS=-I"/usr/include" LIBS=-L"/usr/lib" CFLAGS="-fPIC -Wall -DDEBUG -g" CPPFLAGS="-fPIC -Wall -DDEBUG -g" -lpthread
             56
             57linux-release:
             58 $(MAKE) all INCS=-I"/usr/include" LIBS=-L"/usr/lib" CFLAGS="-fPIC -Wall -DNDEBUG -O2" CPPFLAGS="-fPIC -Wall -DNDEBUG -O2" -lpthread
             59
             60all:$(BIN)
             61
             62#$(OBJS):%.o :%.c  先用$(OBJS)中的一項,比如foo.o: %.o : %.c  含義為:試著用%.o匹配foo.o。如果成功%就等于foo。如果不成功,
             63# Make就會警告,然后。給foo.o添加依賴文件foo.c(用foo替換了%.c里的%)
             64# 也可以不要下面的這個生成規(guī)則,因為下面的 include $(DEF)  就隱含了。此處為了明了,易懂。故留著
             65$(COBJS) : %.o: %.c
             66 $(CC) -c $< -o $@ $(INCS) $(SOURCEINC) $(CFLAGS)
             67$(CPPOBJS) : %.o: %.cpp
             68 $(CPP) -c $< -o $@ $(INCS) $(SOURCEINC) $(CPPFLAGS)
             69
             70# $@--目標(biāo)文件,$^--所有的依賴文件,$<--第一個依賴文件。每次$< $@ 代表的值就是列表中的
             71#
             72
             73####################################
             74#最終鏈接目標(biāo)是.a(靜態(tài)庫)
             75$(BIN) : $(COBJS) $(CPPOBJS)
             76 ar r $@  $(COBJS) $(CPPOBJS) $(LIBS)
             77 ranlib $(BIN)
             78 -rm $(COBJS) $(CPPOBJS)
             79
             80####################################
             81#如果不加-fPIC,則加載.so文件的代碼段時,造成每個使用這個.so文件代碼段的進程在內(nèi)核里都會生成這個.so文件代碼段的copy.每個copy都不一樣,取決于 這個.so文件代碼段和數(shù)據(jù)段內(nèi)存映射的位置.
             82#使用-fPIC,則產(chǎn)生的代碼中,沒有絕對地址,全部使用相對地址,故而代碼可以被加載器加載到內(nèi)存的任意位置,都可以正確的執(zhí)行
             83#最終連接目標(biāo)是.so(動態(tài)庫)
             84#$(BIN) : $(COBJS) $(CPPOBJS)
             85#-shared -fPIC-o $(BIN) $(COBJS) $(CPPOBJS) $(LIBS)
             86#-rm $(COBJS) $(CPPOBJS)
             87
             88####################################
             89#最終鏈接目標(biāo)是可執(zhí)行文件
             90$(BIN) : $(COBJS) $(CPPOBJS)
             91 $(CPP) -o $(BIN) $(COBJS) $(CPPOBJS) $(LIBS)
             92 -rm $(COBJS) $(CPPOBJS)
             93# 鏈接為最終目標(biāo)
             94
             95
             96#引入了.o文件對.c和.h的依賴情況。以后.h被修改也會重新生成,可看看.d文件內(nèi)容即知道為何
             97#引入了依賴就相當(dāng)于引入了一系列的規(guī)則,因為依賴內(nèi)容例如: 目錄/xxx.o:目錄/xxx.c 目錄/xxx.h 也相當(dāng)于隱含的引入了生成規(guī)則
             98#故上面不能在出現(xiàn)如: $(OBJS) : $(DEF)之類。切記
             99#include $(CDEF) $(CPPDEF)
            100.PHONY:clean cleanall
            101
            102#清除所有目標(biāo)文件以及生成的最終目標(biāo)文件
            103clean:   
            104 -rm $(BIN) $(COBJS) $(CPPOBJS)
            105#rm *.d
            106cleanall:
            107 -rm $(BIN) $(COBJS) $(CPPOBJS)
            108
            109五、簡單makefile模板:只有一個.o文件
            110#/***
            111#
            112#Copyright 2006 bsmith@qq.com
            113#
            114#Licensed under the Apache License, Version 2.0 (the "License");
            115#you may not use this file except in compliance with the License.
            116#You may obtain a copy of the License at
            117#
            118#   http://www.apache.org/licenses/LICENSE-2.0
            119#
            120#Unless required by applicable law or agreed to in writing, software
            121#distributed under the License is distributed on an "AS IS" BASIS,
            122#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
            123#See the License for the specific language governing permissions and
            124#limitations under the License.
            125#
            126#*/

            127
            128============project================
            129PROJECT = db
            130AUTHOR = bsmith
            131HOME = .
            132=================================
            133
            134==============bin===================
            135TARGET = ../bin/db_d
            136===================================
            137
            138========================================
            139===========這里可以作為工程的include文件夾,所有的頭文件都可以放到這里===#
            140IFLAGS =  -I"../common/luainclude/" -I"../common/net/" -I"../common/base/" -I"../common/tool/"  -I"../common/" -I"../common/tool/mysql/" -I"../common/luainclude/LuaBridge" -I"../common/luainclude/LuaBridge/detail" -I"../common/Act/" -I"../common/luainclude/LLua"
            141===============config====================
            142CC = g++
            143CFLAGS = -w  -ldl -lrt -Wno-deprecated-declarations
            144LFLAGS =  ../common/lib/liblxnet.a   ../common/lib/libxml.a ../common/lib/libbaseframe.a ../common/lib/libjemalloc.a   ../common/lib/liblua52.a -lpthread -lmysqlclient
            145========================================
            146#maintest.c tree/rbtree.c  多了子目錄,那就直接添加 目錄/*.c即可   所有的源文件--  .c文件列表  
            147CSRCS = $(wildcard  ./*.c )  
            148CPPSRCS = $(wildcard ./*.cpp )
            149#所有的.o文件列表  
            150COBJS := $(CSRCS:.c=.o)  
            151CPPOBJS := $(CPPSRCS:.cpp=.o)  
            152
            153# args
            154# [args] 生成模式. 0代表debug模式, 1代表release模式. make ver=r.
            155ifeq ($(ver),r)
            156    # release
            157    CFLAGS +=  -O3
            158    TARGET = ../bin/db_r
            159else
            160 # debug
            161    CFLAGS += -g
            162endif
            163
            164# ==================compile====================
            165%.o : %.cpp 
            166  $(CC) -g -c $(CFLAGS) $(IFLAGS) $(LFLAGS) $< -o $@ 
            167 
            168all : bin
            169
            170bin : $(TARGET)
            171
            172$(TARGET) : $(OBJS)
            173 $(CC) $(CPPSRCS) -o $(TARGET) $(OBJS)  $(IFLAGS) $(LFLAGS) $(CFLAGS)
            174
            175install : $(TARGET)
            176  @cp $(TARGET) $(HOME)/bin/
            177  @ln -s $(HOME)/bin/$(TARGET) $(HOME)/bin/$(LINK) 
            178  
            179clean :
            180 @rm -f $(OBJS)
            181 @rm -f ../bin/$(TARGET)
            182 @rm -f $(HOME)/bin/$(TARGET)
            183 @rm -f $(HOME)/bin/$(LINK)
            184 @rm -f ./*.o
            185distclean:
            186 @rm -f ./bin/$(TARGET)
            187# ==========================================
            188
            189
            190 
            191


             

            posted on 2015-12-31 20:11 Benjamin 閱讀(3451) 評論(0)  編輯 收藏 引用 所屬分類: linux

            久久狠狠一本精品综合网| 国产成人精品久久| 亚洲精品无码久久不卡| 亚洲精品无码久久久| 久久综合中文字幕| 久久综合噜噜激激的五月天| 91亚洲国产成人久久精品| 国产午夜福利精品久久2021| 久久99精品久久久久久久久久| 日日狠狠久久偷偷色综合96蜜桃| 免费一级做a爰片久久毛片潮| 国内精品久久久久久久涩爱| 99久久www免费人成精品| 国产精品久久久久久久久免费 | 少妇高潮惨叫久久久久久| 久久人人爽人爽人人爽av| 国产高清美女一级a毛片久久w| 久久精品国产99久久丝袜| 久久国产精品久久精品国产| 久久久国产精品网站| 一个色综合久久| 18岁日韩内射颜射午夜久久成人| 无夜精品久久久久久| 国产精品久久久久久久久软件| 久久国产精品成人影院| 久久精品中文闷骚内射| 狠狠色噜噜狠狠狠狠狠色综合久久 | 久久精品国产亚洲AV嫖农村妇女 | 激情伊人五月天久久综合| 国产婷婷成人久久Av免费高清 | 国内精品久久久久影院亚洲| 色播久久人人爽人人爽人人片aV| 久久精品国产亚洲AV大全| 亚洲午夜无码AV毛片久久| 国产免费久久久久久无码| 一本久久a久久精品亚洲| 国产精品99久久久精品无码| 狠狠色婷婷久久综合频道日韩| 亚洲人成无码www久久久| 国产ww久久久久久久久久| 久久精品无码av|