Main BLOGGER
Google
WWW THIS BLOG
Friday, June 17, 2005
 
Makefile and script
CVS
1. Commit : cvs co "module name"
2. Update: cvs up "module name" -d
3 Check in: cvs ci -m "comments" "file name"


Makefile
1. Command with a leading Dash (-)

A make will terminate if any command returns a failure sta- tus. That's why you see rules like:
clean:
-rm *.o *~ core paper
Make ignores the returned status on command lines that begin with a dash. eg. who cares if there is no core file?

2. Using @ to turn off the command echo

for example: @echo "stuff"
or @if ...

3. http://vertigo.hsrl.rutgers.edu/ug/make_help.html

4. using environment variable as branch condition instead of if...then...else
#ARCH includes w2k and linux
#TYPE includes static and dynamic

ARCH = w2k
TYPE = static

#pre_w2k_static will be triggered
all: pre_$(ARCH)_$(TYPE)

#four scenarios
pre_w2k_static:
@echo "w2k static"
pre_w2k_dynamic:
@echo "w2k dynamic"
pre_linux_static:
@echo "linux static"
pre_linux_dynamic:
@echo "linux dynamic"

Script
1. set arg arg ...
Set the positional variables to the argument list.
For example


 TODAY=`(set \`date\`; echo $1)`
2. using cat to generate a file
cat > xgnu.c </*tell shell to automatically close input for us*/
#ifdef __GNUC__yes;#endif
EOF /*tell shell that we are finished with input*/

3. use gcc -E to only process pre-process command like #if...#endif
gcc -E xgnu.c
4. $? is the return value of command, 0 stands for success, 1 for failure
5. if .command1. then command2 else command3 fi
when command1 return 0, command2 will be executed
when command1 return 1, command3 will be executed
(Weird? It is the opposite to C/C++ if...then...else
in C/C++ if the conditional expression returns non-zero, 
the "then" part will be exectued)

http://www.freeos.com/guides/lsst/



<< Home

Powered by Blogger

Google
WWW THIS BLOG