快乐虾
http://blog.csdn.net/lights_joy/
lights@hb165.com
本文适用于
Cygwin-1.16
Vs2008
欢迎转载,但请保留作者信息
这个文件由主控Makefile调用newlib/configure脚本生成。并在主控Makefile中使用make all进行调用。
1.1 all
all目标定义为:
all: newlib.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
它所依赖的文件newlib.h已经由configure脚本生成,因此转向执行all-recursive目标:
all-recursive: stmp-targ-include
all-recursive: all-multi
此外还有:
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive /
html-recursive info-recursive install-data-recursive /
install-exec-recursive install-info-recursive /
install-recursive installcheck-recursive installdirs-recursive /
pdf-recursive ps-recursive uninstall-info-recursive /
uninstall-recursive
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; /
for f in x $$MAKEFLAGS; do /
case $$f in /
*=* | --[!k]*);; /
*k*) failcom='fail=yes';; /
esac; /
done; /
dot_seen=no; /
target=`echo $@ | sed s/-recursive//`; /
list='$(SUBDIRS)'; for subdir in $$list; do /
echo "Making $$target in $$subdir"; /
if test "$$subdir" = "."; then /
dot_seen=yes; /
local_target="$$target-am"; /
else /
local_target="$$target"; /
fi; /
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) /
|| eval $$failcom; /
done; /
if test "$$dot_seen" = "no"; then /
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; /
fi; test -z "$$fail"
上述脚本将进入各个子目录执行make all,然后在当前目录下执行make all-am。
1.1.1 stmp-targ-include
这条规则定义为:
# The targ-include directory just holds the includes files for the
# particular system and machine we have been configured for. It is
# used while building.
stmp-targ-include: config.status
-rm -rf targ-include stmp-targ-include
mkdir targ-include targ-include/sys targ-include/machine targ-include/bits
cp newlib.h targ-include/newlib.h
-for i in $(srcdir)/libc/machine/$(machine_dir)/machine/*.h; do /
if [ -f $$i ]; then /
cp $$i targ-include/machine/`basename $$i`; /
else true; fi ; /
done
-for i in $(srcdir)/libc/machine/$(machine_dir)/sys/*.h; do /
if [ -f $$i ]; then /
cp $$i targ-include/sys/`basename $$i`; /
else true; fi ; /
done
-for i in $(srcdir)/libc/machine/$(machine_dir)/include/*.h; do /
if [ -f $$i ]; then /
cp $$i targ-include/`basename $$i`; /
else true; fi ; /
done
-for i in $(srcdir)/libc/sys/$(sys_dir)/include/*.h; do /
if [ -f $$i ]; then /
cp $$i targ-include/`basename $$i`; /
else true; fi ; /
done
-for i in $(srcdir)/libc/sys/$(sys_dir)/sys/*.h; do /
if [ -f $$i ]; then /
cp $$i targ-include/sys/`basename $$i`; /
else true; fi ; /
done
-for i in $(srcdir)/libc/sys/$(sys_dir)/bits/*.h; do /
if [ -f $$i ]; then /
cp $$i targ-include/bits/`basename $$i`; /
else true; fi ; /
done
-for i in $(srcdir)/libc/sys/$(sys_dir)/machine/*.h; do /
if [ -f $$i ]; then /
cp $$i targ-include/machine/`basename $$i`; /
else true; fi ; /
done
-for i in $(srcdir)/libc/sys/$(sys_dir)/machine/$(machine_dir)/*.h; do /
if [ -f $$i ]; then /
cp $$i targ-include/machine/`basename $$i`; /
else true; fi ; /
done
-for i in $(srcdir)/libc/sys/$(sys_dir)/machine/$(machine_dir)/include/*.h; do /
if [ -f $$i ]; then /
cp $$i targ-include/machine/`basename $$i`; /
else true; fi ; /
done
touch $@
这段脚本将创建targ-include子目录,并在其中复制一些头文件:
驱动器 C 中的卷是 XP
卷的序列号是 2855 -11F 6
C:/cygwin/src/cygwin/winsup/src/i686-pc-cygwin/newlib/targ-include 的目录
2008-10-08 11:48 <DIR> .
2008-10-08 11:48 <DIR> ..
2008-10-08 11:48 <DIR> sys
2008-10-08 11:48 <DIR> machine
2008-10-08 11:48 <DIR> bits
2008-10-08 11:48 5,744 newlib.h
1 个文件 5,744 字节
C:/cygwin/src/cygwin/winsup/src/i686-pc-cygwin/newlib/targ-include/sys 的目录
2008-10-08 11:48 <DIR> .
2008-10-08 11:48 <DIR> ..
0 个文件 0 字节
C:/cygwin/src/cygwin/winsup/src/i686-pc-cygwin/newlib/targ-include/machine 的目录
2008-10-08 11:48 <DIR> .
2008-10-08 11:48 <DIR> ..
2008-10-08 11:48 4,084 fastmath.h
1 个文件 4,084 字节
C:/cygwin/src/cygwin/winsup/src/i686-pc-cygwin/newlib/targ-include/bits 的目录
2008-10-08 11:48 <DIR> .
2008-10-08 11:48 <DIR> ..
0 个文件 0 字节
所列文件总数:
2 个文件 9,828 字节
11 个目录 15,119,286,272 可用字节
最后生成一个stmp-targ-include的空文件供Makefile做时间比较。
1.1.2 all-multi
这条规则定义为:
all-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
因为此时传递进来的目标为all-recursive,因此转向执行multi-do:
multi-do:
if [ -z "$(MULTIDIRS)" ]; then /
true; /
else /
rootpre=`${PWD_COMMAND}`/; export rootpre; /
srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; /
lib=`echo "$${rootpre}" | sed -e 's,^.*//([^/][^/]*/)/$$,/1,'`; /
compiler="$(CC)"; /
for i in `$${compiler} --print-multi-lib 2>/dev/null`; do /
dir=`echo $$i | sed -e 's/;.*$$//'`; /
if [ "$${dir}" = "." ]; then /
true; /
else /
if [ -d ../$${dir}/$${lib} ]; then /
flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; /
if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) /
CFLAGS="$(CFLAGS) $${flags}" /
CCASFLAGS="$(CCASFLAGS) $${flags}" /
FCFLAGS="$(FCFLAGS) $${flags}" /
FFLAGS="$(FFLAGS) $${flags}" /
ADAFLAGS="$(ADAFLAGS) $${flags}" /
prefix="$(prefix)" /
exec_prefix="$(exec_prefix)" /
GCJFLAGS="$(GCJFLAGS) $${flags}" /
CXXFLAGS="$(CXXFLAGS) $${flags}" /
LIBCFLAGS="$(LIBCFLAGS) $${flags}" /
LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" /
LDFLAGS="$(LDFLAGS) $${flags}" /
MULTIFLAGS="$${flags}" /
DESTDIR="$(DESTDIR)" /
INSTALL="$(INSTALL)" /
INSTALL_DATA="$(INSTALL_DATA)" /
INSTALL_PROGRAM="$(INSTALL_PROGRAM)" /
INSTALL_SCRIPT="$(INSTALL_SCRIPT)" /
$(DO)); then /
true; /
else /
exit 1; /
fi; /
else true; /
fi; /
fi; /
done; /
fi;/
这段脚本其实啥也不做。
1.2 all-am
这个目标定义为:
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) newlib.h
LIBRARIES = $(toollib_LIBRARIES)
toollib_LIBRARIES = libm.a libc.a
LTLIBRARIES = $(toollib_LTLIBRARIES)
toollib_LTLIBRARIES未定义
DATA = $(noinst_DATA) $(toollib_DATA)
noinst_DATA = stmp-targ-include
toollib_DATA = $(CRT0) $(CRT1)
CRT0 =
CRT1 =
参考资料
在vs2008下使用cygwin(1):前言( 2008-10-16 )