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


# Edit this definition to a suitable directory if you
# want to execute `make install'
DESTDIR = /usr/local/bin

# The source code uses ANSI-C prototypes for function
# headers.  Therefore, the Gnu C compiler, gcc, is used
# for compilations.
# If you must use a compiler that understands only
# classic K&R C, you will have to edit the files.  Sorry.
CC = gcc
CFLAGS = -ansi -g

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

#
# MAKE TARGETS:
#
#  la2mml	- the LaTeX to MML filter program
#
#  install	- copies the la2mml program to a 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
#		  and for the payment invoice
#
#  la2mml.bundle
#		- creates a shar archive
#
#  la2mml.tar.Z
#		- creates a compressed tar archive
#

# List of all .o files
OBJS =	auxprocs.o la2mml.o lexer.o main.o	\
	mml-defs.o output.o tables.o

# List of all .c files
SRCS =	auxprocs.c la2mml.c lexer.c main.c	\
	mml-defs.c output.c tables.c

# List of all .h files
HDRS =	auxprocs.h la2mml.h lexer.h mml-defs.h	\
	output.h tables.h

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

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


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

install: la2mml
	install la2mml $(DESTDIR)

mml:	la2mml man-page.tex invoice.tex
	./la2mml man-page.tex
	./la2mml invoice.tex

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

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

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

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


################ dependencies ###################

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

la2mml.o:	tables.h lexer.h auxprocs.h la2mml.h

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

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

output.o:	tables.h lexer.h

tables.o:	tables.h

