随笔-57  评论-12  文章-0  trackbacks-0
 

今天看到一道让我很无语的高三综合题,发上来给大伙娱乐娱乐:
 
 
 一只熊掉进一个洞里,下落2秒到了洞底,下落路程共20米,问这只熊什么颜色?高考综合卷的!(答案见下面,字体为白色,拖动鼠标选中即可见)
 

 
 
解答如下:
 
           熊的下落过程是自由落体降落。
           H = 1/2 * g * t^2 (其中^2表示平方运算)
          以 H = 20 米,t=2秒 代入 求得 g = 10 m/s^2
          重力加速度的规律是在赤道附近最小,约9.8m/s^2,而在两极最大,约 10m/s^2根据计算出的加速度 g 的数值,可以推算出 熊所在的地理位置是在两极。
          由于在地球两极,南极没有熊而只有北极有熊,所以这只熊是北极熊。而北极熊是白色的。也就是这个倒霉的熊是白色的。
          这个熊掉进20米深的洞后,摔死与否是不确定的,即使摔死,也是震坏内脏,而不会流出很多的血。所以 说熊是红色的,这种说法是不科学的。
posted @ 2006-04-14 11:19 Martin 阅读(185) | 评论 (0)编辑 收藏
From: http://academy2003.cpst.net.cn/popul/computer/enets/artic/50617134343.html

Google搜索引擎另类使用技巧
2005-06-17 13:43:43 李东博
 
  你可能每天都要使用很多遍Google这个搜索引擎站点,下面的这种新鲜玩法你听说过吗?

  网上总会有许多人共享出一些不受保护的音乐文件目录(可称之为“开放目录”),使用在Google中输入以下关键词,就会列出大量的音乐文件目录列表。

  -inurl:htm -inurl:html intitle:"index of" mp3

   在以上字符串中我们用到了“index of”和inurl命令,作用是只列出目录。最后的关键词“mp3”告诉Google在这些目录中搜索mp3音 乐文件。当然,不止可以搜索mp3,还可以将关键词改为“wma”、“ogg”、“avi”等,这样就可以搜索到不同的音乐或视频文件。

  更进一步,比如你要搜索有关网页设计的内容,可以将最后的关键词改为“网页设计”。如果想搜索一些学习的教程,则改为“教程”。也可以指定两个或以上的关键词,比如:

  -inurl:htm -inurl:html intitle:"index of" photoshop 教程

  或者,比如要搜布兰妮的mp3歌曲,则可以如下输入:

  -inurl:htm -inurl:html intitle:"index of" mp3 "britney spears"

  再比如,搜索李连杰的电影(avi格式的),可以输入:

  -inurl:htm -inurl:html intitle:"index of" avi "jet li"

posted @ 2006-04-14 09:16 Martin 阅读(129) | 评论 (0)编辑 收藏
From: http://zhidao.baidu.com/question/1032551.html


已解决
index of xxx
悬赏分:5 - 解决时间:2005-11-12 23:37
比喻说我在百度搜索index of doc,它就会搜索出关于.doc的所有文件,类似的命令还有那些啊??
请教各位大侠!!!
提问者: cyb_007 - 童生 一级
最佳答案
找专业报告

很多情况下,我们需要有权威性的,信息量大的专业报告或者论文。比如,我们需要了解中国互联网状况,就需要找一个全面的评估报告,而不是某某记者 的一篇文章;我们需要对某个学术问题进行深入研究,就需要找这方面的专业论文。找这类资源,除了构建合适的关键词之外,我们还需要了解一点,那就是:重要 文档在互联网上存在的方式,往往不是网页格式,而是Office文档或者PDF文档。Office文档我们都熟悉,PDF文档也许有的人并不清楚。PDF 文档是Adobe公司开发的一种图文混排电子文档格式,能在不同平台上浏览,是电子出版的标准格式之一。多数上市公司的年报,就是用PDF做的。很多公司 的产品手册,也以PDF格式放在网上。

百度以“filetype:”这个语法来对搜索对象做限制,冒号后是文档格式,如PDF、DOC、XLS等。

例:霍金 黑洞 filetype:pdf




返回页首

找论文

找论文网站 网上有很多收集论文的网站。先通过搜索引擎找到这些网站,然后再在这些网站上查找自己需要的资料,这是一种方案。找这类网站,简单的用“论文”做关键词进行搜索即可。
例:论文

直接找特定论文 除了找论文网站,我们也可以直接搜索某个专题的论文。看过论文的都知道,一般的论文,都有一定的格式,除了标题、正文、附录,还需要有论文关键词,论文摘要等。其中, “关键词”和“摘要”是论文的特征词汇。而论文主题,通常会出现在网页标题中。

