#
# Makefile for pnm2ppa
#
# paths to locations where the pnm2ppa binary, the configuration file,
# and the man page should be installed. On some systems (like Solaris)
# the install command requires the syntax BINDIR="-f /usr/local/bin".
BINDIR="/usr/local/bin"
CONFDIR="/etc"
MANDIR="/usr/local/man/man1"
#compiler and linker options:
CC=gcc
CFLAGS=-Wall -pedantic -O2
LDFLAGS=-lm
INSTALL=install
# Install under Linux and other versions with the -b (backup) option
# (Comment out next line on systems (*BSD, Solaris..) without this option)
INSTALL+= -b
OBJS = pnm2ppa.o syslog.o ppa.o image.o dither.o cutswath.o hash_ink.o gamma.o
SRC = pnm2ppa.c syslog.c ppa.c image.c dither.c cutswath.c hash_ink.c gamma.c
# The SysLog call may be absent or incompatible on some systems
# (e.g., BeOS,..) or you may not wish to have this feature.
# To remove support for writing to the System Log, uncomment the next line:
#CFLAGS+= -D__NO_SYSLOG__
# Some systems (e.g. Solaris) may not support the LOG_PERROR option to
# open_syslog(). (This copies syslog messages to stderr as well as to
# the system log.) In that case, uncomment the next line:
#CFLAGS+= -D__NO_LOG_PERROR__
# For debug builds, uncomment the next three lines to get debug messages:
#CFLAGS+= -g -DDEBUG=1
#OBJS+= debug.o
#SRC+= debug.c
# For debugging with "Electric Fence" (if you have it):
#LDFLAGS+=-lefence
# On BeOS the LDFLAGS should not be used.
# Uncomment the next line if you are compiling for BeOS:
#LDFLAGS=
# On Mac OS X 10.x, you need to uncomment the next CFLAGS and LDFLAGS lines.
# You may also need to install libgnugetopt (there are precompiled
# versions for Mac OS X available on the net, or it can be compiled
# from source). Don't forget to rename the shared library from
# "/usr/local/lib/libgnugetopt.a" to "/usr/local/lib/libgnugetopt.dylib".
#CFLAGS=-Wall -no-cpp-precomp -traditional-cpp -pedantic -O2
#LDFLAGS=-L/usr/local/lib -lgnugetopt
# If you have FreeBSD you need to uncomment the next LDFLAGS.
# You may also need to install libgnugetopt from the ports collection.
# (Also, make sure the getopt.h it supplies is appropriately installed.)
#LDFLAGS+=-L/usr/local/lib -lgnugetopt
# If you have Solaris you need to uncomment the next LDFLAG
# You will also need to install a library with GNU getopt:
# (e.g., libiberty which is available from http://sunfreeware.com)
#LDFLAGS+=-L/usr/local/lib -liberty
# Language selection for messages from pnm2ppa. Choose one only.
LANG=EN
#LANG=CZ
#LANG=ES
#LANG=FR
#LANG=IT
#LANG=NL
#------------------------------------------------------------------
# Normal Users!
#
# Do not edit below this line! No user servicable parts below!
#--------------------------------------------------------------------
INSTALLD=$(INSTALL) -d
CFLAGS+=-DLANG_$(LANG)
default: all
profile:
make "CFLAGS=-Wall -pedantic -O2 -g -pg -DNDEBUG"
debug:
make "CFLAGS=-Wall -pedantic -g -O2 -DDEBUG=1 -DLANG_EN" "LDFLAGS=-lm -lefence" "OBJS=$(DOBJS)"
# the following have been left in for those with good memories
720: all
@@echo After running make install, edit /etc/pnm2ppa.conf and set your printer
820: all
@@echo After running make install, edit /etc/pnm2ppa.conf and set your printer
1000: all
@@echo After running make install, edit /etc/pnm2ppa.conf and set your printer
all: pnm2ppa calibrate_ppa
clean:
rm -f *.o *~ calibrate_ppa pnm2ppa make_hash_ink gmon.out hash_ink.c
install: pnm2ppa calibrate_ppa
$(INSTALLD) $(BINDIR)
$(INSTALLD) $(CONFDIR)
$(INSTALLD) $(MANDIR)
$(INSTALL) -m 755 pnm2ppa $(BINDIR)
$(INSTALL) -m 644 docs/en/pnm2ppa.1 $(MANDIR)
# development only - allows root to edit
$(INSTALL) -m 644 pnm2ppa.conf $(CONFDIR)
# calibration tool
$(INSTALL) -m 755 calibrate_ppa $(BINDIR)
# final production - much tighter
# $(INSTALL) -m 444 pnm2ppa.conf $(CONFDIR)
@@echo
@@echo Now, edit /etc/pnm2ppa.conf to choose your printer
uninstall:
rm -f $(BINDIR)/pnm2ppa
rm -f $(BINDIR)/calibrate_ppa
rm -f $(MANDIR)/pnm2ppa.1
rm -f $(CONFDIR)/pnm2ppa.conf
pnm2ppa: $(OBJS)
$(CC) $(LDFLAGS) $(CFLAGS) -o pnm2ppa $(OBJS)
calibrate_ppa: calibrate_ppa.o pnmtools.o gamma.o
$(CC) $(LDFLAGS) $(CFLAGS) -o calibrate_ppa calibrate_ppa.o pnmtools.o gamma.o
calibrate_ppa.o: calibrate_ppa.c global.h image.h defaults.h pnmtools.h
$(CC) $(CFLAGS) -c calibrate_ppa.c
pnmtools.o: pnmtools.c pnmtools.h
$(CC) $(CFLAGS) -c pnmtools.c
cutswath.o: cutswath.c debug.h ppa.h image.h global.h syslog.h
$(CC) $(CFLAGS) -c cutswath.c
image.o: image.c image.h palette.h debug.h fscoeff.h global.h gamma.h syslog.h
$(CC) $(CFLAGS) -c image.c
gamma.o: gamma.c image.h global.h gamma.h
$(CC) $(CFLAGS) -c gamma.c
dither.o: dither.c dither.h image.h palette.h debug.h fscoeff.h global.h hash_ink.h
$(CC) $(CFLAGS) -c dither.c
pnm2ppa.o: pnm2ppa.c pnm2ppa.h image.h ppa.h debug.h global.h gamma.h syslog.h
$(CC) $(CFLAGS) -c pnm2ppa.c
ppa.o: ppa.c ppa.h debug.h global.h syslog.h
$(CC) $(CFLAGS) -c ppa.c
debug.o: debug.c debug.h global.h
$(CC) $(CFLAGS) -c debug.c
syslog.o: syslog.c syslog.h global.h
$(CC) $(CFLAGS) -c syslog.c
make_hash_ink: make_hash_ink.c palette.h hash_ink.h
$(CC) $(CFLAGS) -o make_hash_ink make_hash_ink.c
hash_ink.c: make_hash_ink
./make_hash_ink 4 3 > hash_ink.c
./make_hash_ink 1 5 >> hash_ink.c
hash_ink.o: hash_ink.c hash_ink.c
$(CC) $(CFLAGS) -c hash_ink.c
# a default rule, in case new .c files pop in
.c.o: $*.c ppa.h image.h enh-curve.h palette.h debug.h global.h
$(CC) $(CFLAGS) -c $*.c
distrib: clean
cd .. && tar cf - pnm2ppa/ | gzip -9 > pnm2ppa.tar.gz
sync