2009-05-19 14:10:55 -04:00
|
|
|
# Makefile for PngMinus (pnm2pngm)
|
|
|
|
# Linux / Unix
|
|
|
|
|
|
|
|
#CC=cc
|
|
|
|
CC=gcc
|
|
|
|
LD=$(CC)
|
|
|
|
|
2010-06-21 13:28:05 -04:00
|
|
|
# If awk fails try
|
|
|
|
# make AWK=nawk
|
|
|
|
|
2011-03-19 15:49:03 -04:00
|
|
|
# If cpp fails try
|
|
|
|
# make CPP=/lib/cpp
|
|
|
|
|
2009-05-19 14:10:55 -04:00
|
|
|
RM=rm -f
|
2010-04-28 08:54:14 -04:00
|
|
|
COPY=cp
|
2009-05-19 14:10:55 -04:00
|
|
|
|
2013-03-02 15:58:22 -05:00
|
|
|
CFLAGS=-DPNG_USER_CONFIG -DZ_SOLO -DNO_GZIP -I. -O1
|
2009-05-19 14:10:55 -04:00
|
|
|
|
|
|
|
C=.c
|
|
|
|
O=.o
|
|
|
|
L=.a
|
|
|
|
E=
|
|
|
|
|
2010-04-28 08:54:14 -04:00
|
|
|
# Where to find the source code:
|
|
|
|
PNGSRC =../../..
|
|
|
|
ZLIBSRC=$(PNGSRC)/../zlib
|
|
|
|
PROGSRC=$(PNGSRC)/contrib/pngminus
|
|
|
|
|
|
|
|
# Zlib
|
|
|
|
ZSRCS = adler32$(C) compress$(C) crc32$(C) deflate$(C) \
|
|
|
|
trees$(C) zutil$(C)
|
|
|
|
|
|
|
|
# Standard headers
|
|
|
|
#ZH = zlib.h crc32.h deflate.h trees.h zutil.h
|
|
|
|
ZH = zlib.h crc32.h deflate.h trees.h zutil.h
|
|
|
|
|
|
|
|
# Machine generated headers
|
|
|
|
ZCONF = zconf.h
|
|
|
|
|
|
|
|
# Headers callers use
|
|
|
|
ZINC = zlib.h $(ZCONF)
|
|
|
|
|
|
|
|
# Headers the Zlib source uses
|
|
|
|
ZHDRS = $(ZH) $(ZCONF)
|
|
|
|
|
|
|
|
# compress is not required; it is needed to link the zlib
|
|
|
|
# code because deflate defines an unused API function deflateBound
|
|
|
|
# which itself calls compressBound from compress.
|
2010-02-22 00:07:13 -05:00
|
|
|
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
|
2010-04-28 08:54:14 -04:00
|
|
|
trees$(O) zutil$(O)
|
|
|
|
|
|
|
|
# libpng
|
|
|
|
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
|
|
|
|
pngset$(C) pngtrans$(C) pngwio$(C) pngwrite$(C) \
|
|
|
|
pngwtran$(C) pngwutil$(C)
|
|
|
|
|
2010-04-29 10:47:12 -04:00
|
|
|
# Standard headers
|
2010-04-28 08:54:14 -04:00
|
|
|
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
|
|
|
|
|
|
|
|
# Machine generated headers
|
|
|
|
PNGCONF=pnglibconf.h
|
2009-05-19 14:10:55 -04:00
|
|
|
|
2010-04-28 08:54:14 -04:00
|
|
|
# Headers callers use
|
|
|
|
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
|
|
|
|
|
|
|
|
# Headers the PNG library uses
|
|
|
|
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
|
|
|
|
|
|
|
|
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
2009-05-19 14:10:55 -04:00
|
|
|
pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \
|
2010-04-28 08:54:14 -04:00
|
|
|
pngwtran$(O) pngwutil$(O)
|
|
|
|
|
|
|
|
PROGSRCS= pnm2pngm$(C)
|
|
|
|
PROGHDRS=
|
|
|
|
PROGDOCS=
|
|
|
|
PROGOBJS= pnm2pngm$(O)
|
|
|
|
|
|
|
|
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
|
2009-05-19 14:10:55 -04:00
|
|
|
|
|
|
|
# implicit make rules -------------------------------------------------------
|
|
|
|
|
2010-04-17 19:07:33 -04:00
|
|
|
.c$(O):
|
2009-05-19 14:10:55 -04:00
|
|
|
$(CC) -c $(CFLAGS) $<
|
|
|
|
|
|
|
|
# dependencies
|
|
|
|
|
|
|
|
all: pnm2pngm$(E)
|
|
|
|
|
|
|
|
pnm2pngm$(E): $(OBJS)
|
|
|
|
$(LD) -o pnm2pngm$(E) $(OBJS)
|
|
|
|
|
2010-04-28 08:54:14 -04:00
|
|
|
# The DFA_XTRA setting turns all libpng options off then
|
|
|
|
# turns on those required for this minimal build.
|
|
|
|
# The CPP_FLAGS setting causes pngusr.h to be included in
|
|
|
|
# both the build of pnglibconf.h and, subsequently, when
|
|
|
|
# building libpng itself.
|
|
|
|
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
|
|
|
|
$(PNGSRC)/scripts/pnglibconf.dfa \
|
|
|
|
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
|
|
|
|
$(RM) pnglibconf.h pnglibconf.dfn
|
|
|
|
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
|
|
|
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
|
|
|
|
DFA_XTRA="pngusr.dfa" $@
|
2010-04-17 19:07:33 -04:00
|
|
|
|
2009-05-19 14:10:55 -04:00
|
|
|
clean:
|
2010-04-28 08:54:14 -04:00
|
|
|
$(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
|
|
|
|
srcdir=$(PNGSRC) clean
|
2009-05-19 14:10:55 -04:00
|
|
|
$(RM) pnm2pngm$(O)
|
|
|
|
$(RM) pnm2pngm$(E)
|
|
|
|
$(RM) $(OBJS)
|
|
|
|
|
2010-04-28 08:54:14 -04:00
|
|
|
# distclean also removes the copied source and headers
|
|
|
|
distclean: clean
|
|
|
|
$(RM) -r scripts # historical reasons
|
|
|
|
$(RM) $(PNGSRCS) $(PNGH)
|
|
|
|
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
|
|
|
|
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
|
|
|
|
|
|
|
|
# Header file dependencies:
|
|
|
|
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
|
|
|
|
$(PNGOBJS): $(PNGHDRS) $(ZINC)
|
|
|
|
$(ZOBJS): $(ZHDRS)
|
|
|
|
|
|
|
|
# Gather the source code from the respective directories
|
|
|
|
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
|
|
|
|
$(RM) $@
|
|
|
|
$(COPY) $(PNGSRC)/$@ $@
|
|
|
|
|
|
|
|
# No dependency on the ZLIBSRC target so that it only needs
|
|
|
|
# to be specified once.
|
|
|
|
$(ZSRCS) $(ZH):
|
|
|
|
$(RM) $@
|
|
|
|
$(COPY) $(ZLIBSRC)/$@ $@
|
|
|
|
|
|
|
|
# The unconfigured zconf.h varies in name according to the
|
|
|
|
# zlib release
|
|
|
|
$(ZCONF):
|
|
|
|
$(RM) $@
|
|
|
|
@for f in zconf.h.in zconf.in.h zconf.h; do\
|
|
|
|
test -r $(ZLIBSRC)/$$f &&\
|
|
|
|
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
|
|
|
|
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
|
|
|
|
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
|
|
|
|
|
|
|
|
pnm2pngm.c: $(PROGSRC)/pnm2png.c
|
|
|
|
$(RM) $@
|
|
|
|
$(COPY) $(PROGSRC)/pnm2png.c $@
|
2010-04-17 19:07:33 -04:00
|
|
|
|
|
|
|
# End of makefile for pnm2pngm
|