Home | History | Annotate | Download | only in scripts
      1 # makefile for libpng.a and libpng16.so, SGI IRIX with 'cc'
      2 # Copyright (C) 2001-2002, 2006, 2007, 2010-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 # Library name:
     10 LIBNAME=libpng16
     11 PNGMAJ = 16
     12 
     13 # Shared library names:
     14 LIBSO=$(LIBNAME).so
     15 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
     16 LIBSOREL=$(LIBSOMAJ).$(RELEASE)
     17 OLDSO=libpng.so
     18 
     19 # Utilities:
     20 AR_RC=ar rc
     21 CC=cc
     22 MKDIR_P=mkdir -p
     23 LN_SF=ln -sf
     24 RANLIB=echo
     25 RM_F=/bin/rm -f
     26 
     27 # Where make install puts libpng.a, libpng16.so, and libpng16/png.h
     28 # Prefix must be a full pathname.
     29 
     30 prefix=/usr/local
     31 exec_prefix=$(prefix)
     32 
     33 # Where the zlib library and include files are located
     34 #ZLIBLIB=/usr/local/lib32
     35 #ZLIBINC=/usr/local/include
     36 #ZLIBLIB=/usr/local/lib
     37 #ZLIBINC=/usr/local/include
     38 ZLIBLIB=../zlib
     39 ZLIBINC=../zlib
     40 
     41 # ABI can be blank to use default for your system, -32, -o32, -n32, or -64
     42 # See "man abi".  zlib must be built with the same ABI.
     43 ABI=
     44 
     45 WARNMORE=-fullwarn
     46 # Note: -KPIC is the default anyhow
     47 CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
     48 #CFLAGS= $(ABI) -O $(WARNMORE) -KPIC # -g
     49 CFLAGS=$(ABI) -O $(WARNMORE)
     50 LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng16 -lz -lm
     51 LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
     52 LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
     53 	-set_version sgi$(PNGMAJ).0
     54 # See "man dso" for info about shared objects
     55 
     56 INCPATH=$(prefix)/include
     57 LIBPATH=$(exec_prefix)/lib
     58 #LIBPATH=$(exec_prefix)/lib32
     59 MANPATH=$(prefix)/man
     60 BINPATH=$(exec_prefix)/bin
     61 
     62 # override DESTDIR= on the make install command line to easily support
     63 # installing into a temporary location.  Example:
     64 #
     65 #    make install DESTDIR=/tmp/build/libpng
     66 #
     67 # If you're going to install into a temporary location
     68 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
     69 # you execute make install.
     70 DESTDIR=
     71 
     72 DB=$(DESTDIR)$(BINPATH)
     73 DI=$(DESTDIR)$(INCPATH)
     74 DL=$(DESTDIR)$(LIBPATH)
     75 DM=$(DESTDIR)$(MANPATH)
     76 
     77 OBJS =  png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
     78 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
     79 	pngwtran.o pngmem.o pngerror.o pngpread.o
     80 
     81 .c.o:
     82 	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
     83 
     84 all: libpng.a pngtest shared libpng.pc libpng-config
     85 
     86 # see scripts/pnglibconf.mak for more options
     87 pnglibconf.h: scripts/pnglibconf.h.prebuilt
     88 	cp scripts/pnglibconf.h.prebuilt $@
     89 
     90 libpng.a: $(OBJS)
     91 	$(AR_RC) $@ $(OBJS)
     92 	$(RANLIB) $@
     93 
     94 libpng.pc:
     95 	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
     96 	-e s!@exec_prefix@!$(exec_prefix)! \
     97 	-e s!@libdir@!$(LIBPATH)! \
     98 	-e s!@includedir@!$(INCPATH)! \
     99 	-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
    100 
    101 libpng-config:
    102 	( cat scripts/libpng-config-head.in; \
    103 	echo prefix=\"$(prefix)\"; \
    104 	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
    105 	echo ccopts=\"$(ABI)\"; \
    106 	echo ldopts=\"$(ABI)\"; \
    107 	echo L_opts=\"-L$(LIBPATH)\"; \
    108 	echo libdir=\"$(LIBPATH)\"; \
    109 	echo libs=\"-lpng16 -lz -lm\"; \
    110 	cat scripts/libpng-config-body.in ) > libpng-config
    111 	chmod +x libpng-config
    112 
    113 $(LIBSO): $(LIBSOMAJ)
    114 	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
    115 
    116 $(LIBSOMAJ): $(OBJS)
    117 	$(LDSHARED) -o $@ $(OBJS)
    118 	$(RM_F) $(LIBSO) $(LIBSOMAJ)
    119 
    120 pngtest: pngtest.o libpng.a
    121 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
    122 
    123 test: pngtest
    124 	echo
    125 	echo Testing local static library.
    126 	./pngtest
    127 
    128 install-headers: png.h pngconf.h pnglibconf.h
    129 	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
    130 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
    131 	cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
    132 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
    133 	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
    134 	-@$(RM_F) $(DI)/libpng
    135 	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
    136 
    137 install-static: install-headers libpng.a
    138 	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
    139 	cp libpng.a $(DL)/$(LIBNAME).a
    140 	chmod 644 $(DL)/$(LIBNAME).a
    141 	-@$(RM_F) $(DL)/libpng.a
    142 	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
    143 
    144 install-shared: install-headers $(LIBSOMAJ) libpng.pc
    145 	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
    146 	-@$(RM_F) $(DL)/$(LIBSO)
    147 	-@$(RM_F) $(DL)/$(LIBSOREL)
    148 	-@$(RM_F) $(DL)/$(OLDSO)
    149 	cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
    150 	chmod 755 $(DL)/$(LIBSOREL)
    151 	(cd $(DL); \
    152 	$(LN_SF) $(LIBSOREL) $(LIBSO); \
    153 	$(LN_SF) $(LIBSO) $(OLDSO))
    154 	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
    155 	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
    156 	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
    157 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
    158 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
    159 	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
    160 
    161 install-man: libpng.3 libpngpf.3 png.5
    162 	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
    163 	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
    164 	-@$(RM_F) $(DM)/man3/libpng.3
    165 	-@$(RM_F) $(DM)/man3/libpngpf.3
    166 	cp libpng.3 $(DM)/man3
    167 	cp libpngpf.3 $(DM)/man3
    168 	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
    169 	-@$(RM_F) $(DM)/man5/png.5
    170 	cp png.5 $(DM)/man5
    171 
    172 install-config: libpng-config
    173 	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
    174 	-@$(RM_F) $(DB)/libpng-config
    175 	-@$(RM_F) $(DB)/$(LIBNAME)-config
    176 	cp libpng-config $(DB)/$(LIBNAME)-config
    177 	chmod 755 $(DB)/$(LIBNAME)-config
    178 	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
    179 
    180 install: install-static install-shared install-man install-config
    181 
    182 # If you installed in $(DESTDIR), test-installed won't work until you
    183 # move the library to its final location.  Use test-dd to test it
    184 # before then.
    185 
    186 test-dd:
    187 	echo
    188 	echo Testing installed dynamic shared library in $(DL).
    189 	$(CC) -I$(DI) $(CPPFLAGS) \
    190 	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
    191 	   -L$(DL) -L$(ZLIBLIB) \
    192 	   -rpath $(ZLIBLIB):$(DL) \
    193 	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
    194 	./pngtestd pngtest.png
    195 
    196 test-installed:
    197 	echo
    198 	echo Testing installed dynamic shared library.
    199 	$(CC) $(CPPFLAGS) \
    200 	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
    201 	   -L$(ZLIBLIB) \
    202 	   -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
    203 	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
    204 	./pngtesti pngtest.png
    205 
    206 clean:
    207 	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
    208 	$(LIBSO) $(LIBSOMAJ)* \
    209 	so_locations pnglibconf.h
    210 
    211 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
    212 writelock:
    213 	chmod a-w *.[ch35] $(DOCS) scripts/*
    214 
    215 # DO NOT DELETE THIS LINE -- make depend depends on it.
    216 
    217 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    218 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    219 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    220 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    221 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    222 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    223 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    224 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    225 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    226 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    227 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    228 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    229 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    230 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    231 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    232 
    233 pngtest.o: png.h pngconf.h pnglibconf.h
    234