例:关键词 摘要 intitle:物流



返回页首

找范文

写应用文的时候,找几篇范文对照着写,可以提高效率。

找市场调查报告范文 市场调查报告的网页,有几个特点。第一是网页标题中通常会有“xxxx调查报告”的字样;第二是在正文中,通常会有几个特征词,如“市场”、“需求”、“消费”等。于是,利用intitle语法,就可以快速找到类似范文。
例:市场 消费 需求 intitle:调查报告

找申请书范文 申请书有多种多样,常见的比如入党申请书。申请书有一定的格式,因此只要找到相应的特征词,问题也就迎刃而解。比如入党申请书的最明显的特征词就是“我志愿加入中国共产党”。
例:我志愿加入中国共产党 入党申请书

找工作总结范文 还是那个关键问题,工作总结会有什么样的特征词?将心比心的设想一下,就会发现,工作总结,总会写的象八股文一样,“一、二、三”,“第一,第二,第 三”,“首先,其次,最后”。而且工作总结的标题中,通常会出现“工作总结”四个字,于是,问题就很好解决了:
例:第一 第二 第三 intitle:工作总结
参考资料:http://www.baidu.com/search/skill.html#07
posted @ 2006-04-13 22:52 Martin 阅读(412) | 评论 (0)编辑 收藏
搜索Google大家都用过吧?我们正是利用它强劲的搜索功能来突破封锁下载,Google搜索和限制下载有什么关系,没可能实现吧?不要不相信哦,往下看哦!

http://www.google.com/intl/zh-CN/
http://www.3721.com/
http://www.baidu.com/

 首先打开Google,在关键词输入框中输入“index of/“inurl:lib(双引号为英文状态下),选择“搜索简体中文网页”选项,回车搜索,得到了一些网页,不要以为这是一些普通的页面,其实它们是 一些图书网站的资源列表,点击打开它来看看,怎么样?是不是所有资源一收眼底了?

使用其他关键字可能得到更多的资源:

在搜索框上输入:“index of /“cnki

再按搜索你就可以找到许多图书馆的CNKI、VIP、超星等入口!

在搜索框上输入:“index of /“ ppt

再按搜索你就可以突破网站入口下载powerpint作品!

在搜索框上输入:“index of /“mp3

再按搜索你就可以突破网站入口下载mp3、rm等影视作品!

在搜索框上输入:“index of /“swf

再按搜索你就可以突破网站入口下载flash作品!

在搜索框上输入:“index of /“加上要下载的软件名

再按搜索你就可以突破网站入口下载软件!

在搜索框上输入:“index of /“AVI

再按搜索你就可以突破网站入口下载AVI视频

你会找到什么呢?同理,把AVI换为MPEG看看又会找到什么呢?呵呵!接下来不用我再教了吧?那就试一下你的手气吧!

“index of /“ RMVB
“index of /“ WMA
“index of /“ MTV
“index of /“ MPEG
 以下是百度搜索排名
1. index of mpeg4
3. index of mp3
4. index of cnki
5. index of rmvb
6. index of rm
7. index of movie
8. index of swf
9. index of jpg
10. index of admin
12. index of pdf
13. index of doc
14. index of wmv
15. index of mdb
16. index of mpg
17. index of mtv
18. index of software
19. index of mov
20. index of asf
23. index of lib
24. index of vod
25. index of rar
27. index of exe
28. index of iso
29. index of video
30. index of book
31. index of soft
32. index of chm
33. index of password
34. index of game
35. index of music
36. index of dvd
37. index of mid
38. index of ebook
40. index of download

到这里,大家也许都明白了,其实就是“index of /“这个关键词在起的作用,使用它可以直接进入网站首页下的所有文件和文件夹中,不必在通过HTTP的网页形式了,从而避免了那些网站的限制,作到了突破限制下载。

怎么回事?点鼠标右键直接用网际快车下不了,都是网页,链接地址是乱码。别灰心懈气,可以在新窗口中打开页面中的超链接,真实地址不就出来了。下面就用马克思ie(mxie)这个超级P2P共享资源搜索引擎帮你搞定收费网站。
马克思ie简体中文网址:http://cn.mxie.com/down.html
http://cn.mxie.com/mxie0400Setup_cn.exe

