Home | History | Annotate | Download | only in scripts
      1 # makefile for libpng
      2 # Copyright (C) 2002, 2006, 2009, 2014 Glenn Randers-Pehrson
      3 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
      4 #
      5 # This code is released under the libpng license.
      6 # For conditions of distribution and use, see the disclaimer
      7 # and license in png.h
      8 #
      9 # This makefile requires the file ansi2knr.c, which you can get
     10 # from the Ghostscript ftp site at ftp://ftp.cs.wisc.edu/ghost/
     11 # If you have libjpeg, you probably already have ansi2knr.c in the jpeg
     12 # source distribution.
     13 
     14 # where make install puts libpng.a and png.h
     15 prefix=/usr/local
     16 INCPATH=$(prefix)/include
     17 LIBPATH=$(prefix)/lib
     18 
     19 # override DESTDIR= on the make install command line to easily support
     20 # installing into a temporary location.  Example:
     21 #
     22 #    make install DESTDIR=/tmp/build/libpng
     23 #
     24 # If you're going to install into a temporary location
     25 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
     26 # you execute make install.
     27 DESTDIR=
     28 
     29 CC = cc
     30 CPPFLAGS = -I../zlib
     31 CFLAGS = -O
     32 LDFLAGS = -L. -L../zlib/ -lpng -lz -lm
     33 # flags for ansi2knr
     34 ANSI2KNRFLAGS=
     35 
     36 RANLIB = ranlib
     37 #RANLIB = echo
     38 
     39 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
     40 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
     41 	pngwtran.o pngmem.o pngerror.o pngpread.o
     42 
     43 all: ansi2knr libpng.a pngtest
     44 
     45 # see scripts/pnglibconf.mak for more options
     46 pnglibconf.h: scripts/pnglibconf.h.prebuilt
     47 	cp scripts/pnglibconf.h.prebuilt $@
     48 
     49 # general rule to allow ansi2knr to work
     50 .c.o:
     51 	./ansi2knr $*.c T$*.c
     52 	$(CC) $(CPPFLAGS) $(CFLAGS) -c T$*.c
     53 	rm -f T$*.c $*.o
     54 	mv T$*.o $*.o
     55 
     56 ansi2knr: ansi2knr.c
     57 	$(CC) $(CPPFLAGS) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
     58 
     59 libpng.a: ansi2knr $(OBJS)
     60 	ar rc $@  $(OBJS)
     61 	$(RANLIB) $@
     62 
     63 pngtest: pngtest.o libpng.a
     64 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
     65 
     66 test: pngtest
     67 	./pngtest
     68 
     69 install: libpng.a png.h pngconf.h pnglibconf.h
     70 	-@mkdir $(DESTDIR)$(INCPATH)
     71 	-@mkdir $(DESTDIR)$(INCPATH)/libpng
     72 	-@mkdir $(DESTDIR)$(LIBPATH)
     73 	-@rm -f $(DESTDIR)$(INCPATH)/png.h
     74 	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
     75 	cp png.h $(DESTDIR)$(INCPATH)/libpng
     76 	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
     77 	cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
     78 	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
     79 	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
     80 	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
     81 	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
     82 	cp libpng.a $(DESTDIR)$(LIBPATH)
     83 	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
     84 
     85 clean:
     86 	rm -f *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h
     87 
     88 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
     89 writelock:
     90 	chmod a-w *.[ch35] $(DOCS) scripts/*
     91 
     92 # DO NOT DELETE THIS LINE -- make depend depends on it.
     93 
     94 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
     95 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
     96 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
     97 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
     98 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
     99 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    100 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    101 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    102 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    103 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    104 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    105 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    106 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    107 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    108 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    109 
    110 pngtest.o: png.h pngconf.h pnglibconf.h
    111