# MPIndex - Amiga Guide Indexing program
# Copyright (C)  1995 Mark John Paddock

# $VER: MPIndex_smakefile 5.5 (26.2.97)

# This program 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 of the License, or
# any later version.

# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# mpaddock@cix.compulink.co.uk
# mark@topic.demon.co.uk

# Make file for MPIndex and SAS/C 6.56

# various defines
OS        = sc/
GB        = GB/
I         = .info
HS        = sh/
DS        = sd/

# Compilation flags
# Normal compile
NORMFLAGS  = PARM=R CONSTLIB NOSTKCHK STRMER UCHAR STREQ OPT OPTGO\
 CNEST NOMINC STRCONS VERBOSE STRSECT=CODE NOCHKABORT\
 DBG=L WARN=ALL ERR=ALL IGN=104,51,148,190,61,165,120,212,112
# Compile math = FFP 000
CCFLAGS000 = $(NORMFLAGS) CPU=ANY MATH=FFP OPTSIZE
# Compile render for 000
CCFLAGS000R = $(NORMFLAGS) CPU=ANY MATH=FFP OPTTIME

# default compilation
.c.o:
   sc $(CCFLAGS000) $*.c

.asm.o:
	asm -d $*.asm

MPINDDIST = COPYING RunMPIndex.guide MakeMPIndex.guide RunMPIndex MakeMPIndex Docs.Index MPIndex55Src.lha RunMPIndex$(I) IgnoreWord

MPINDSRC = $(HS)MakeMPIndex.c $(HS)RunMPIndex.c $(HS)MPIndex.c $(HS)MPIndex.h smakefile $(GB)MPIndex.gui $(OS)sprintf.c\
 lha/emptyfile $(DS)MakeMPIndex.texi $(DS)RunMPIndex.texi $(HS)MakeMPIndex.cd $(HS)RunMPIndex.cd

#stuff to delete
DELETE1   = \#?/\#?.o \#?/\#?.ld RunMPIndex.guide MakeMPIndex.guide

# Default is to generate Source and Object lha
Everything: lha/MPIndex55.lha


# Delete all the built files (except two above) to force a recompile
Delete:
   -delete $(DELETE1)

lha/MPIndex55.lha: $(MPINDDIST)
	-delete lha/MPIndex55.lha
	lha -a -F u -x lha/MPIndex55.lha <@<
	$(MPINDDIST)
	<

MPIndex55Src.lha: $(MPINDSRC)
	-delete MPIndex55Src.lha
	lha -a -F u -x MPIndex55Src.lha <@<
	$(MPINDSRC)
	<

RunMPIndex.guide: $(DS)RunMPIndex.texi
   Makeinfo --amiga-39 -o RunMPIndex.guide $(DS)RunMPIndex.texi

MakeMPIndex.guide: $(DS)MakeMPIndex.texi
   Makeinfo --amiga-39 -o MakeMPIndex.guide $(DS)MakeMPIndex.texi

# Common stuff
$(OS)sprintf.o: $(OS)sprintf.c

# Guide index stuff

$(HS)Mmessages.h: $(HS)MakeMPIndex.cd
	CatComp $? CFILE=$@ NOOPTIM NOCODE NOARRAY

$(HS)MakeMPIndex.ld: $(HS)MakeMPIndex.c $(HS)Mmessages.h
	sc $(CCFLAGS000R) StackCheck StackExtend link CHKABORT $(HS)MakeMPIndex.c to $(HS)MakeMPIndex.ld

MakeMPIndex: $(HS)MakeMPIndex.ld
	slink from $(HS)MakeMPIndex.ld to MakeMPIndex stripdebug noicons

$(HS)Rmessages.h: $(HS)RunMPIndex.cd
	CatComp $? CFILE=$@ NOOPTIM NOCODE NOARRAY

$(HS)MPIndex.o: $(HS)MPIndex.c $(HS)MPIndex.h $(HS)Rmessages.h
	sc $(CCFLAGS000R) $*.c

$(HS)RunMPIndex.o: $(HS)RunMPIndex.c $(HS)MPIndex.h $(HS)Rmessages.h
	sc $(CCFLAGS000R) $*.c

$(HS)RunMPIndex.ld: $(HS)MPIndex.o $(HS)RunMPIndex.o $(OS)sprintf.o
   slink <WITH <
   FROM lib:c.o $(HS)MPIndex.o $(HS)RunMPIndex.o $(OS)sprintf.o
   LIBRARY lib:sc.lib LIB:amiga.lib
   TO $(HS)RunMPIndex.ld SC SD BATCH
   VERBOSE
   ADDSYM
   DEFINE @__chkabort=@__dummy
   <

RunMPIndex: $(HS)RunMPIndex.ld
	slink from $(HS)RunMPIndex.ld to RunMPIndex stripdebug noicons

Docs.Index: MakeMPIndex RunMPIndex.guide MakeMPIndex.guide IgnoreWord
	MakeMPIndex Docs.Index Ignore=IgnoreWord MaxNode=20 RunMPIndex.guide MakeMPIndex.guide