马克思ie(mxie)
软件大小:3307KB
软件语言:简体中文
软件类别:国产软件/免费版/搜寻引擎
运行环境:Win9x/Me/NT/2000/XP
 马克思ie(mxie)是一个拥有网页浏览器功能的超级P2P搜索引擎,完全免费!各种音乐、电影、动漫、小说、图片等娱乐文件,一切你想得到的都可以找 到!采用目前最为先进的多点P2P技术,搜寻到的就能下载到,绝对无死链!神奇的“越多人下载越高速”特性,充分挖掘你的带宽潜力,保证高速!独家装备了 强力防火墙穿透利器,即使在严密防护的企业防火墙后也能通行自如。
完全免费,永远免费!
完全免费!永远免费!马克思ie(mxie)就是要把免费进行到底!奉行网络上的马克思主义,打造影音娱乐共产帝国!

编者自述:此方法采用独特技巧,集成了网络加速及穿透防火墙的P2P共享技术,能够无限提升你的网速!----高手自然一点就透,对于菜鸟本人也不想浪费唇舌多作解释,以下跟着洒家向前冲:

先下一个exe文件合成器“绿色分割{X} V3.1”:
http://www.pcdog.com/soft/20205.htm
http://www1.pcdog.com/down/Split3.1.rar

解压到指定文件夹。再下一个加速软件“speed4web”:
Speed4WEB 可以帮忙你把浏览器的速度提升到原来的300%!程序使用简单,提交小巧!功能强大!
Speed4WEB V2.2.3.2 汉化版:
http://www.yqdown.com/soft/675.htm
http://km.yqdown.com:8989/UUAuth/wlgj/Speed4WEB_v2.H.rar
http://www2.pcdog.com/down4/HB_Speed4WEBV2.2.3.2.exe
http://www.pcdog.com/down2/HB_Speed4WEBV2.2.3.2.exe

解压安装后点击桌面图标打开,在所有选项前均打勾(除了“总在顶部”),最小化令其运行。
点桌面图标右键,点属性,点查找目标,找出其真实应用文件“Speed4WEB.exe”,将它复制到指定文件夹。

选择你最想加速的文件***:点桌面图标右键,点属性,点查找目标,找出其真实应用文件“***.exe”,复制到指定文件夹。

 双击打开绿色分割,点“合并”,点“合并任意文件”,点+号依次选择“***.exe、Speed4WEB.exe”,点“设置”,点“正常、分割完成后 生成合并exe文件”,点“保存文件”选择***文件原路径,重命名为“***.exe”,点开始即可替换原“***.exe”。

注意:合并过程中***软件不可使用,否则无法成功替换原***文件!也不可以关闭Speed4WEB!

再下一个共享资源搜索利器“马克思ieV.0.4.0.0 最新版--
马克思ie简体中文网址:http://cn.mxie.com/down.html
http://cn.mxie.com/mxie0400Setup_cn.exe

 解压双击安装后,以“马克思ie(mxie)”为例,下载后重命名为“马克思ie(mxie).exe”即可直接双击安装,点桌面上刚刚生成的”马克思 ie(mxie)”图标右键,点属性,点查找目标,找出其真实应用文件“mxie.exe”,复制到指定文件夹。下面按步就搬即可。

以上方法经本人测试,适合于各式各样五花八门的下载工具、游戏、浏览器以及其它一切与网络相关的软件。----这种合成的软件同时运行的越多,网速愈快!

每个人上网的方式与宽带限制都不一样,有时候是电信局封了BT端口或用了扫描仪限制下载流量,请恕本人也无能为力了!用过马克思ie的朋友仍然嫌慢的话,请打上下面的补丁

最新上传漏洞通用工具 V1.0
http://soft.sq88.com/soft/537.htm
http://download.sq88.com/hk/upld.rar

动网下载中心上传漏洞利用工具
http://soft.sq88.com/soft/419.htm
http://download.sq88.com/hk/dvup.rar

任意下载其中一个后门程序,解压后即可见其中的两个ActiveX控件“MSINET.OCX、MSWINSCK.OCX”,然后再用绿色分割合并即可。

好了,废话少说。觉得有用请顶一下,并帮我多多转贴,别小心眼偷懒呀!
当网上有半数人熟悉此法时,估计收费网站也要破产了!

楼下的朋友看不懂么?我晕。后缀名为.exe的文件,下载后可重命名***.exe,直接双击安装即可,而不是用RAR解压,这个难道还用问我?压缩包中的绿色分割放进RAR解压,其后缀名已经是“Split3.1.exe“,直接从压缩包中拖出来即可双击使用。
posted @ 2006-04-13 22:08 Martin 阅读(1057) | 评论 (1)编辑 收藏
     摘要: CVS 常用命令 1.        CVS ...  阅读全文
posted @ 2006-04-13 21:55 Martin 阅读(1258) | 评论 (1)编辑 收藏
     摘要: CVS 管理                            --- 以本次建立的 CVS 系统为例 ...  阅读全文
