* Makefile.in: Rework to accommodate new speclib arguments.

* speclib: Rework to extract everything from libcygwin.a rather than building
things from existing object files.
This commit is contained in:
Christopher Faylor 2003-08-06 01:40:12 +00:00
parent 4423d92489
commit 4b154cc1b3
4 changed files with 42 additions and 18 deletions

View File

@ -1,3 +1,9 @@
2003-08-05 Christopher Faylor <cgf@redhat.com>
* Makefile.in: Rework to accommodate new speclib arguments.
* speclib: Rework to extract everything from libcygwin.a rather than
building things from existing object files.
2003-08-05 Pavel Tsekov <ptsekov@gmx.net>
* path.cc (cygdrive_getmntent): Do not skip over drives of type

View File

@ -116,7 +116,6 @@ RUNTESTFLAGS =
DLL_NAME:=cygwin1.dll
TEST_DLL_NAME:=cygwin0.dll
LIB_NAME:=libcygwin.a
TEST_LIB_NAME:=libcygwin0.a
DEF_FILE:=cygwin.def
DLL_ENTRY:=@DLL_ENTRY@
@ -233,10 +232,11 @@ NEW_FUNCTIONS:=regcomp posix_regcomp \
API_VER:=$(srcdir)/include/cygwin/version.h
PWD:=${shell pwd}
SUBLIBS:=libpthread.a $(PWD)/libm.a libc.a
LIB_NAME:=$(PWD)/libcygwin.a
SUBLIBS:=$(PWD)/libpthread.a $(PWD)/libm.a $(PWD)/libc.a
EXTRALIBS:=libautomode.a libbinmode.a libtextmode.a
INSTOBJS:=automode.o binmode.o textmode.o
TARGET_LIBS:=$(LIB_NAME) $(SUBLIBS) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
TARGET_LIBS:=$(LIB_NAME) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
.PHONY: all force dll_ofiles install all_target install_target all_host install_host \
install install-libs install-headers -lgcc
@ -376,14 +376,14 @@ dcrt0.o sigproc.o: child_info_magic.h
shared.o: shared_info_magic.h
libpthread.a: speclib cygwin.def pthread.o thread.o
/bin/sh ${word 1, $^} $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99, $^}
$(PWD)/libpthread.a: speclib $(LIB_NAME) pthread.o thread.o
/bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
$(PWD)/libm.a: speclib cygwin.def $(LIBM)
/bin/sh ${word 1, $^} $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99, $^}
$(PWD)/libm.a: speclib $(LIB_NAME) $(LIBM)
/bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
$(PWD)/libc.a: speclib cygwin.def $(PWD)/libm.a libpthread.a
/bin/sh ${word 1, $^} -v $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99, $^}
$(PWD)/libc.a: speclib $(LIB_NAME) $(PWD)/libm.a libpthread.a
/bin/sh ${word 1, $^} -v $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
lib%.a: %.o
$(AR) cru $@ $?

View File

@ -30,6 +30,8 @@ int __cygwin_crt0_bp = 0;
extern int main (int argc, char **argv);
void cygwin_crt0 (int (*main) (int, char **));
void
mainCRTStartup ()
{

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -x
# speclib - Make a special version of the cygwin import library.
#
# Copyright 2001, 2002 Red Hat, Inc.
@ -10,14 +10,30 @@
# details.
case "$1" in
-v) v="-v"; shift
-v) shift; v() { :; } ;;
*) v() { /bin/false; } ;;
esac
lib=$1; shift
nm=$1; shift
dlltool=$1; shift
as=$1; shift
def=$1; shift
trap "rm -f /tmp/$$.def" 0 1 2 15
(echo "LIBRARY cygwin1.dll
EXPORTS"; $nm --extern-only --defined-only $* | sed -e '/^[ ]*$/d' -e '/:$/d' -e 's/^.* _\(.*\)/\1/' | grep $v -f - -w $def |egrep -vi '^library|exports|^$' | sort) > /tmp/$$.def
$dlltool --as=$as -d /tmp/$$.def -l "$lib"
ar=$1; shift
libdll=$1; shift
cp /dev/null /tmp/$$.objs
trap "/bin/rm -rf /tmp/$$.dir /tmp/$$.syms /tmp/$$.objs /tmp/$$.raw" 0 1 2 15
$nm --extern-only --defined-only $* | sed -e '/^[ ]*$/d' -e '/:$/d' -e 's%^.* _\(.*\)%/ __imp__\1$/p%' | grep -v ' __imp___imp__' > /tmp/$$.syms
v || $nm -Ap --extern-only --defined-only $libdll | egrep ' I __head| I _.*_iname' | awk -F: '{print $2}' > /tmp/$$.objs
$nm -Ap --extern-only --defined-only $libdll | sed -n -f /tmp/$$.syms | awk -F: '{print $2}' >> /tmp/$$.objs
sort -o /tmp/$$.objs -u /tmp/$$.objs
[ -s /tmp/$$.objs ] || { echo "speclib: couldn't find symbols for $lib" 1>&2; exit 1; }
/bin/rm -f /tmp/$$>dir
mkdir /tmp/$$.dir
cd /tmp/$$.dir
if v; then
$ar x $libdll
/bin/rm -f `cat /tmp/$$.objs`
else
$ar x $libdll `cat /tmp/$$.objs`
fi
/bin/rm -f $lib
$ar crus $lib *.o