• <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>

            牽著老婆滿街逛

            嚴以律己,寬以待人. 三思而后行.
            GMail/GTalk: yanglinbo#google.com;
            MSN/Email: tx7do#yahoo.com.cn;
            QQ: 3 0 3 3 9 6 9 2 0 .

            幾個好用的makefile 幾乎可以不用修改

            Makefile

            ?????? makefile 來編譯工程,對很多朋友來說都是一件麻煩而痛苦的事情,這里我寫了幾個 makefile ,專門提供給那些曾經(jīng)被 makefile 困擾的朋友,根據(jù)生成的目標文件不同,我將 makefile 分成了三份:生成可執(zhí)行文件的 makefile ,生成靜態(tài)鏈接庫德 makefile ,生成動態(tài)鏈接庫的 makefile 。

            ?????? 這些 makefile 都很簡單,一般都是一看就會用,用法也很容易,只需要把它們拷貝到你的代碼的同一目錄下,然后就可以使用 make 來生成目標文件了。

            ?????? 是不是真的有這么神奇?呵呵,你自己用用就知道了。

            ?????? 當然,如果要用到什么庫文件,你還需要修改一些編譯參數(shù),這個可以對照我轉(zhuǎn)載的另一篇文章《 GNU make 指南》。

            ?????? 下面是三個 makefile 的源代碼:

            ?

            ?????? 1 、生成可執(zhí)行文件的 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? := $(wildcard *.c) $(wildcard *.cpp)

            OBJS??? := $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCE)))

            ?

            #target you can change test to what you want

            # 目標文件名,輸入任意你想要的執(zhí)行文件名

            TARGET? := test

            ?

            #compile and lib parameter

            # 編譯參數(shù)

            CC????? := gcc

            LIBS??? :=

            LDFLAGS:=?

            DEFINES:=

            INCLUDE:= -I.

            CFLAGS? := -g -Wall -O3 $(DEFINES) $(INCLUDE)

            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 :

            ??? rm -fr *.so

            ??? rm -fr *.o

            ???

            veryclean : clean

            ??? rm -fr $(TARGET)

            ?

            $(TARGET) : $(OBJS)?

            ??? $(CC) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)

            ?

            ?????? 2 、生成靜態(tài)鏈接庫的 makefile

            ######################################

            #

            # 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? := libtest.a

            ?

            #compile and lib parameter

            # 編譯參數(shù)

            CC????? := gcc

            AR????? = ar

            RANLIB? = ranlib

            LIBS??? :=

            LDFLAGS:=?

            DEFINES:=

            INCLUDE:= -I.

            CFLAGS? := -g -Wall -O3 $(DEFINES) $(INCLUDE)

            CXXFLAGS:= $(CFLAGS) -DHAVE_CONFIG_H

            ?

            #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)?

            ??? $(AR) cru $(TARGET) $(OBJS)

            ??? $(RANLIB) $(TARGET)

            ?

            ?????? 3 、生成動態(tài)鏈接庫的 makefile

            ######################################

            #

            # 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)

            posted on 2007-02-08 15:34 楊粼波 閱讀(830) 評論(0)  編輯 收藏 引用

            久久精品国产99久久丝袜| 久久久久女人精品毛片| 国产伊人久久| 久久精品国产日本波多野结衣| 97久久国产露脸精品国产| 91精品国产综合久久精品| 99久久国产综合精品网成人影院 | 久久综合狠狠综合久久激情 | 99久久久久| 亚洲国产精品无码久久一线| 久久国产精品-国产精品| 久久综合色区| 欧美一区二区精品久久| 亚洲综合伊人久久综合| 久久97久久97精品免视看| av无码久久久久不卡免费网站 | 久久丫精品国产亚洲av| 久久精品国产亚洲5555| 99精品久久久久中文字幕| 伊人久久大香线蕉亚洲五月天| 久久se精品一区二区影院| 9久久9久久精品| 无码人妻少妇久久中文字幕蜜桃| 狠狠人妻久久久久久综合| 久久96国产精品久久久| 国产精品久久久久AV福利动漫| 久久婷婷色综合一区二区| 久久精品国产亚洲7777| 99久久国产主播综合精品| 国产精品久久久久久福利漫画| 久久香蕉超碰97国产精品| 精品综合久久久久久98| 国产精品一区二区久久精品涩爱 | 亚洲成色WWW久久网站| 无码任你躁久久久久久| 久久久久久一区国产精品| 久久99精品久久久久久野外| 国产成人无码精品久久久久免费| 伊人久久精品线影院| 国产精品九九久久精品女同亚洲欧美日韩综合区 | 午夜精品久久久久久毛片|