posted @ 2006-04-13 21:54 Martin 阅读(490) | 评论 (0)编辑 收藏
1. Difference among Different Platforms

1) Different compilers ( pls read the makefiles of hspice)

2) Create a lib

Normally:
$(AR) $(TARGET_LIB) %.o

Exception: (while create C++ lib)

SunOS :
$(CXX) -xar -o $(TARGET_LIB) %.o
SGI:
$(CXX) -ar -o $(TARGET_LIB) %.o

Explanation :

SunOS :
-xar Creates archive libraries.

When building a C++ archive that uses templates,
it is necessary in most cases to include in the
archive those template functions that are instan-
tiated in the template repository. Using this
option automatically adds those templates to the
archive as needed.

Examples:

The following command archives the template func-
tions contained in the repository and the object
files.

example% CC -xar -o libmain.a a.o b.o c.o

Warnings:

Do not add .o files from the template repository
on the command line.

Do not use the ar command directly for building
archives. Use CC -xar to ensure that template
instantiations are automatically included in the
archive.

SGI:
-ar may be the same.

3) C++

1) Include head files
HP-UX & SGI :
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
Others :
#include <iostream>
#include <fstream>
#include <iomanip>

2) using namespace std;
HP-UX does not support namespace.

3) On ALPHA & IBM, the fstream class has no the following constructor:

fstream(int fd);

2. Mixed Language Program

1) Function Name Modification among C, FORTRAN and C++

Focus on file src_metaq/ftnc.h:

Linux,PC,HP,IBM :
#define FTNC(f) f

SUN,SGI :
#ifdef __STDC__ /* Ansi C */
#define FTNC(f) f##_
#else
#define FTNC(f) f_
#endif

ALPHA :
#define FTNC(f) f##_

#define FCALL(f) FTNC(f)

2) extern "C"
In C++ program,use this to compile C++ function or others to C format.
Thus,C can call C++ function,and C++ can call C function.

Examples:

extern "C" void foo1(void);
extern "C" int FTNC(foo2)(void);

extern "C"
{
void foo1(void);
int FTNC(foo2)(void);
...
}

extern "C"
{
#include "foo1.h"
#include "foo2.h"
...
}

3) FORTRAN call C, C++ (UNIX)

C: void FTNC(foo)(int *,double*);
F: external foo
call foo(...)

C++: extern "C" void FTNC(foo)(int*,double*);
F: external foo
call foo(...)

4) C,C++ call FORTRAN (UNIX)

F: subroutine foo(...)

C: void FTNC(foo)(...)
FTNC(foo)(...);

C++:extern "C" FTNC(foo)(...)
FTNC(foo)(...);

3.PC Porting

1) FORTRAN call C, C++
Focus on src_header/refs.dek ( Only used on PC )

Should include header file refs.dek in fortran files.

C: void FTNC(foo1)(int *arg1,double *arg2,char *arg3);
int FTNC(foo2)(int *arg1,double *arg2,char *arg3);

In refs.dek:

INTERFACE TO SUBROUTINE foo1
+ [C,ALIAS:'_foo1'] (arg1,arg2,arg3)
INTEGER*4 arg1 [REFERENCE]
DOUBLE PRECISION arg2 [REFERENCE]
CHARACTER*8 arg3 [REFERENCE]
END

INTERFACE TO INTEGER*4 FUNCTION foo2
+ [C,ALIAS:'_foo2'] (arg1,arg2,arg3)
INTEGER*4 arg1 [REFERENCE]
DOUBLE PRECISION arg2 [REFERENCE]
CHARACTER*8 arg3 [REFERENCE]
END

F: external foo1
external foo2
integer foo2

call foo1(...)
ret=foo2(...)

2) C, C++ call FORTRAN
Focus on src_header/fortran2c.h

F: subroutine foo(a,b)
integer*4 a
double precision b

i) C: #define foo FTNC(FOO)
extern foo(); (default cdecl)
foo(...);

ii)C: #define foo FTNC(FOO)
extern __stdcall void foo(int *a,double *b)

foo(...);

3) C, C++ call FORTRAN (Special Case)
F: subroutine foo(a,b)
integer*4 a
character b

C: extern __stdcall void foo(int *a,char *b,char *b1)

Explanation:
Fortran : _foo@nn (nn -- length of stack)
C : : -foo@mm (mm -- length of stack)
mm should equal nn.
But in Fortran: charactor --> 8 bytes
in C, C++: char * --> 4 bytes

So,double char * to supply 8 bytes

