Home | History | Annotate | Download | only in scripts
      1 # makefile for libpng on DEC Alpha Unix
      2 # Copyright (C) 2000-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 PNGMAJ = 16
     11 LIBNAME = libpng16
     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
     23 LN_SF=ln -f -s
     24 RANLIB=ranlib
     25 CP=cp
     26 RM_F=/bin/rm -f
     27 
     28 # where make install puts libpng.a and png.h
     29 prefix=/usr/local
     30 exec_prefix=$(prefix)
     31 INCPATH=$(prefix)/include
     32 LIBPATH=$(exec_prefix)/lib
     33 MANPATH=$(prefix)/man
     34 BINPATH=$(exec_prefix)/bin
     35 
     36 # override DESTDIR= on the make install command line to easily support
     37 # installing into a temporary location.  Example:
     38 #
     39 #    make install DESTDIR=/tmp/build/libpng
     40 #
     41 # If you're going to install into a temporary location
     42 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
     43 # you execute make install.
     44 DESTDIR=
     45 
     46 DB=$(DESTDIR)$(BINPATH)
     47 DI=$(DESTDIR)$(INCPATH)
     48 DL=$(DESTDIR)$(LIBPATH)
     49 DM=$(DESTDIR)$(MANPATH)
     50 
     51 # Where the zlib library and include files are located
     52 #ZLIBLIB=/usr/local/lib
     53 #ZLIBINC=/usr/local/include
     54 ZLIBLIB=../zlib
     55 ZLIBINC=../zlib
     56 
     57 CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
     58 CFLAGS=-std -w1 -O # -g
     59 LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
     60 
     61 # Pre-built configuration
     62 # See scripts/pnglibconf.mak for more options
     63 PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
     64 
     65 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
     66 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
     67 	pngwtran.o pngmem.o pngerror.o pngpread.o
     68 
     69 .c.o:
     70 	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
     71 
     72 all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
     73 
     74 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
     75 	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
     76 
     77 libpng.a: $(OBJS)
     78 	$(AR_RC) $@  $(OBJS)
     79 	$(RANLIB) $@
     80 
     81 libpng.pc:
     82 	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
     83 	-e s!@exec_prefix@!$(exec_prefix)! \
     84 	-e s!@libdir@!$(LIBPATH)! \
     85 	-e s!@includedir@!$(INCPATH)! \
     86 	-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
     87 
     88 libpng-config:
     89 	( cat scripts/libpng-config-head.in; \
     90 	echo prefix=\"$(prefix)\"; \
     91 	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
     92 	echo ccopts=\"-std\"; \
     93 	echo L_opts=\"-L$(LIBPATH)\"; \
     94 	echo libs=\"-lpng16 -lz -lm\"; \
     95 	cat scripts/libpng-config-body.in ) > libpng-config
     96 	chmod +x libpng-config
     97 
     98 $(LIBSO): $(LIBSOMAJ)
     99 	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
    100 
    101 $(LIBSOMAJ): $(OBJS)
    102 	$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
    103 	-soname $(LIBSOMAJ)
    104 
    105 pngtest: pngtest.o libpng.a
    106 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
    107 
    108 test: pngtest
    109 	./pngtest
    110 
    111 install-headers: png.h pngconf.h pnglibconf.h
    112 	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
    113 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
    114 	cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
    115 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
    116 	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
    117 	-@/bin/rm -f $(DI)/libpng
    118 	(cd $(DI); $(LN_SF)(LIBNAME) libpng; $(LN_SF)(LIBNAME)/* .)
    119 
    120 install-static: install-headers libpng.a
    121 	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
    122 	cp libpng.a $(DL)/$(LIBNAME).a
    123 	chmod 644 $(DL)/$(LIBNAME).a
    124 	-@/bin/rm -f $(DL)/libpng.a
    125 	(cd $(DL); $(LN_SF)(LIBNAME).a libpng.a)
    126 
    127 install-shared: install-headers $(LIBSOMAJ) libpng.pc
    128 	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
    129 	-@$(RM_F) $(DL)/$(LIBSO)
    130 	-@$(RM_F) $(DL)/$(LIBSOREL)
    131 	-@$(RM_F) $(DL)/$(OLDSO)
    132 	cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
    133 	chmod 755 $(DL)/$(LIBSOREL)
    134 	(cd $(DL); \
    135 	$(LN_SF) $(LIBSOREL) $(LIBSO); \
    136 	$(LN_SF) $(LIBSO) $(OLDSO))
    137 	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
    138 	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
    139 	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
    140 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
    141 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
    142 	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
    143 
    144 install-man: libpng.3 libpngpf.3 png.5
    145 	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
    146 	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
    147 	-@/bin/rm -f $(DM)/man3/libpng.3
    148 	-@/bin/rm -f $(DM)/man3/libpngpf.3
    149 	cp libpng.3 $(DM)/man3
    150 	cp libpngpf.3 $(DM)/man3
    151 	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
    152 	-@/bin/rm -f $(DM)/man5/png.5
    153 	cp png.5 $(DM)/man5
    154 
    155 install-config: libpng-config
    156 	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
    157 	-@/bin/rm -f $(DB)/libpng-config
    158 	-@/bin/rm -f $(DB)/$(LIBNAME)-config
    159 	cp libpng-config $(DB)/$(LIBNAME)-config
    160 	chmod 755 $(DB)/$(LIBNAME)-config
    161 	(cd $(DB); $(LN_SF)(LIBNAME)-config libpng-config)
    162 
    163 install: install-static install-shared install-man install-config
    164 
    165 # If you installed in $(DESTDIR), test-installed won't work until you
    166 # move the library to its final location.  Use test-dd to test it
    167 # before then.
    168 
    169 test-dd:
    170 	echo
    171 	echo Testing installed dynamic shared library in $(DL).
    172 	$(CC) -w1 -I$(DI) $(CPPFLAGS) \
    173 	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
    174 	   -L$(DL) -L$(ZLIBLIB)  -R$(ZLIBLIB) -R$(DL) \
    175 	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
    176 	./pngtestd pngtest.png
    177 
    178 test-installed:
    179 	echo
    180 	echo Testing installed dynamic shared library.
    181 	$(CC) -w1 $(CPPFLAGS) \
    182 	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
    183 	   -L$(ZLIBLIB) -R$(ZLIBLIB) \
    184 	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
    185 	./pngtesti pngtest.png
    186 
    187 clean:
    188 	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
    189 	libpng-config $(LIBSO) $(LIBSOMAJ)* \
    190 	libpng.pc pnglibconf.h
    191 
    192 # DO NOT DELETE THIS LINE -- make depend depends on it.
    193 
    194 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    195 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    196 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    197 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    198 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    199 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    200 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    201 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    202 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    203 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    204 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    205 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    206 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    207 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    208 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    209 
    210 pngtest.o: png.h pngconf.h pnglibconf.h
    211