fukasawa e60969
# Makefile for PngMinus (pngm2pnm)
fukasawa e60969
# Linux / Unix
fukasawa e60969
fukasawa e60969
#CC=cc
fukasawa e60969
CC=gcc
fukasawa e60969
LD=$(CC)
fukasawa e60969
fukasawa e60969
# If awk fails try
fukasawa e60969
# make AWK=nawk
fukasawa e60969
fukasawa e60969
# If cpp fails try
fukasawa e60969
# make CPP=/lib/cpp
fukasawa e60969
fukasawa e60969
RM=rm -f
fukasawa e60969
COPY=cp
fukasawa e60969
fukasawa e60969
CPPFLAGS=-I. -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP
fukasawa e60969
CFLAGS=-O1 -Wall
fukasawa e60969
fukasawa e60969
C=.c
fukasawa e60969
O=.o
fukasawa e60969
L=.a
fukasawa e60969
E=
fukasawa e60969
fukasawa e60969
# Where to find the source code:
fukasawa e60969
PNGSRC =../../..
fukasawa e60969
ZLIBSRC=$(PNGSRC)/../zlib
fukasawa e60969
PROGSRC=$(PNGSRC)/contrib/pngminus
fukasawa e60969
fukasawa e60969
# Zlib (minimal inflate requirements - crc32 is used by libpng)
fukasawa e60969
# zutil can be eliminated if you provide your own zcalloc and zcfree
fukasawa e60969
ZSRCS  = adler32$(C) crc32$(C) \
fukasawa e60969
	 inffast$(C) inflate$(C) inftrees$(C) \
fukasawa e60969
	 zutil$(C)
fukasawa e60969
fukasawa e60969
# Standard headers
fukasawa e60969
ZH     = zlib.h crc32.h inffast.h inffixed.h \
fukasawa e60969
	 inflate.h inftrees.h zutil.h
fukasawa e60969
fukasawa e60969
# Machine generated headers
fukasawa e60969
ZCONF  = zconf.h
fukasawa e60969
fukasawa e60969
# Headers callers use
fukasawa e60969
ZINC   = zlib.h $(ZCONF)
fukasawa e60969
fukasawa e60969
# Headers the Zlib source uses
fukasawa e60969
ZHDRS  = $(ZH) $(ZCONF)
fukasawa e60969
fukasawa e60969
ZOBJS  = adler32$(O) crc32$(O) \
fukasawa e60969
	 inffast$(O) inflate$(O) inftrees$(O) \
fukasawa e60969
	 zutil$(O)
fukasawa e60969
fukasawa e60969
# libpng
fukasawa e60969
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
fukasawa e60969
	pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
fukasawa e60969
	pngset$(C) pngtrans$(C)
fukasawa e60969
	
fukasawa e60969
# Standard headers
fukasawa e60969
PNGH   =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
fukasawa e60969
fukasawa e60969
# Machine generated headers
fukasawa e60969
PNGCONF=pnglibconf.h
fukasawa e60969
fukasawa e60969
# Headers callers use
fukasawa e60969
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
fukasawa e60969
fukasawa e60969
# Headers the PNG library uses
fukasawa e60969
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
fukasawa e60969
fukasawa e60969
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
fukasawa e60969
	pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
fukasawa e60969
	pngset$(O) pngtrans$(O)
fukasawa e60969
fukasawa e60969
PROGSRCS= pngm2pnm$(C)
fukasawa e60969
PROGHDRS=
fukasawa e60969
PROGDOCS=
fukasawa e60969
PROGOBJS= pngm2pnm$(O)
fukasawa e60969
fukasawa e60969
OBJS    = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
fukasawa e60969
fukasawa e60969
# implicit make rules -------------------------------------------------------
fukasawa e60969
fukasawa e60969
# note: dependencies do not work on implicit rule lines
fukasawa e60969
.c$(O):
fukasawa e60969
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
fukasawa e60969
fukasawa e60969
# dependencies
fukasawa e60969
fukasawa e60969
all: pngm2pnm$(E)
fukasawa e60969
fukasawa e60969
pngm2pnm$(E): $(OBJS)
fukasawa e60969
	$(LD) -o pngm2pnm$(E) $(OBJS)
fukasawa e60969
fukasawa e60969
# The DFA_XTRA setting turns all libpng options off then
fukasawa e60969
# turns on those required for this minimal build.
fukasawa e60969
# The CPP_FLAGS setting causes pngusr.h to be included in
fukasawa e60969
# both the build of pnglibconf.h and, subsequently, when
fukasawa e60969
# building libpng itself.
fukasawa e60969
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
fukasawa e60969
	$(PNGSRC)/scripts/pnglibconf.dfa \
fukasawa e60969
	$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
fukasawa e60969
	$(RM) pnglibconf.h pnglibconf.dfn
fukasawa e60969
	$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
fukasawa e60969
	    srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
fukasawa e60969
	    DFA_XTRA="pngusr.dfa" $@
fukasawa e60969
fukasawa e60969
clean:
fukasawa e60969
	$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
fukasawa e60969
	    srcdir=$(PNGSRC) clean
fukasawa e60969
	$(RM) pngm2pnm$(O)
fukasawa e60969
	$(RM) pngm2pnm$(E)
fukasawa e60969
	$(RM) $(OBJS)
fukasawa e60969
fukasawa e60969
# distclean also removes the copied source and headers
fukasawa e60969
distclean: clean
fukasawa e60969
	$(RM) -r scripts # historical reasons
fukasawa e60969
	$(RM) $(PNGSRCS) $(PNGH)
fukasawa e60969
	$(RM) $(ZSRCS) $(ZH) $(ZCONF)
fukasawa e60969
	$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
fukasawa e60969
fukasawa e60969
# Header file dependencies:
fukasawa e60969
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
fukasawa e60969
$(PNGOBJS): $(PNGHDRS) $(ZINC)
fukasawa e60969
$(ZOBJS): $(ZHDRS)
fukasawa e60969
fukasawa e60969
# Gather the source code from the respective directories
fukasawa e60969
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
fukasawa e60969
	$(RM) $@
fukasawa e60969
	$(COPY) $(PNGSRC)/$@ $@
fukasawa e60969
fukasawa e60969
# No dependency on the ZLIBSRC target so that it only needs
fukasawa e60969
# to be specified once.
fukasawa e60969
$(ZSRCS) $(ZH):
fukasawa e60969
	$(RM) $@
fukasawa e60969
	$(COPY) $(ZLIBSRC)/$@ $@
fukasawa e60969
fukasawa e60969
# The unconfigured zconf.h varies in name according to the
fukasawa e60969
# zlib release
fukasawa e60969
$(ZCONF):
fukasawa e60969
	$(RM) $@
fukasawa e60969
	@for f in zconf.h.in zconf.in.h zconf.h; do\
fukasawa e60969
	    test -r $(ZLIBSRC)/$$f &&\
fukasawa e60969
	    echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
fukasawa e60969
	    $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
fukasawa e60969
	done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
fukasawa e60969
fukasawa e60969
pngm2pnm.c: $(PROGSRC)/png2pnm.c
fukasawa e60969
	$(RM) $@
fukasawa e60969
	$(COPY) $(PROGSRC)/png2pnm.c $@
fukasawa e60969
fukasawa e60969
# End of makefile for pngm2pnm