posted @ 2006-04-13 17:49 Martin 阅读(386) | 评论 (0)编辑 收藏
                  Makefile Introduction (SunOS platform as example)

1. A simple Makefile

EXE = foo
SRC = foo.cc
OBJ = foo.o

CC = /SunOS/5.7/SUNWspro_6.0.OLD/WS6U1/bin/CC
FLAG = -g

$(EXE):$(OBJ)
$(CC) $(FLAG) $^ -o $@

$(OBJ):$(SRC)
$(CC) $(FLAG) -c $< -o $@

2. How to use the Makefile

/usr/ccs/bin/make [ -d ] [ -dd ] [ -D ] [ -DD ] [ -e ]
[ -i ] [ -k ] [ -n ] [ -p ] [ -P ] [ -q ] [ -r ] [ -s ]
[ -S ] [ -t ] [ -V ] [ -f makefile ] ...
[ -K statefile ] ... [ target ... ] [ macro = value ... ]

/usr/xpg4/bin/make [ -d ] [ -dd ] [ -D ] [ -DD ] [ -e ]
[ -i ] [ -k ] [ -n ] [ -p ] [ -P ] [ -q ] [ -r ] [ -s ]
[ -S ] [ -t ] [ -V ] [ -f makefile ] ... [ target... ]
[ macro = value ... ]

-e : Environment variables override assignments within makefiles.

-f makefile : Uses the description file makefile.

-i : Ignores error codes returned by commands.

-k : When a nonzero error status is returned by a rule,
or when make cannot find a rule, abandons work on
the current target, but continues with other
dependency branches that do not depend on it.

-n : No execution mode.

3. Special Characters in Makefle

# -- Start a comment
For example :
#This is a makefile

inlcude filename -- include a file
For example :
include make.sun57.inc

: -- Target list terminator
For example :
foo.o:foo.c foo.h

:: -- Target terminator for alternate dependencies
For example :
foo.o::foo.c foo.h

% -- Pattern matching wild card metacharacter
For example :
%.o:%.c

4. Macros

= -- Macro definition
For example :
CC=/SunOS/5.7/SUNWspro_6.0.OLD/WS6U1/bin/CC

+= appends a string to a macro definition
For example :
A=dir
B=bin
A+=$(B)

result : $(A) == dir bin

:= Conditional macro assignment
For example :
A=dir
B:=$(A)
A=bin

result : $(B) == dir

$ -- Macro reference
For example :
$(A),$(B)

( ),{ } -- Macro-reference name delimiters
For example :
$(A),${B}

$$ -- A reference to the dollar-sign macro
For example :
echo $$

result : $

\$ -- Escaped dollar-sign character

5. Rules

1) Special characters

+ -- always execute the commands
For example :
+echo hello

- -- ignores any nonzero error code returned by a command line
For example :
-echo hello

@ -- does not print the command line before executing it
For example :
@echo hello

? -- Escape command-dependency checking

! -- Force command-dependency checking

2) Dependency

foo.o:foo.c foo.h foo1.h
$(CC) $(FLAG) -c foo.c -o foo.o

3) Special macros

$@, $*, $(@D), $(@F) $^, $<, $?, $%
$(MAKE)...

$@ -- The name of the current target

$* -- The basename of the current target

$(@D) -- The directory part of the string `$@'
if there is no directory part, `.' is assigned

$(@F) -- The file name of '$@'

$^ -- All a dependency files

$< -- The name of the first dependency files

$? -- The list of dependencies that are newer than the target

$% -- The name of the library member being processed

$(MAKE) -- It has the value make by default, and temporarily
overrides the -n option for any line in which it is
referred to.

example :
../lib/liba.a:a.o b.o c.o d.o
@(AR) $@ $^

result :
$@ --> ../lib/liba.a
$* --> ../lib/liba
$(@D) --> ../lib
$($F) --> liba.a
$^ --> a.o b.o c.o d.o
$< --> a.o
$? --> b.o d.o (if b.o and d.o are newer than ../lib/liba.a)

example :
lib(member...):...

lib(a.o b.o c.o):a.o b.o c.o
$% --> a.o b.o c.o (lib(...))

