Home | History | Annotate | Download | only in scripts
      1 # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
      2 # Copyright (C) 1999-2002, 2006, 2010-2014 Glenn Randers-Pehrson
      3 # Copyright (C) 1995 Guy Eric Schalnat, Group 42
      4 # contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
      5 #
      6 # This code is released under the libpng license.
      7 # For conditions of distribution and use, see the disclaimer
      8 # and license in png.h
      9 
     10 # Where the zlib library and include files are located
     11 ZLIBLIB=/opt/zlib/lib
     12 ZLIBINC=/opt/zlib/include
     13 
     14 # Note that if you plan to build a libpng shared library, zlib must also
     15 # be a shared library, which zlib's configure does not do.  After running
     16 # zlib's configure, edit the appropriate lines of makefile to read:
     17 #   CPPFLAGS=-DHAVE_UNISTD -DUSE_MAP
     18 #   CFLAGS=-O1 -fPIC
     19 #   LDSHARED=ld -b
     20 #   SHAREDLIB=libz.sl
     21 
     22 # Library name:
     23 LIBNAME = libpng16
     24 PNGMAJ = 16
     25 
     26 # Shared library names:
     27 LIBSO=$(LIBNAME).sl
     28 LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
     29 LIBSOREL=$(LIBSOMAJ).$(RELEASE)
     30 OLDSO=libpng.sl
     31 
     32 # Utilities:
     33 AR_RC=ar rc
     34 CC=cc
     35 MKDIR_P=mkdir -p
     36 LN_SF=ln -sf
     37 RANLIB=ranlib
     38 RM_F=/bin/rm -f
     39 
     40 # where make install puts libpng.a, libpng16.sl, and png.h
     41 prefix=/opt/libpng
     42 exec_prefix=$(prefix)
     43 INCPATH=$(prefix)/include
     44 LIBPATH=$(exec_prefix)/lib
     45 MANPATH=$(prefix)/man
     46 BINPATH=$(exec_prefix)/bin
     47 
     48 CPPFLAGS=-I$(ZLIBINC)
     49 CFLAGS=-O -Ae +DA1.1 +DS2.0
     50 # Caution: be sure you have built zlib with the same CFLAGS.
     51 CCFLAGS=-O -Ae +DA1.1 +DS2.0
     52 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
     53 
     54 # override DESTDIR= on the make install command line to easily support
     55 # installing into a temporary location.  Example:
     56 #
     57 #    make install DESTDIR=/tmp/build/libpng
     58 #
     59 # If you're going to install into a temporary location
     60 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
     61 # you execute make install.
     62 DESTDIR=
     63 
     64 DB=$(DESTDIR)$(BINPATH)
     65 DI=$(DESTDIR)$(INCPATH)
     66 DL=$(DESTDIR)$(LIBPATH)
     67 DM=$(DESTDIR)$(MANPATH)
     68 
     69 # Pre-built configuration
     70 # See scripts/pnglibconf.mak for more options
     71 PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
     72 
     73 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
     74 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
     75 	pngwtran.o pngmem.o pngerror.o pngpread.o
     76 
     77 OBJSDLL = $(OBJS:.o=.pic.o)
     78 
     79 .SUFFIXES:	.c .o .pic.o
     80 
     81 .c.o:
     82 	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
     83 
     84 .c.pic.o:
     85 	$(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c
     86 
     87 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
     88 
     89 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
     90 	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
     91 
     92 libpng.a: $(OBJS)
     93 	$(AR_RC) $@ $(OBJS)
     94 	$(RANLIB) $@
     95 
     96 libpng.pc:
     97 	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
     98 	-e s!@exec_prefix@!$(exec_prefix)! \
     99 	-e s!@libdir@!$(LIBPATH)! \
    100 	-e s!@includedir@!$(INCPATH)! \
    101 	-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
    102 
    103 libpng-config:
    104 	( cat scripts/libpng-config-head.in; \
    105 	echo prefix=\"$(prefix)\"; \
    106 	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
    107 	echo ccopts=\"-O -Ae +DA1.1 +DS2.0\"; \
    108 	echo L_opts=\"-L$(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): $(OBJSDLL)
    117 	$(LD) -b +s \
    118 	+h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
    119 
    120 pngtest: pngtest.o libpng.a
    121 	$(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
    122 
    123 test: pngtest
    124 	./pngtest
    125 
    126 install-headers: png.h pngconf.h pnglibconf.h
    127 	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
    128 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
    129 	cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
    130 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
    131 	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
    132 	-@$(RM_F) $(DI)/libpng
    133 	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
    134 
    135 install-static: install-headers libpng.a
    136 	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
    137 	cp libpng.a $(DL)/$(LIBNAME).a
    138 	chmod 644 $(DL)/$(LIBNAME).a
    139 	-@$(RM_F) $(DL)/libpng.a
    140 	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
    141 
    142 install-shared: install-headers $(LIBSOMAJ) libpng.pc
    143 	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
    144 	-@$(RM_F) $(DL)/$(LIBSO)
    145 	-@$(RM_F) $(DL)/$(LIBSOREL)
    146 	-@$(RM_F) $(DL)/$(OLDSO)
    147 	cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
    148 	chmod 755 $(DL)/$(LIBSOREL)
    149 	(cd $(DL); \
    150 	$(LN_SF) $(LIBSOREL) $(LIBSO); \
    151 	$(LN_SF) $(LIBSO) $(OLDSO))
    152 	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
    153 	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
    154 	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
    155 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
    156 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
    157 	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
    158 
    159 install-man: libpng.3 libpngpf.3 png.5
    160 	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
    161 	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
    162 	-@$(RM_F) $(DM)/man3/libpng.3
    163 	-@$(RM_F) $(DM)/man3/libpngpf.3
    164 	cp libpng.3 $(DM)/man3
    165 	cp libpngpf.3 $(DM)/man3
    166 	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
    167 	-@$(RM_F) $(DM)/man5/png.5
    168 	cp png.5 $(DM)/man5
    169 
    170 install-config: libpng-config
    171 	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
    172 	-@$(RM_F) $(DB)/libpng-config
    173 	-@$(RM_F) $(DB)/$(LIBNAME)-config
    174 	cp libpng-config $(DB)/$(LIBNAME)-config
    175 	chmod 755 $(DB)/$(LIBNAME)-config
    176 	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
    177 
    178 install: install-static install-shared install-man install-config
    179 
    180 # If you installed in $(DESTDIR), test-installed won't work until you
    181 # move the library to its final location.  Use test-dd to test it
    182 # before then.
    183 
    184 test-dd:
    185 	echo
    186 	echo Testing installed dynamic shared library in $(DL).
    187 	$(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \
    188 	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
    189 	   -L$(DL) -L$(ZLIBLIB) \
    190 	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
    191 	./pngtestd pngtest.png
    192 
    193 test-installed:
    194 	echo
    195 	echo Testing installed dynamic shared library.
    196 	$(CC) $(CPPFLAGS) $(CCFLAGS) \
    197 	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
    198 	   -L$(ZLIBLIB) \
    199 	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
    200 	./pngtesti pngtest.png
    201 
    202 clean:
    203 	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
    204 	libpng-config $(LIBSO) $(LIBSOMAJ)* \
    205 	libpng.pc pnglibconf.h
    206 
    207 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
    208 writelock:
    209 	chmod a-w *.[ch35] $(DOCS) scripts/*
    210 
    211 # DO NOT DELETE THIS LINE -- make depend depends on it.
    212 
    213 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    214 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    215 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    216 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    217 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    218 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    219 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    220 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    221 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    222 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    223 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    224 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    225 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    226 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    227 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
    228 
    229 pngtest.o: png.h pngconf.h pnglibconf.h
    230