# Generated automatically from Makefile.in by configure.
#Makefile for GNU Objective C runtime library.
#Copyright (C) 1993, 95-98, 1999, 2001 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, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.  */

#This was cribbed from the libchill, libiberty and libstdc++
#Makefile.in files.  Some of this stuff may be unnecessary and
#worthless.

SHELL = /bin/sh

#### Start of system configuration section. ####

srcdir = ../../../gcc/libobjc
VPATH = ../../../gcc/libobjc
prefix = /mingw
exec_prefix = ${prefix}
target_alias = @target_alias@
gcc_version = @gcc_version@
gcc_version_trigger = @gcc_version_trigger@

libdir = $(exec_prefix)/lib
libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
incinstalldir = $(libsubdir)/include

# Multilib support variables.
MULTISRCTOP = 
MULTIBUILDTOP = 
MULTIDIRS = 
MULTISUBDIR = 
MULTIDO = $(MAKE)
MULTICLEAN = $(MAKE)

# Not configured per top-level version, since that doesn't get passed
# down at configure time, but overrridden by the top-level install
# target.
INSTALL = /bin/sh /develop/gcc/gcc/install-sh -c
INSTALL_PROGRAM = /bin/sh /develop/gcc/gcc/install-sh -c 
INSTALL_DATA = /bin/sh /develop/gcc/gcc/install-sh -c -m 644

AR = ar
AR_FLAGS = rc

RANLIB = ranlib

CC = /develop/gcc/build/gcc/xgcc -B/develop/gcc/build/gcc/ -B/mingw/mingw32/bin/ -B/mingw/mingw32/lib/ -isystem /mingw/mingw32/include
CFLAGS = -O2 -DBUILD_libobjc_DLL
GTHREAD_FLAGS=-DHAVE_GTHR_DEFAULT
ALL_CFLAGS = -I. -I$(srcdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) \
	$(GTHREAD_FLAGS) -DIN_GCC -DIN_TARGET_LIBS

# Libtool
# The following strings describe the version of the obj-C library 
# begin compiled and compatibility issues.
# Please refer to Libtool documentation about how to manage these 
# numbers.
LIBOBJC_VERSION = 1:0:0
LIBOBJC_GC_VERSION = 1:0:0
# $(SHELL) $(top_builddir)/libtool does not get it right, so we hack it in - FIXME
LIBTOOL = ./libtool
LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
LIBTOOL_LINK    = $(LIBTOOL) --mode=link 
LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
LIBTOOL_CLEAN   = $(LIBTOOL) --mode=clean
#LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall

#
# Define the cc1obj in terms of the CC that is passed on from higher
# level make. This is needed to make sure we can create runtime-info.h
# when doing canadian cross builds where running ../../gcc/cc1obj 
# does not make any sense.
#
CC1OBJ = `$(CC) -print-prog-name=cc1obj`

INCLUDES = -I$(srcdir)/objc  -I$(srcdir)/$(MULTISRCTOP)../gcc \
  -I$(srcdir)/$(MULTISRCTOP)../gcc/config -I$(MULTIBUILDTOP)../../gcc \
  -I$(srcdir)/$(MULTISRCTOP)../include

OBJC_GCFLAGS=-DOBJC_WITH_GC=1
OBJC_THREAD_FILE=thr-objc
OBJC_BOEHM_GC=

.SUFFIXES:
.SUFFIXES: .c .m .lo