4) Predefined Macros and Implicit Rules (Partly)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Table of Predefined Macros
Use Macro Default Value
______________________________________________________________________
Library AR ar
Archives ARFLAGS rv
______________________________________________________________________
Assembler AS as
Commands ASFLAGS
COMPILE.s $(AS) $(ASFLAGS)
COMPILE.S $(CC) $(ASFLAGS) $(CPPFLAGS) -c
______________________________________________________________________
C CC cc
Compiler CFLAGS
Commands CPPFLAGS
COMPILE.c $(CC) $(CFLAGS) $(CPPFLAGS) -c
LINK.c $(CC) $(CFLAGS) $(CPPFLAGS)
$(LDFLAGS)
______________________________________________________________________
C++ CCC CC
Compiler CCFLAGS CFLAGS
Commands CPPFLAGS
COMPILE.cc $(CCC) $(CCFLAGS) $(CPPFLAGS) -c
LINK.cc $(CCC) $(CCFLAGS) $(CPPFLAGS)
$(LDFLAGS)
COMPILE.C $(CCC) $(CCFLAGS) $(CPPFLAGS) -c
LINK.C $(CCC) $(CCFLAGS) $(CPPFLAGS)
$(LDFLAGS)
______________________________________________________________________
FORTRAN 77 FC f77
Compiler FFLAGS
Commands COMPILE.f $(FC) $(FFLAGS) -c
LINK.f $(FC) $(FFLAGS) $(LDFLAGS)
COMPILE.F $(FC) $(FFLAGS) $(CPPFLAGS) -c
LINK.F $(FC) $(FFLAGS) $(CPPFLAGS)
$(LDFLAGS)
______________________________________________________________________
FORTRAN 90 FC f90
Compiler F90FLAGS
Commands COMPILE.f90 $(F90C) $(F90FLAGS) -c
LINK.f90 $(F90C) $(F90FLAGS) $(LDFLAGS)
COMPILE.ftn $(F90C) $(F90FLAGS) $(CPPFLAGS) -c
LINK.ftn $(F90C) $(F90FLAGS) $(CPPFLAGS)
$(LDFLAGS)
______________________________________________________________________
Link Editor LD ld
Command LDFLAGS
______________________________________________________________________
lex LEX lex
Command LFLAGS
LEX.l $(LEX) $(LFLAGS) -t
______________________________________________________________________
lint LINT lint
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



_______________________________________________________________
| Table of Standard |
| Implicit (Suffix) |
| Rules for C Files |
| Implicit Rule Name| Command Line |
|___________________|_________________________________________|
| .c | $(LINK.c) -o $@ $< $(LDLIBS) |
| | |
| .c.ln | $(LINT.c) $(OUTPUT_OPTION) -i $< |
| | |
| .c.o | $(COMPILE.c) $(OUTPUT_OPTION) $< |
| | |
| .c.a | $(COMPILE.c) -o $% $< |
| | $(AR) $(ARFLAGS) $@ $% |
| | $(RM) $% |
| .cc | $(LINK.cc) -o $@ $< $(LDLIBS) |
| | |
| .cc.o | $(COMPILE.cc) $(OUTPUT_OPTION) $< |
| | |
| .cc.a | $(COMPILE.cc) -o $% $< |
| | $(AR) $(ARFLAGS) $@ $% |
| | $(RM) $% |
| .f | $(LINK.f) -o $@ $< $(LDLIBS) |
| | |
| .f.o | $(COMPILE.f) $(OUTPUT_OPTION) $< |
| | |
| .f.a | $(COMPILE.f) -o $% $< |
| | $(AR) $(ARFLAGS) $@ $% |
| | $(RM) $% |
_______________________________________________________________


6. Reading Makefiles and the Environment

