all:: ppmtomd

# The default printer model is the Oki DP-5000, referred to in the
# code as modelDP5000. If you want to change this, uncomment the
# following and change it appropriately (see the source for the
# list of model names in the code).
# DEFAULTMODEL=-DDEFAULT_MODEL=modelDP5000

# uncomment this if you want to make ppmtocpva a link to ppmtomd
# (If ppmtomd is called as ppmtocpva, its defaults are closer
# to those used in my old ppmtocpva program, so it should work 
# as a drop-in replacement.)
# CPVALINK = Y

# where to install the binary
BINDIR = /usr/local/bin
# where to install the man page
MANDIR = /usr/local/share/man/man1
# extension of the man page
MANEXT = 1

# you do use gcc, don't you?
CC = gcc

# NOTE: optimization is recommended, as this driver does a lot
# of work. Switching on optimization *does* change the output
# slightly, probably owing to slight differences in floating point
# calculations.
CDEBUGFLAGS=-O2
# if your ppm libraries are not in a standard place, uncomment
# and change this. You may also need thing like -R, but if you're
# on that sort of system you probably know it!
# LDLIBS = -L/usr/local/lib

# install commands
BININSTALL = install -m 0555
MANINSTALL = install -m 0444

OBJS = ppmtomd.o mddata.o photocolcor.o vphotocolcor.o dyesubcolcor.o
ppmtomd: $(OBJS)
	$(CC) -o ppmtomd $(OBJS) $(LDLIBS) -lnetpbm -lm

ppmtomd.o: ppmtomd.c mddata.h
	$(CC) $(CDEBUGFLAGS) $(DEFAULTMODEL) -W -Wall -Wstrict-prototypes -c ppmtomd.c 

mddata.o: mddata.c mddata.h

install: ppmtomd
	$(BININSTALL) ppmtomd $(BINDIR)/ppmtomd
	if [ "$(CPVALINK)" ] ; then ln -s ppmtomd $(BINDIR)/ppmtocpva ; fi
	$(MANINSTALL) ppmtomd.man $(MANDIR)/ppmtomd.$(MANEXT)

clean::
	rm ppmtomd *.o
