# IconTools -*- Makefile -*- for Matt Dillon's nice DICE (Amiga)
#
# (c)Copyright 1994,95 by Tobias Ferber, ukjg@rz.uni-karlsruhe.de
#
# This file is part of the IconTools distribution.
#
# IconTools 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 1 of the License, or
# (at your option) any later version.
#
# IconTools 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 file; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

# $VER: $Id: DMakefile,v 1.5 1995/08/06 20:40:05 tf Exp $

RM = delete quiet
CP = copy quiet clone

#

stem        = icontools
suffix      = texi
#suffix      = texinfo
makeguide   = makeguide --amiga-39
#makeguide   = makeinfo --amiga
guide2doc   = guide2doc
#guide2doc   = ag2txt
texindex    = texindex
tex         = virtex &tex
dvips       = dvips

#

distdir = icontools-2.01
arcname = icontools-2.01

##############################################################################
#
# DCC 2.07.56R (11.6.93)
#

CC      = dcc
CFLAGS  = -3.1 -030 -s
DEBUG   = -DDEBUG

##############################################################################
#
# GNU C (tested with gcc version 2.6.3)
#

#CC      = gcc
#CFLAGS  = -noixemul -Iinclude: -I.
##CFLAGS  = -O3 -Wall -noixemul -m68030 -m68881 -Iinclude: -I.
#DEBUG   = -DDEBUG
##DEBUG   =

##############################################################################
#
# You don't want to change anything below this line
#

stem = icontools
exes = icon2c opticon im

objs = modules/parse.o \
       modules/ilbmr.o \
       modules/loadilbm.o \
       modules/iffpstrings.o \
       modules/getbitmap.o \
       modules/unpacker.o

##############################################################################

all: $(exes)

icon2c: icon2c.c
	$(CC) $(CFLAGS) $(DEBUG) -o %(left) %(right)

opticon: opticon.o memfn.o
	$(CC) $(CFLAGS) $(DEBUG) -o %(left) %(right)

im: im.o $(objs)
	$(CC) $(CFLAGS) $(DEBUG) -o %(left) %(right)

im.o opticon.o memfn.o: im.c opticon.c memfn.c
	$(CC) $(CFLAGS) $(DEBUG) -c -o %(left) %(right)

$(objs): $(objs:*.o:*.c)
	$(CC) $(CFLAGS) $(DEBUG) -I.. -c -o %(left) %(right)

##############################################################################

docs: $(stem).guide $(stem).dvi $(stem).ps

$(stem).guide: $(stem).texi
	$(makeguide) -o %(left) %(right)

# $(tex) creates the .(log|toc|aux|dvi) files

$(stem).dvi: $(stem).$(suffix)
	$(tex) %(right)

$(stem).ps: $(stem).dvi
	$(dvips) $(stem).dvi

# $(texindex) creates the #?.(cps|fns|vrs|kys|pgs|aus) files

book: $(stem).$(suffix)
	$(tex) $(stem).$(suffix)
	$(tex) $(stem).$(suffix)
	$(texindex) $(stem).cp
	$(texindex) $(stem).fn
	$(texindex) $(stem).vr
	$(texindex) $(stem).ky
	$(texindex) $(stem).pg
	$(tex) $(stem).$(suffix)

##############################################################################

clean:
	$(RM) $(exes) #?.o $(objs) #?.(log|toc|aux|cp|fn|vr|ky|pg|cps|fns|vrs|kys|pgs|tp|log)

bumprev:
	execute cico

install: $(exes)
	$(CP) IM OptIcon work:bin/
	$(CP) OptIcon.rexx work:rexx/
	$(CP) Icon2c devel:bin/

dist: $(exes) $(stem).texi $(stem).guide $(stem).dvi $(stem).ps
	$(CP) `cpdist -n` $(distdir)
	lha -a -e -r -x a $(arcname).lha $(distdir)
	delete all quiet $(distdir)

#	tar cf $(arcname).tar $(distdir)
#	gzip -9 $(arcname).tar

##############################################################################

000:
	echo >ram:000.cvt "*"-030*"->*"-000*";"
	cvt -s -f ram:000.cvt DMakefile -o %s.000
	delete quiet ram:000.cvt
	dmake -a -f DMakefile.000 all
	rename icon2c icon2c.000
	rename opticon opticon.000
	rename im im.000

030:
	dmake -a all
	rename icon2c icon2c.030
	rename opticon opticon.030
	rename im im.030
