
#
# Portable Object Compiler (c) 1997,98.  All Rights Reserved. 
# $Id: Makefile.in,v 1.3 1999/05/10 18:44:57 stes Exp $
#

#
# This Makefile should work with UNIX make (like SysV, BSD, GNU make)
#

CD=cd
MKDIR=mkdir
STRIP=strip
RM=@RM@
CP=@CP@
AR=@AR@
FINAL_AR=@FINAL_AR@
RANLIB=@RANLIB@
@SET_MAKE@
YACC=@YACC@
LEX=@LEX@
YTABH=@YTABH@
YTABC=@YTABC@
LEXYYC=@LEXYYC@
DBG_MFLAGS=@DBG_MFLAGS@
OPT_MFLAGS=@OPT_MFLAGS@
OBJSUFFIX=@OBJSUFFIX@
LIBSUFFIX=@LIBSUFFIX@
BOOTDIR=..@PATHSEP@..
BINDIR=$(BOOTDIR)@PATHSEP@bin
LIBDIR=$(BOOTDIR)@PATHSEP@lib
IFLAGS=@OBJC_IFLAGS@
BOOTLIBS=@OBJC_BOOTLIBS@
DEPENDLIBS=../objcrt/objcrt.$(LIBSUFFIX) \
           ../objpak/objpak.$(LIBSUFFIX) \
           ../oclib/oclib.$(LIBSUFFIX)
MFLAGS=$(@MFLAGS@)

#
# Because this directory will contain a new compiler,
# make sure we configure with a full path towards the old compiler.
#

OBJC=@XOBJC@
.SUFFIXES: .m .lm .ym

OBJCSCRIPT=objc
OBJCPROGRAM=objc.exe
OBJC1PROGRAM=objc1@BINDOTSUFFIX@
POSTLINK=postlink@BINDOTSUFFIX@

OBJCFILES=\
	objc.$(OBJSUFFIX)

OBJC1FILES=\
	yacc.$(OBJSUFFIX)\
	lex.$(OBJSUFFIX)\
	objc1.$(OBJSUFFIX)

PRELINKFILE=\
	_prelink.$(OBJSUFFIX)

PREDLLFILE=\
	_predll.$(OBJSUFFIX)

POSTLINKFILES=\
	postlink.$(OBJSUFFIX)

.m.$(OBJSUFFIX):
	$(OBJC) -c $*.m $(MFLAGS) $(IFLAGS)

.lm.$(OBJSUFFIX):
	$(LEX) $*.lm
	-$(CP) $(LEXYYC) $*.m
	$(OBJC) -c $(MFLAGS) $(IFLAGS) $*.m
	-$(RM) $(LEXYYC)
	-$(RM) $*.m

.ym.$(OBJSUFFIX):
	$(YACC) $*.ym
	-$(CP) $(YTABH) $*.h
	-$(CP) $(YTABC) $*.m
	$(OBJC) -c $(MFLAGS) $(IFLAGS) $*.m
	-$(RM) $(YTABC)
	-$(RM) $*.m

default : $(OBJC1PROGRAM) $(PRELINKFILE) $(PREDLLFILE) $(POSTLINK)

$(OBJCPROGRAM) : $(OBJCFILES) $(DEPENDLIBS)
	$(OBJC) $(OBJCFILES) $(BOOTLIBS) -o $(OBJCPROGRAM)

$(OBJC1PROGRAM) : $(OBJC1FILES) $(DEPENDLIBS)
	$(OBJC) $(OBJC1FILES) $(BOOTLIBS) -o $(OBJC1PROGRAM)

$(PRELINKFILE) : _prelink.c
	$(OBJC) -c _prelink.c

$(PREDLLFILE) : _predll.c
	$(OBJC) -c _predll.c

$(POSTLINK) : $(POSTLINKFILES) $(DEPENDLIBS)
	$(OBJC) $(POSTLINKFILES) $(BOOTLIBS) -o $(POSTLINK)

bootstrap : 
	-test -d $(BINDIR) || $(MKDIR) $(BINDIR)
	-$(CP) $(OBJCSCRIPT) $(BINDIR)
	-$(CP) $(OBJCPROGRAM) $(BINDIR)
	-$(CP) $(OBJC1PROGRAM) $(BINDIR)
	-$(STRIP) $(BINDIR)/$(OBJC1PROGRAM)
	-$(CP) $(PRELINKFILE) $(LIBDIR)
	-$(CP) $(PREDLLFILE) $(LIBDIR)
	-$(CP) $(POSTLINK) $(BINDIR)
	-$(CP) cvtimport $(BINDIR)
	-$(CP) objchelp.txt $(LIBDIR)
	-$(CP) objcdlso.ld $(LIBDIR)

cleantmp :
	-$(RM) *.P
	-$(RM) *.i
	-$(RM) y.tab.h y.output y.tab.c

clean : cleantmp
	-$(RM) *.$(OBJSUFFIX)
	-$(RM) *.$(LIBSUFFIX)
	-$(RM) objc.m yacc.m lex.m
	-$(RM) $(OBJCPROGRAM)
	-$(RM) $(OBJC1PROGRAM)
	-$(RM) $(POSTLINK)

distclean : clean
	-$(RM) $(OBJCSCRIPT) 
	-$(RM) Makefile 
	-$(RM) config.h 

