# Makefile for GNU CHILL compiler runtime library.
#   Copyright (C) 1987, 88, 90, 91, 92, 93, 1994 Free Software Foundation, Inc.

#This file is part of GNU CC.

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

#GNU CC 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 General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with GNU CC; see the file COPYING.  If not, write to
#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

# The targets for external use include:
# all, doc, TAGS, mostlyclean, clean, distclean, realclean,

srcdir = .

AR_FOR_TARGET = ` \
  if [ -f ../../../binutils/ar ] ; then \
    echo ../../../binutils/ar ; \
  else \
    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
      echo ar; \
    else \
       t="$(program_transform_name)"; echo ar | sed -e '' $$t ; \
    fi \
  fi`
AR_FOR_TARGET_FLAGS = rc
# How to invoke ranlib.
RANLIB_FOR_TARGET = ` \
  if [ -f ../../../binutils/ranlib ] ; then \
    echo ../../../binutils/ranlib ; \
  else \
    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
      echo ranlib; \
    else \
       t="$(program_transform_name)"; echo ranlib | sed -e '' $$t ; \
    fi \
  fi`
RANLIB_TEST_FOR_TARGET = \
  [ -f $(RANLIB_FOR_TARGET) ] \
  || ( [ "$(host_canonical)" = "$(target_canonical)" ] \
       && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )

# Directory in which to find other cross-compilation tools and headers.
# Used to compile the library
tooldir = $(exec_prefix)/$(target_alias)

BASE = ../..
GCC_FOR_TARGET = $(BASE)/xgcc -B$(BASE)/
CFLAGS = -g -O

# Always search these dirs when compiling.
INCLUDES = -I. -I$(BASE) -I$(srcdir) -I$(srcdir)/$(BASE)/config \
   -I../../include -I$(tooldir)/include -I$(srcdir)/$(BASE) 

ALL_CFLAGS = $(CFLAGS)

AR_FOR_TARGET = ` \
  if [ -f $(BASE)/../binutils/ar ] ; then \
    echo $(BASE)/../binutils/ar ; \
  else \
    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
      echo ar; \
    else \
       t="$(program_transform_name)"; echo ar | sed -e '' $$t ; \
    fi \
  fi`
AR_FOR_TARGET_FLAGS = rc
RANLIB_FOR_TARGET = ` \
  if [ -f $(BASE)/../binutils/ranlib ] ; then \
    echo $(BASE)/../binutils/ranlib ; \
  else \
    if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
      echo ranlib; \
    else \
       t="$(program_transform_name)"; echo ranlib | sed -e '' $$t ; \
    fi \
  fi`
RANLIB_TEST_FOR_TARGET = \
  [ -f $(RANLIB_FOR_TARGET) ] \
  || ( [ "$(host_canonical)" = "$(target_canonical)" ] \
       && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )


AR = $(AR_FOR_TARGET)
AR_FLAGS = $(AR_FOR_TARGET_FLAGS)
# How to invoke ranlib.
RANLIB = $(RANLIB_FOR_TARGET)
# Test to use to see whether ranlib exists on the system.
RANLIB_TEST = $(RANLIB_TEST_FOR_TARGET)

INSTALL = install -c
# These permit overriding just for certain files.
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)

# End of variables for you to override.

# Definition of `all' is here so that new rules inserted by sed
# do not specify the default target.
all: all.indirect

# This tells GNU Make version 3 not to put all variables in the environment.
.NOEXPORT:

# sed inserts variable overrides after the following lines.
####target overrides
####host overrides
####cross overrides
####build overrides
####site overrides

#### Host, target, and site specific Makefile fragments come in here.
###

.c.o:
	$(GCC_FOR_TARGET) -c $(ALL_CFLAGS) $(INCLUDES) $<

# Lists of required functions for each archive.

LIBOBJS1 = allgmem.o allmem.o allocate.o cause.o exhstack.o exh.o retmem.o \
	   unhex.o unhex1.o rtsdummy.o terminate.o

IOOBJS = basicio.o chillstdio.o delete.o eoln.o existing.o format.o getassoc.o \
         gettextaccess.o gettextindex.o gettextrecord.o getusage.o \
         indexable.o ioerror.o isassociated.o outoffile.o readable.o \
         readrecord.o sequencible.o settextaccess.o settextindex.o \
         settextrecord.o variable.o writeable.o writerecord.o

PSOBJS = andps.o cardps.o concatps.o copyps.o diffps.o eqps.o ffsetclrps.o \
	ffsetps.o flsetclrps.o flsetps.o inbitstr.o inps.o leps.o ltps.o \
	neps.o notps.o orps.o setbitps.o setbits.o sliceps.o xorps.o

STROBJS = concatstr.o eqstr.o ltstr.o memmove.o

TIMEOBJS = abstime.o inttime.o waituntil.o remaintime.o convdurrtstime.o \
           checkcycle.o

TASKOBJS = continue.o delaycase.o printbuffer.o printevent.o queuelength.o \
	   sendbuffer.o waitbuffer.o

OBJS = $(LIBOBJS1) $(IOOBJS) $(PSOBJS) $(STROBJS) $(TIMEOBJS) $(TASKOBJS)

all.indirect: chillrt0.o libchill.a Makefile

.PHONY: check installcheck
check:
installcheck:

libchill.a: $(OBJS)
	$(AR_FOR_TARGET) $(AR_FOR_TARGET_FLAGS) $@ $(OBJS)
	-if $(RANLIB_TEST_FOR_TARGET) ; then $(RANLIB_FOR_TARGET) $@; else true; fi

$(PSOBJS): $(srcdir)/powerset.h
librmt.o: $(srcdir)/rtltypes.h
chillrt0.o: $(srcdir)/rtltypes.h $(srcdir)/iomodes.h $(srcdir)/auxtypes.h
$(LIBOBJS1): $(srcdir)/rtltypes.h
$(TIMEOBJS): $(srcdir)/rtltypes.h $(srcdir)/rts.h
$(TASKOBJS): $(srcdir)/rts.h $(srcdir)/rtltypes.h
$(IOOBJS): $(srcdir)/fileio.h $(srcdir)/bitstring.h $(srcdir)/auxtypes.h \
           $(srcdir)/iomodes.h $(srcdir)/format.h $(srcdir)/ioerror.h
# With a new cc1 compile the library again
$(OBJS): ../../cc1

install-info:

info:

dvi:

Makefile: $(srcdir)/Makefile.in
	$(SHELL) ./config.status

mostlyclean:
	-rm -f $(OBJS) chillrt0.o
clean: mostlyclean
	-rm -f libchill.a
extraclean: clean
	true
distclean: extraclean
	-rm -f Makefile
realclean: distclean
	true
