# Makefile for FAXDVI.
#
# Copyright 1994 Ralph Schleicher
#
# 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 (at your option) 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.


# Your C-Compiler.
#
CC = gcc

# The preprocessor.
#
CPP = ${CC} -E

# Preprocessor options.
#
CPPFLAGS = -I.

# Compiler flags.
#
CFLAGS = -Wall -g
CFLAGS = -O2 -fomit-frame-pointer

# Loader flags.
#
LDFLAGS = -g
LDFLAGS = -s -N

# Directories.
#
prefix = /usr/local
bindir = ${prefix}/bin
libdir = ${prefix}/lib
mandir = ${prefix}/man

#
# No editing should be necessary below this line.
#

.SUFFIXES: .c .o

.c.o:
	${CC} ${CPPFLAGS} ${CFLAGS} -c $<


program = faxdvi
script = faxdvi2
headers = config.h extern.h fax.h
sources = main.c version.c usage.c die.c sendfax.c \
	getchar.c getblock.c getnum.c skip.c \
	readdvi.c special.c fontdef.c pre.c postpost.c
objects = main.o version.o usage.o die.o sendfax.o \
	getchar.o getblock.o getnum.o skip.o \
	readdvi.o special.o fontdef.o pre.o postpost.o

default: ${program}

all: default install

${program}: depend ${objects}
	${CC} ${LDFLAGS} -o $@ ${objects} ${libraries}

install:
	install -m 755 -o root -g bin ${program} ${bindir}/${program}
	install -m 755 -o root -g bin ${script} ${bindir}/${script}

uninstall:
	-rm -f ${bindir}/${program}
	-rm -f ${bindir}/${script}

clean:
	-rm -f ${objects} ${program} core

realclean: clean
	-rm -f depend *~ \#*

depend:
	${CPP} ${CPPFLAGS} -MM ${sources} > $@

include depend
