# Makefile for la_mml LaTeX -> FrameMaker mml filter
#
# Copyright (C) R. Nigel Horspool, 1991-93


# Edit these definitions to suitable directories if you
# want to execute `make install'
DESTDIR = /usr/local/bin
MANDIR = /usr/man/man1

# The source code uses ANSI-C prototypes for function
# headers.  Therefore, the Gnu C compiler, gcc, is used
# for compilations.
CC = cc

# KJT 29/03/08: Use for following for Cygwin/MingW

CFLAGS = -ansi -W -O -mno-cygwin

# KJT 29/03/08: Use for following for Cygwin

# CFLAGS = -ansi -W -O

# KJT 29/03/08: Use for following for NeXTStep/OpenStep

# CFLAGS = -ansi -W -O -DNeXT

# The program that creates a shell archive.
SHAR = ./bundle

#
# MAKE TARGETS:
#
#  la_mml	- the LaTeX to MML filter program
#
#  install	- copies the la_mml program to a directory
#		  and the Unix man page to another directory
#
#  clean	- remove .o and other junk files
#
#  wc		- counts number of lines of source code
#
#  mml		- creates the mml files for the man page
#
#  la_mml.bundle
#		- creates a shar archive
#
#  la_mml.tar.Z
#		- creates a compressed tar archive
#

# List of all .o files in Unix version of program
OBJS =	auxprocs.o la_mml.o lexer.o main.o	\
	mml-defs.o output.o tables.o

# List of all .c files in both Unix & Macintosh versions
SRCS =	auxprocs.c la_mml.c lexer.c main.c	\
	mml-defs.c output.c tables.c macRoutines.c

# List of all .h files in both Unix & Macintosh versions
HDRS =	auxprocs.h la_mml.h lexer.h mml-defs.h	\
	output.h tables.h main.h macRoutines.h

# List of other files to include in a distribution
OTHER =	README Makefile UPDATES man-page.tex	\
	la_mml.1 bundle

# List of all files in the distribution
ALL =	$(OTHER) $(SRCS) $(HDRS)


la_mml: $(OBJS)
	$(CC) $(CFLAGS) -o la_mml $(OBJS)

install: la_mml la_mml.1
	install la_mml $(DESTDIR)
	install la_mml.1 $(MANDIR)

mml:	la_mml man-page.tex
	./la_mml man-page.tex

la_mml.bundle: $(ALL) README
	bundle $(ALL) > $@

la_mml.tar.Z: $(ALL)
	mkdir /tmp/LA2MML
	cp $(ALL) /tmp/LA2MML
	(cd /tmp/LA2MML; tar cf - ./*) > la_mml.tar
	rm /tmp/LA2MML/*
	rmdir /tmp/LA2MML
	compress la_mml.tar

wc:	$(SRCS) $(HDRS)
	wc -l $(SRCS) $(HDRS)

clean:
	rm -f *.o *.mml *.framemml *~ a.out core

################ Unix file dependencies ###################

auxprocs.o:	tables.h output.h lexer.h la_mml.h main.h auxprocs.h

la_mml.o:	tables.h lexer.h output.h auxprocs.h la_mml.h

main.o:		tables.h lexer.h output.h mml-defs.h la_mml.h main.h

mml-defs.o:	tables.h mml-defs.h

output.o:	tables.h lexer.h la_mml.h auxprocs.h output.h

tables.o:	tables.h

