1# Makefile for PngMinus (rpng2) 2# Linux / Unix 3 4#CC=cc 5CC=gcc 6LD=$(CC) 7 8# If awk fails try 9# make AWK=nawk 10 11# If cpp fails try 12# make CPP=/lib/cpp 13 14RM=rm -f 15COPY=cp 16 17#XINC = -I/usr/include # old-style, stock X distributions 18#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX) 19 20#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows) 21#XLIB = -L/usr/openwin/lib -lX11 22 23XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.) 24XLIB = -L/usr/X11R6/lib -lX11 25#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64 26 27#XINC = -I/usr/local/include # FreeBSD 28#XLIB = -L/usr/local/lib -lX11 29 30#LIBS = $(XLIB) 31LIBS = $(XLIB) -lm #platforms that need libm 32 33CPPFLAGS=-I. $(XINC) -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP 34CFLAGS=-O1 -Wall 35 36C=.c 37O=.o 38L=.a 39E= 40 41# Where to find the source code: 42PNGSRC =../../.. 43ZLIBSRC=$(PNGSRC)/../zlib 44PROGSRC=$(PNGSRC)/contrib/gregbook 45 46# Zlib (minimal inflate requirements - crc32 is used by libpng) 47# zutil can be eliminated if you provide your own zcalloc and zcfree 48ZSRCS = adler32$(C) crc32$(C) \ 49 inffast$(C) inflate$(C) inftrees$(C) \ 50 zutil$(C) 51 52# Standard headers 53ZH = zlib.h crc32.h inffast.h inffixed.h \ 54 inflate.h inftrees.h zutil.h 55 56# Machine generated headers 57ZCONF = zconf.h 58 59# Headers callers use 60ZINC = zlib.h $(ZCONF) 61 62# Headers the Zlib source uses 63ZHDRS = $(ZH) $(ZCONF) 64 65ZOBJS = adler32$(O) crc32$(O) \ 66 inffast$(O) inflate$(O) inftrees$(O) \ 67 zutil$(O) 68 69# libpng 70PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \ 71 pngpread$(C) pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \ 72 pngset$(C) pngtrans$(C) 73 74# Standard headers 75PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h 76 77# Machine generated headers 78PNGCONF=pnglibconf.h 79 80# Headers callers use 81PNGINC= png.h pngconf.h pngusr.h $(PNGCONF) 82 83# Headers the PNG library uses 84PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h 85 86PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ 87 pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \ 88 pngset$(O) pngtrans$(O) 89 90PROGSRCS= rpng2-x$(C) readpng2$(C) 91PROGHDRS= readpng2.h 92PROGDOCS= COPYING LICENSE 93PROGOBJS= rpng2-x$(O) readpng2$(O) 94 95OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS) 96 97# implicit make rules ------------------------------------------------------- 98 99.c$(O): 100 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< 101 102# dependencies 103 104all: $(PROGDOCS) rpng2-x$(E) 105 106rpng2-x$(E): $(OBJS) 107 $(LD) -o rpng2-x$(E) $(OBJS) $(LIBS) 108 109# The DFA_XTRA setting turns all libpng options off then 110# turns on those required for this minimal build. 111# The CPP_FLAGS setting causes pngusr.h to be included in 112# both the build of pnglibconf.h and, subsequently, when 113# building libpng itself. 114$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\ 115 $(PNGSRC)/scripts/pnglibconf.dfa \ 116 $(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa 117 $(RM) pnglibconf.h pnglibconf.dfn 118 $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\ 119 srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\ 120 DFA_XTRA="pngusr.dfa" $@ 121 122clean: 123 $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\ 124 srcdir=$(PNGSRC) clean 125 $(RM) rpng2-x$(O) 126 $(RM) rpng2-x$(E) 127 $(RM) $(OBJS) 128 129# distclean also removes the copied source and headers 130distclean: clean 131 $(RM) -r scripts # historical reasons 132 $(RM) $(PNGSRCS) $(PNGH) 133 $(RM) $(ZSRCS) $(ZH) $(ZCONF) 134 $(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS) 135 136# Header file dependencies: 137$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC) 138$(PNGOBJS): $(PNGHDRS) $(ZINC) 139$(ZOBJS): $(ZHDRS) 140 141# Gather the source code from the respective directories 142$(PNGSRCS) $(PNGH): $(PNGSRC)/$@ 143 $(RM) $@ 144 $(COPY) $(PNGSRC)/$@ $@ 145 146# No dependency on the ZLIBSRC target so that it only needs 147# to be specified once. 148$(ZSRCS) $(ZH): 149 $(RM) $@ 150 $(COPY) $(ZLIBSRC)/$@ $@ 151 152# The unconfigured zconf.h varies in name according to the 153# zlib release 154$(ZCONF): 155 $(RM) $@ 156 @for f in zconf.h.in zconf.in.h zconf.h; do\ 157 test -r $(ZLIBSRC)/$$f &&\ 158 echo $(COPY) $(ZLIBSRC)/$$f $@ &&\ 159 $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\ 160 done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1 161 162$(PROGSRCS) $(PROGHDRS) $(PROGDOCS): $(PROGSRC)/$@ 163 $(RM) $@ 164 $(COPY) $(PROGSRC)/$@ $@ 165 166# End of makefile for rpng2-x 167