# Copyright (C) 2000 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.

# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.

# You should have received a copy of the GNU Library General Public
# License along with the GNU C Library; see the file COPYING.LIB.  If
# not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.


# Make a "libcpic"; it really isn't properly all PIC, but it's close
# enough that ld.so can run far enough that it can finish relocating itself.

# A real libcpic would be better here, but in the Interix environment, the
# distinction between PIC and non-PIC doesn't appear to be that critical
# to apparent performance, at least at this time.

CC=$W/local_bin/gcc -B $W/local_bin/
LIBC=/usr/lib/libc.a

SOPTS=-DMINIMAL
COPTS=

PIC=-D__PIC__ -fpic

CFLAGS=

SOBJS=probe_read.o

# Things we can take out of libc.a that happen to be "PIC" anyway (or close
# enough, or needed late enough, that we can get away with it.)
AOBJS= _longjmp.o _setjmp.o _setjmp3.o sigsetjmp.o siglongjmp.o __setjmp_fjb.o \
memcpy.o errlst.o strcat.o strncpy.o strpbrk.o strchr.o strcmp.o strncmp.o \
memset.o strlen.o

COBJS=strsep.o strerror.o

all: libcpic.a

libcpic.a: $(AOBJS) $(COBJS) $(SOBJS)
	rm -f libcpic.a
	ar -cr libcpic.a $(AOBJS) $(COBJS) $(SOBJS)

.SUFFIXES: .s

.s.o:
	$(CC) $(PIC) $(SOPTS) $(CFLAGS) -c $< -o $@

.c.o:
	$(CC) $(PIC) $(COPTS) $(CFLAGS) -c $< -o $@

$(AOBJS): $(LIBC)
	ar -x $(LIBC) $(AOBJS)
