Home | History | Annotate | Download | only in preader
      1 # Makefile for PngMinus (rpng2)
      2 # Linux / Unix
      3 
      4 #CC=cc
      5 CC=gcc
      6 LD=$(CC)
      7 
      8 # If awk fails try
      9 # make AWK=nawk
     10 
     11 # If cpp fails try
     12 # make CPP=/lib/cpp
     13 
     14 RM=rm -f
     15 COPY=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 
     23 XINC = -I/usr/X11R6/include		# new X distributions (X.org, etc.)
     24 XLIB = -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)
     31 LIBS = $(XLIB) -lm                      #platforms that need libm
     32 
     33 CPPFLAGS=-I. $(XINC) -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP
     34 CFLAGS=-O1 -Wall
     35 
     36 C=.c
     37 O=.o
     38 L=.a
     39 E=
     40 
     41 # Where to find the source code:
     42 PNGSRC =../../..
     43 ZLIBSRC=$(PNGSRC)/../zlib
     44 PROGSRC=$(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
     48 ZSRCS  = adler32$(C) crc32$(C) \
     49 	 inffast$(C) inflate$(C) inftrees$(C) \
     50 	 zutil$(C)
     51 
     52 # Standard headers
     53 ZH     = zlib.h crc32.h inffast.h inffixed.h \
     54 	 inflate.h inftrees.h zutil.h
     55 
     56 # Machine generated headers
     57 ZCONF  = zconf.h
     58 
     59 # Headers callers use
     60 ZINC   = zlib.h $(ZCONF)
     61 
     62 # Headers the Zlib source uses
     63 ZHDRS  = $(ZH) $(ZCONF)
     64 
     65 ZOBJS  = adler32$(O) crc32$(O) \
     66 	 inffast$(O) inflate$(O) inftrees$(O) \
     67 	 zutil$(O)
     68 
     69 # libpng
     70 PNGSRCS=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
     75 PNGH   =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
     76 
     77 # Machine generated headers
     78 PNGCONF=pnglibconf.h
     79 
     80 # Headers callers use
     81 PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
     82 
     83 # Headers the PNG library uses
     84 PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
     85 
     86 PNGOBJS=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 
     90 PROGSRCS= rpng2-x$(C) readpng2$(C)
     91 PROGHDRS= readpng2.h
     92 PROGDOCS= COPYING LICENSE
     93 PROGOBJS= rpng2-x$(O) readpng2$(O)
     94 
     95 OBJS    = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
     96 
     97 # implicit make rules -------------------------------------------------------
     98 
     99 .c$(O):
    100 	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
    101 
    102 # dependencies
    103 
    104 all: $(PROGDOCS) rpng2-x$(E)
    105 
    106 rpng2-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 
    122 clean:
    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
    130 distclean: 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