When make first starts, it reads the MAKEFLAGS environment
variable to obtain any of the following options specified
present in its value: -d, -D, -e, -i, -k, -n, -p, -q, -r,
-s, -S, or -t. Due to the implementation of POSIX.2 (see
POSIX.2(5), the MAKEFLAGS values will contain a leading `-'
character. The make utility then reads the command line
for additional options, which also take effect.

Next, make reads in a default makefile that typically con-
tains predefined macro definitions, target entries for
implicit rules, and additional rules, such as the rule for
retrieving SCCS files. If present, make uses the file
make.rules in the current directory; otherwise it reads the
file /usr/share/lib/make/make.rules, which contains the
standard definitions and rules. Use the directive:

include /usr/share/lib/make/make.rules
in your local make.rules file to include them.

Next, make imports variables from the environment (unless
the -e option is in effect), and treats them as defined mac-
ros. Because make uses the most recent definition it
encounters, a macro definition in the makefile normally
overrides an environment variable of the same name. When -e
is in effect, however, environment variables are read in
after all makefiles have been read. In that case, the
environment variables take precedence over definitions in
the makefile.

Next, make reads any makefiles you specify with -f, or one
of makefile or Makefile as described above and then the
state file, in the local directory if it exists. If the
makefile contains a .KEEP_STATE_FILE target, then it reads
the state file that follows the target. Refer to special
target .KEEP_STATE_FILE for details.

Next (after reading the environment if -e is in effect),
make reads in any macro definitions supplied as command
line arguments. These override macro definitions in the
makefile and the environment both, but only for the make
command itself.

make exports environment variables, using the most recently
defined value. Macro definitions supplied on the command
line are not normally exported, unless the macro is also an
environment variable.

make does not export macros defined in the makefile. If an
environment variable is set, and a macro with the same name
is defined on the command line, make exports its value as
defined on the command line. Unless -e is in effect, macro
definitions within the makefile take precedence over those
imported from the environment.

Simply :
make --> Reads MAKEFLAGS environment variable to obtain the
following options :
-d, -D, -e, -i, -k, -n, -p, -q, -r, -s, -S, or -t

--> Reads in a default makefile, contains :
Predefined macros
Target entries for implicit rules
Additional rules
Default makefile :
make.rules in current directory
if no,/usr/share/lib/make/make.rules
in make.rules in current directory will include
/usr/share/lib/make/make.rules

--> Imports environment variables as defined macros.
if no -e,macros defined in makefile will override
the environment variables(same names)
if -e, exchange

--> Reads makefile specified by -f,
or Makefile(makefile) in current directory.

--> Reads in macro definitions supplied as command line.
Overrides both Environment variables and macros
defined in makefile,even if -e is supplied.

--> Exports environment variables,using the most recently
value.

Note :
Macros override sequence :
The later override the previous.

7. Advanced Macro Definitions

1) CSRC=$(wildcard *.c)

2) $(name:str1=str2)
For example :
CSRC=a.c b.c c.c
OBJS=$(CSRC:.c=.o)

result: $(OBJS)==a.o b.o c.o

3) OBJS=$(patsubst %.c,%.o,$(CSRC))
For example :
CSRC=a.c b.c c.c

result: $(OBJS)==a.o b.o c.o

CC=$(patsubst $(CC),$(CC_DBG),$(CC))
replace the value of CC with the value of CC_DBG

(patsubst or subst)

4) OBJS=$(addprefix ../obj/,$(CSRC:.c=.o))
For example :
CSRC=a.c b.c c.c

result: $(OBJS)==../obj/a.o ../obj/b.o ../obj/c.o

4) $(name: op%os= np%ns)
(op--old prefix,os--old suffix,
np--new prefix,ns--new suffix)
For example :
name=MMandGG
name1=$(name:MM%GG=GG%MM)

result: $(name1) == GGandMM

name=and
name1=$(name:%=MM%GG)

result: $(name1) == MMandGG

8. Phony Targets
1)
.PHONY:all

all:exe1 exe2

Note:want to build two binaries:exe1 exe2,
and exe1 and exe2 is separate.
all does not exist,make will try to update this rule,
so,make try to check exe1 and exe2 if they want to be updated.

2)
.PHONY:release debug
release:
...

debug:
...

release and debug have no dependency,so it will not execute until
use "make release" or "make debug"

but,make's default is the first phony target:
if release is the first,"make" means "make release"

The dependency does not exist,

9. Control Structure

1) Jump

release:
@$(MAKE) A=dir \
B=bin compile

compile:
...
...

2) if
if [ ! -d $(@D) ]; then $(MK_DIR) $(@D); fi

3) for
compile:
@for dir in $(SUBDIRS); do \
if [ -d $$dir ]; then \
(cd $$dir; echo build in $$dir;$(MAKE) compile;) \
else echo not build in $$dir; fi \
done

4) Command Macro definition

define MKDIR
if [ ! -d $(@D) ]; then $(MK_DIR) $(@D); fi
endef

usage: $(MKDIR)

10. A Makefile Example

#
# --> ***Makefile** <-- #
#

BIN = bin
OBJ = obj
RLS = rls
DBG = dbg

OBJS = $(addprefix $(OBJ)/$(RLS)/,$(CCSRCS:.cc=.o))

BINDIR = $(BIN)/$(RLS)
OBJDIR = $(OBJ)/$(RLS)

RM = rm -rf
CP = cp -p
MV = mv
MK_DIR = mkdir -p
AR = /usr/local/bin/ar cq

CC_RE = /SunOS/5.7/SUNWspro_6.0.OLD/WS6U1/bin/CC
CCFLAGS_RE = -fast -xarch=v9 -DNDEBUG

CC_DBG = $(CC_RE)
CCFLAGS_DBG = -g

#############define mkdir macro#############
define MKDIR
if [ ! -d $(@D) ]; then $(MK_DIR) $(@D); fi
endef

define MKOBJDIR
if [ ! -d $(OBJ)/$(RLS) ]; then $(MK_DIR) $(OBJ)/$(RLS); fi
endef

define MKLIBDIR
if [ ! -d $(LIBDIR)/$(RLS) ]; then $(MK_DIR) $(LIBDIR)/$(RLS); fi
endef

define MKBINDIR
if [ ! -d $(BIN)/$(RLS) ]; then $(MK_DIR) $(BIN)/$(RLS); fi
endef

################make release################
release:
@$(MAKE) CC='$(subst $(CC),$(CC_RE),$(CC))' \
CC_OPT='$(subst $(CC_OPT),$(CCFLAGS_RE),$(CC_OPT))' compile

################make debug##################
debug:
@$(MAKE) CC='$(subst $(CC),$(CC_DBG),$(CC))'\
CC_OPT='$(subst $(CC_OPT),$(CCFLAGS_DBG),$(CC_OPT))'\
RLS='$(subst $(RLS),$(DBG),$(RLS))' compile

##################compile###################
compile:
ifdef SUBDIRS
@for dir in $(SUBDIRS); do \
if [ -d $$dir ]; then \
(cd $$dir; echo build in $$dir;$(MAKE) compile;) \
else echo not build in $$dir; fi \
done
else
@$(MKDIR)
@$(MKOBJDIR)
ifdef EXECUTE
@$(MKDIR)
@$(MKBINDIR)
@$(MAKE) build_bin
else
@$(MKDIR)
@$(MKLIBDIR)
@$(MAKE) build_dir
endif
endif

build_bin:$(BINDIR)/$(EXECUTE)
@echo finished building $(BINDIR)/$(EXECUTE)

build_dir:$(LIBDIR)/$(RLS)/$(LIB)
@echo finished building $(LIBDIR)/$(LIB)

$(LIBDIR)/$(RLS)/$(LIB):$(OBJDIR)/$(LIB)
$(RM) $(LIBDIR)/$(RLS)/$(LIB)
$(CP) $(OBJDIR)/$(LIB) $(LIBDIR)/$(RLS)

$(OBJDIR)/$(LIB):$(OBJS)
# $(CC) -xar -o $(OBJDIR)/$(LIB) $(OBJS)
$(AR) $(OBJDIR)/$(LIB) $(OBJS)

#$(OBJDIR)/%.o:%.cc
$(OBJS):$(CCSRCS)
$(CC) $(CC_OPT) $(INCDIR) -c $< -o $@

$(BINDIR)/$(EXECUTE):$(OBJS)
$(CC) $(CC_OPT) $^ $(LINKLIB) -o $@

##################make clean###################
define CLEAN
if [ -d $(OBJ) ]; then (echo $(RM) $(OBJ); $(RM) $(OBJ);)fi
if [ -d $(BIN) ]; then (echo $(RM) $(BIN); $(RM) $(BIN);)fi
endef

clean:
ifdef SUBDIRS
@for dir in $(SUBDIRS); do \
if [ -d $$dir ]; then \
(cd $$dir; echo make clean in $$dir; $(MAKE) clean;) \
else echo not make clean in $$dir; fi \
done
else
@$(CLEAN)
endif

# --> **end of Makefile** <-- #
posted @ 2006-04-13 17:46 Martin 阅读(697) | 评论 (0)编辑 收藏
    It was a long time before I decided to write something. I even feel a little nervous. What to write, technique, work experience, my life, or something else? Maybe all of them are good written materials. First of all, I think I should write something about my work experiences. A path I have walked but not looked back in real earnest. Then, I should sum up what I have learned. It’s also a big task. It’s not to say I learned much, on the contrary, it’s a hard work for me. How can I write something about nothing? As to my life, it’s very bald except when I stay together with my friends.  Maybe I can succeed in writing my life into books. Hum, just a clumsy joke.
   
    From now on, I will look back my work experience. And at the same time, I will also record what I have learned and what I am learning. Happiness, sadness in my life will be also added in.
   
    Ok, let’s go!
posted @ 2006-04-13 09:47 Martin 阅读(177) | 评论 (0)编辑 收藏
常用英语口语绝佳句型100句
http://www.51test.net/show/20850.html
 
精选流行口语下载
http://www.51test.net/show/19889.html
 
英语日常对话出口成章
http://www.51test.net/show/20405.html
 
必背五十句户外经典英语口语
http://www.51test.net/show/21436.html
 
中国人最易犯错的30句英语口语
http://www.51test.net/show/21286.html
 
英语口语:经典赞美30句
http://www.51test.net/show/17920.html
posted @ 2006-04-12 09:06 Martin 阅读(268) | 评论 (0)编辑 收藏
仅列出标题
共6页: 1 2 3 4 5 6