.c.lo:
	$(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<

.m.lo:
	$(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) $(INCLUDES) $<

# Flags to pass to a recursive make.
FLAGS_TO_PASS = \
	"AR=$(AR)" \
	"AR_FLAGS=$(AR_FLAGS)" \
	"CC=$(CC)" \
	"CFLAGS=$(CFLAGS)" \
	"LIBCFLAGS=$(LIBCFLAGS)" \
	"EXTRA_OFILES=$(EXTRA_OFILES)" \
	"HDEFINES=$(HDEFINES)" \
	"INSTALL=$(INSTALL)" \
	"INSTALL_DATA=$(INSTALL_DATA)" \
	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
	"LDFLAGS=$(LDFLAGS)" \
	"LIBTOOL=$(LIBTOOL)" \
	"LOADLIBES=$(LOADLIBES)" \
	"PICFLAG=$(PICFLAG)" \
	"RANLIB=$(RANLIB)" \
	"SHELL=$(SHELL)" \
	"prefix=$(prefix)" \
	"exec_prefix=$(exec_prefix)" \
	"libdir=$(libdir)" \
	"libsubdir=$(libsubdir)" \
	"tooldir=$(tooldir)"

all: libobjc.la $(OBJC_BOEHM_GC)
	$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all

# User-visible header files.

OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \
	 NXConstStr.h Object.h Protocol.h encoding.h typedstream.h \
	 thr.h

# Modules that comprise the runtime library.

OBJS =    archive.lo class.lo encoding.lo gc.lo hash.lo init.lo linking.lo \
	  misc.lo nil_method.lo NXConstStr.lo Object.lo objects.lo \
	  Protocol.lo sarray.lo selector.lo sendmsg.lo thr.lo \
	  $(OBJC_THREAD_FILE).lo

OBJS_GC = archive_gc.lo class_gc.lo encoding_gc.lo gc_gc.lo hash_gc.lo \
	  init_gc.lo linking_gc.lo misc_gc.lo nil_method_gc.lo \
	  NXConstStr_gc.lo Object_gc.lo objects_gc.lo Protocol_gc.lo \
	  sarray_gc.lo selector_gc.lo sendmsg_gc.lo thr_gc.lo \
	  $(OBJC_THREAD_FILE)_gc.lo

runtime-info.h: 
	echo "" > tmp-runtime
	echo "/* This file is automatically generated */" > $@
	$(CC1OBJ) -print-objc-runtime-info tmp-runtime >> $@
	rm -f tmp-runtime

archive_gc.lo: archive.c
	$(LIBTOOL_COMPILE) $(CC) -c  -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

class_gc.lo: class.c
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

encoding_gc.lo: encoding.c
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

gc.lo: gc.c
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<

gc_gc.lo: gc.c
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

hash_gc.lo: hash.c
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

init_gc.lo: init.c
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

linking.lo: linking.m
	$(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
		$(INCLUDES) $<

linking_gc.lo: linking.m
	$(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
		$(OBJC_GCFLAGS) $(INCLUDES) $<

misc_gc.lo: misc.c
	$(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

nil_method_gc.lo: nil_method.c
	$(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

NXConstStr.lo: NXConstStr.m
	$(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
		$(INCLUDES) $<

NXConstStr_gc.lo: NXConstStr.m
	$(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
		$(OBJC_GCFLAGS) $(INCLUDES) $<

Object.lo: Object.m
	$(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
		$(INCLUDES) $<

Object_gc.lo: Object.m
	$(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
		$(OBJC_GCFLAGS) $(INCLUDES) $<

objects_gc.lo: objects.c
	$(LIBTOOL_COMPILE) $(CC) -c $(ALL_CFLAGS) -o $@ $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

Protocol.lo: Protocol.m
	$(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
		$(INCLUDES) $<

Protocol_gc.lo: Protocol.m
	$(LIBTOOL_COMPILE) $(CC) -fgnu-runtime -c -o $@ $(ALL_CFLAGS) \
		$(OBJC_GCFLAGS) $(INCLUDES) $<

sarray_gc.lo: sarray.c
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

selector_gc.lo: selector.c
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

sendmsg.lo: sendmsg.c runtime-info.h
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(INCLUDES) $<

sendmsg_gc.lo: sendmsg.c runtime-info.h
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

thr_gc.lo: thr.c
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

$(OBJC_THREAD_FILE)_gc.lo: $(OBJC_THREAD_FILE).c
	$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
		$(INCLUDES) $<

doc: info dvi html

libobjc.la: $(OBJS)
	$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) -rpath $(libsubdir) \
		-version-info $(LIBOBJC_VERSION)

libobjc_gc.la: $(OBJS_GC)
	$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) -rpath $(libsubdir) \
		-version-info $(LIBOBJC_GC_VERSION)

#
# FIXME -- The following part does not fit in the libtool context. 
# Libtool is supposed to [going to] be able to create a win 32 DLL 
# without extra code but since I don't have a win machine to test 
# if it already works, I leave the old code here.
#
libobjc_s.a: libobjc.la
	mv libobjc.a libobjc_s.a

# Create a relocatable DLL
libobjc.dll: libobjc_s.a libobjc_entry.o
	$(CC) -mdll -Wl,--base-file -Wl,libobjc.base \
		-o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
	$(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
		--base-file libobjc.base --output-exp libobjc.exp
	$(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \
		-o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
	$(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
		--base-file libobjc.base --output-exp libobjc.exp
	$(GCC_FOR_TARGET) libobjc.exp -mdll \
		-o libobjc.dll libobjc_s.a libobjc_entry.o -lkernel32
	$(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/libobjc.def \
		--output-lib libobjc.a
#
#
#
#
#

info:
dvi:
html:

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

config.status: configure
	rm -f config.cache
	CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
	CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck

${srcdir}/configure: configure.in
	rm -f config.cache
	cd ${srcdir} && autoconf

install: install-libs copy-headers

install-libs: installdirs
	$(LIBTOOL_INSTALL) $(INSTALL_DATA) libobjc.la $(libsubdir)/libobjc.la;
	if [ "$(OBJC_BOEHM_GC)" ]; then \
	  $(LIBTOOL_INSTALL) $(INSTALL_DATA) libobjc_gc.la \
				$(libsubdir)/libobjc_gc.la;\
	fi

# Copy Objective C headers to installation include directory.
copy-headers:
	-rm -rf $(incinstalldir)/objc
	-mkdir $(incinstalldir)/objc
	-chmod a+rx $(incinstalldir)/objc
	for file in $(OBJC_H); do \
	  realfile=$(srcdir)/objc/$${file}; \
	  cp $${realfile} $(incinstalldir)/objc; \
	  chmod a+r $(incinstalldir)/objc/$${file}; \
	done

check uninstall install-strip dist installcheck installdirs:

mostlyclean:
	-$(LIBTOOL_CLEAN) rm -f libobjc.la libobjc_gc.la *.lo
	-rm -f runtime-info.h tmp-runtime.s *.o *.lo libobjc* xforward \
		fflags *.aux *.cp *.dvi *.fn *.info *.ky *.log *.pg \
		*.toc *.tp *.vr *.html libobj.exp
	@$(MULTICLEAN) multi-clean DO=mostlyclean

clean: mostlyclean
	rm -f config.log
	@$(MULTICLEAN) multi-clean DO=clean

distclean: clean
	@$(MULTICLEAN) multi-clean DO=distclean
	rm -f config.cache config.status Makefile configure

maintainer-clean realclean: distclean

.PHONY: mostlyclean clean distclean maintainer-clean all check uninstall \
	install-strip dist installcheck installdirs 

# FIXME: There should be an @-sign in front of the `if'.
# Leave out until this is tested a bit more.
multi-do:
	if [ -z "$(MULTIDIRS)" ]; then \
	  true; \
	else \
	  rootpre=`pwd`/; export rootpre; \
	  srcrootpre=`cd $(srcdir); pwd`/; 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}" \
				prefix="$(prefix)" \
				exec_prefix="$(exec_prefix)" \
				GCJFLAGS="$(GCJFLAGS) $${flags}" \
				CXXFLAGS="$(CXXFLAGS) $${flags}" \
				LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
				LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
				LDFLAGS="$(LDFLAGS) $${flags}" \
				$(DO)); then \
		  true; \
		else \
		  exit 1; \
		fi; \
	      else true; \
	      fi; \
	    fi; \
	  done; \
	fi

# FIXME: There should be an @-sign in front of the `if'.
# Leave out until this is tested a bit more.
multi-clean:
	if [ -z "$(MULTIDIRS)" ]; then \
	  true; \
	else \
	  lib=`pwd | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
	  for dir in Makefile $(MULTIDIRS); do \
	    if [ -f ../$${dir}/$${lib}/Makefile ]; then \
	      if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
	      then true; \
	      else exit 1; \
	      fi; \
	    else true; \
	    fi; \
	  done; \
	fi
