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, 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=gcc
     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=
     46 CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
     47 CFLAGS=$(ABI) -O $(WARNMORE) -fPIC -mabi=n32 # -g
     48 LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
     49 LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
     50 	-set_version sgi$(PNGMAJ).0
     51 # See "man dso" for info about shared objects
     52 
     53 INCPATH=$(prefix)/include
     54 LIBPATH=$(exec_prefix)/lib
     55 #LIBPATH=$(exec_prefix)/lib32
     56 MANPATH=$(prefix)/man
     57 BINPATH=$(exec_prefix)/bin
     58 
     59 # override DESTDIR= on the make install command line to easily support
     60 # installing into a temporary location.  Example:
     61 #
     62 #    make install DESTDIR=/tmp/build/libpng
     63 #
     64 # If you're going to install into a temporary location
     65 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
     66 # you execute make install.
     67 DESTDIR=
     68 
     69 DB=$(DESTDIR)$(BINPATH)
     70 DI=$(DESTDIR)$(INCPATH)
     71 DL=$(DESTDIR)$(LIBPATH)
     72 DM=$(DESTDIR)$(MANPATH)
     73 
     74 OBJS =  png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
     75 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
     76 	pngwtran.o pngmem.o pngerror.o pngpread.o
     77 
     78 .c.o:
     79 	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
     80 
     81 all: libpng.a pngtest shared libpng.pc libpng-config
     82 
     83 # see scripts/pnglibconf.mak for more options
     84 pnglibconf.h: scripts/pnglibconf.h.prebuilt
     85 	cp scripts/pnglibconf.h.prebuilt $@
     86 
     87 libpng.a: $(OBJS)
     88 	$(AR_RC) $@ $(OBJS)
     89 	$(RANLIB) $@
     90 
     91 shared: $(LIBSOMAJ)
     92 
     93 libpng.pc:
     94 	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
     95 	-e s!@exec_prefix@!$(exec_prefix)! \
     96 	-e s!@libdir@!$(LIBPATH)! \
     97 	-e s!@includedir@!$(INCPATH)! \
     98 	-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
     99 
    100 libpng-config:
    101 	( cat scripts/libpng-config-head.in; \
    102 	echo prefix=\"$(prefix)\"; \
    103 	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
    104 	echo ccopts=\"$(ABI)\"; \
    105 	echo cppflags=\"\"; \
    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) libpng.a pngtest pngtesti pngout.png libpng.pc \
    208 	so_locations libpng-config $(LIBSO) $(LIBSOMAJ)* pnglibconf.h
    209 
    210 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
    211 writelock:
    212 	chmod a-w *.[ch35] $(DOCS) scripts/*
    213 
    214 # DO NOT DELETE THIS LINE -- make depend depends on it.
    215 
    216 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    217 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    218 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    219 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    220 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    221 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    222 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    223 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    224 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    225 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    226 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    227 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    228 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    229 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    230 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    231 
    232 pngtest.o: png.h pngconf.h pnglibconf.h
    233