blob: 67d84aaac3dfe64e1af8cb440991d1e527b85354 [file] [log] [blame]
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -05001# makefile for SCO OSr5 ELF and Unixware 7 with Native cc
Glenn Randers-Pehrson436ce2c2016-10-16 14:05:39 -05002# Contributed by Mike Hopkirk (hops at sco.com) modified from Makefile.lnx
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -05003# force ELF build dynamic linking, SONAME setting in lib and RPATH in app
Glenn Randers-Pehrson5af03072014-01-20 12:36:30 -06004# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -05005# Copyright (C) 1998 Greg Roelofs
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05006# Copyright (C) 1996, 1997 Andreas Dilger
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -05007#
Glenn Randers-Pehrsonbfbf8652009-06-26 21:46:52 -05008# This code is released under the libpng license.
Glenn Randers-Pehrsonc332bbc2009-06-25 13:43:50 -05009# For conditions of distribution and use, see the disclaimer
Glenn Randers-Pehrson037023b2009-06-24 10:27:36 -050010# and license in png.h
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050011
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060012# Library name:
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -060013LIBNAME = libpng16
14PNGMAJ = 16
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060015
16# Shared library names:
17LIBSO=$(LIBNAME).so
18LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -060019LIBSOREL=$(LIBSOMAJ).$(RELEASE)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060020OLDSO=libpng.so
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060021
22# Utilities:
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050023CC=cc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060024AR_RC=ar rc
25MKDIR_P=mkdir
26LN_SF=ln -f -s
27RANLIB=echo
Cosmin Truta82200da2014-03-22 09:29:59 -050028CP=cp
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060029RM_F=/bin/rm -f
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050030
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060031# where make install puts libpng.a, $(OLDSO)*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060032prefix=/usr/local
Glenn Randers-Pehrsonad310542006-04-18 05:31:20 -050033exec_prefix=$(prefix)
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060034
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050035# Where the zlib library and include files are located
36#ZLIBLIB=/usr/local/lib
37#ZLIBINC=/usr/local/include
38ZLIBLIB=../zlib
39ZLIBINC=../zlib
40
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060041CPPFLAGS=-I$(ZLIBINC)
42CFLAGS= -dy -belf -O3
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -060043LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050044
Glenn Randers-Pehrson316152f2009-12-04 08:42:32 -060045INCPATH=$(prefix)/include
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060046LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050047MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060048BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050049
50# override DESTDIR= on the make install command line to easily support
51# installing into a temporary location. Example:
52#
53# make install DESTDIR=/tmp/build/libpng
54#
55# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050056# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050057# you execute make install.
58DESTDIR=
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050059
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050060DB=$(DESTDIR)$(BINPATH)
61DI=$(DESTDIR)$(INCPATH)
62DL=$(DESTDIR)$(LIBPATH)
63DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050064
Cosmin Truta9ab7b4c2014-03-22 13:13:11 -050065# Pre-built configuration
66# See scripts/pnglibconf.mak for more options
67PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
68
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050069OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050070 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
71 pngwtran.o pngmem.o pngerror.o pngpread.o
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050072
73OBJSDLL = $(OBJS:.o=.pic.o)
74
75.SUFFIXES: .c .o .pic.o
76
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060077.c.o:
78 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
79
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050080.c.pic.o:
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060081 $(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050082
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050083all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050084
Cosmin Truta9ab7b4c2014-03-22 13:13:11 -050085pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
Glenn Randers-Pehrsonff649a02014-08-07 19:51:35 -050086 $(CP) $(PNGLIBCONF_H_PREBUILT) $@
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050087
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050088libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060089 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050090 $(RANLIB) $@
91
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050092libpng.pc:
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050093 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
94 -e s!@exec_prefix@!$(exec_prefix)! \
95 -e s!@libdir@!$(LIBPATH)! \
96 -e s!@includedir@!$(INCPATH)! \
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -060097 -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050098
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050099libpng-config:
100 ( cat scripts/libpng-config-head.in; \
101 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500102 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
103 echo ccopts=\"-belf\"; \
104 echo L_opts=\"-L$(LIBPATH)\"; \
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -0600105 echo libs=\"-lpng16 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500106 cat scripts/libpng-config-body.in ) > libpng-config
107 chmod +x libpng-config
108
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600109$(LIBSO): $(LIBSOMAJ)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500110 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500111
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600112$(LIBSOMAJ): $(OBJSDLL)
113 $(CC) -G -Wl,-h,$(LIBSOMAJ) -o $(LIBSOMAJ) \
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500114 $(OBJSDLL)
115
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600116pngtest: pngtest.o $(LIBSO)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500117 LD_RUN_PATH=.:$(ZLIBLIB) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
118
119test: pngtest
120 ./pngtest
121
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600122install-headers: png.h pngconf.h pnglibconf.h
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600123 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
124 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600125 -@$(RM_F) $(DI)/png.h
126 -@$(RM_F) $(DI)/pngconf.h
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -0500127 -@$(RM_F) $(DI)/pnglibconf.h
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600128 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
129 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
130 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600131 -@$(RM_F) $(DI)/libpng
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500132 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600133
134install-static: install-headers libpng.a
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600135 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500136 cp libpng.a $(DL)/$(LIBNAME).a
137 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600138 -@$(RM_F) $(DL)/libpng.a
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500139 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600140
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600141install-shared: install-headers $(LIBSOMAJ) libpng.pc
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600142 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600143 -@$(RM_F) $(DL)/$(LIBSO)
144 -@$(RM_F) $(DL)/$(LIBSOREL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600145 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600146 cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
147 chmod 755 $(DL)/$(LIBSOREL)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500148 (cd $(DL); \
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600149 $(LN_SF) $(LIBSOREL) $(LIBSO); \
150 $(LN_SF) $(LIBSO) $(OLDSO))
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600151 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600152 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
153 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500154 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
155 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500156 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600157
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500158install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600159 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
160 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600161 -@$(RM_F) $(DM)/man3/libpng.3
162 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500163 cp libpng.3 $(DM)/man3
164 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600165 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600166 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500167 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500168
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500169install-config: libpng-config
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600170 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600171 -@$(RM_F) $(DB)/libpng-config
172 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500173 cp libpng-config $(DB)/$(LIBNAME)-config
174 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500175 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500176
177install: install-static install-shared install-man install-config
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500178
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500179# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500180# move the library to its final location. Use test-dd to test it
181# before then.
182
183test-dd:
184 echo
185 echo Testing installed dynamic shared library in $(DL).
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -0600186 $(CC) -I$(DI) $(CPPFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600187 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500188 -L$(DL) -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600189 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500190 ./pngtestd pngtest.png
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500191
192test-installed:
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -0600193 $(CC) $(CPPFLAGS) $(CFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600194 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500195 -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600196 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500197 ./pngtesti pngtest.png
198
199clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600200 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600201 $(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -0500202 pnglibconf.h libpng.pc
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500203
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600204DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
205writelock:
206 chmod a-w *.[ch35] $(DOCS) scripts/*
207
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500208# DO NOT DELETE THIS LINE -- make depend depends on it.
209
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -0600210png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
211pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
212pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
213pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
214pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
215pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
216pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
217pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
218pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
219pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
220pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
221pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
222pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
223pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
224pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500225
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600226pngtest.o: png.h pngconf.h pnglibconf.h