blob: a41198a8cee3b633ea53584aff1fb1904f5f9422 [file] [log] [blame]
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -05001# makefile for SCO OSr5 ELF and Unixware 7 with Native cc
2# Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
3# force ELF build dynamic linking, SONAME setting in lib and RPATH in app
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -06004# Copyright (C) 2002, 2006 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-Pehrsone0dc4c82009-06-25 12:17:26 -05008# This code is released under the zlib/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-Pehrson17218292006-04-20 07:20:46 -050013LIBNAME = libpng14
Glenn Randers-Pehrson56f63962008-10-06 10:16:17 -050014PNGMAJ = 14
Glenn Randers-Pehrsond84748a2009-06-24 08:17:34 -050015PNGMIN = 1.4.0beta65
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060016PNGVER = $(PNGMAJ).$(PNGMIN)
17
18# Shared library names:
19LIBSO=$(LIBNAME).so
20LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
21LIBSOVER=$(LIBNAME).so.$(PNGVER)
22OLDSO=libpng.so
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050023OLDSOMAJ=libpng.so.14
24OLDSOVER=libpng.so.14.$(PNGMIN)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060025
26# Utilities:
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050027CC=cc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060028AR_RC=ar rc
29MKDIR_P=mkdir
30LN_SF=ln -f -s
31RANLIB=echo
32RM_F=/bin/rm -f
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050033
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060034# where make install puts libpng.a, $(OLDSO)*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060035prefix=/usr/local
Glenn Randers-Pehrsonad310542006-04-18 05:31:20 -050036exec_prefix=$(prefix)
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060037
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050038# Where the zlib library and include files are located
39#ZLIBLIB=/usr/local/lib
40#ZLIBINC=/usr/local/include
41ZLIBLIB=../zlib
42ZLIBINC=../zlib
43
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -060044CFLAGS= -dy -belf -I$(ZLIBINC) -O3
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050045LDFLAGS=-L. -L$(ZLIBLIB) -lpng14 -lz -lm
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050046
Glenn Randers-Pehrsonfcbd7872002-04-07 16:35:38 -050047INCPATH=$(prefix)/include/libpng
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060048LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050049MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060050BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050051
52# override DESTDIR= on the make install command line to easily support
53# installing into a temporary location. Example:
54#
55# make install DESTDIR=/tmp/build/libpng
56#
57# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050058# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050059# you execute make install.
60DESTDIR=
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050061
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050062DB=$(DESTDIR)$(BINPATH)
63DI=$(DESTDIR)$(INCPATH)
64DL=$(DESTDIR)$(LIBPATH)
65DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050066
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050067OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050068 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
69 pngwtran.o pngmem.o pngerror.o pngpread.o
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050070
71OBJSDLL = $(OBJS:.o=.pic.o)
72
73.SUFFIXES: .c .o .pic.o
74
75.c.pic.o:
76 $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
77
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050078all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050079
80libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060081 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050082 $(RANLIB) $@
83
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050084libpng.pc:
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050085 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
86 -e s!@exec_prefix@!$(exec_prefix)! \
87 -e s!@libdir@!$(LIBPATH)! \
88 -e s!@includedir@!$(INCPATH)! \
89 -e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050090
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050091libpng-config:
92 ( cat scripts/libpng-config-head.in; \
93 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050094 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
95 echo ccopts=\"-belf\"; \
96 echo L_opts=\"-L$(LIBPATH)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050097 echo libs=\"-lpng14 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050098 cat scripts/libpng-config-body.in ) > libpng-config
99 chmod +x libpng-config
100
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600101$(LIBSO): $(LIBSOMAJ)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500102 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500103
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600104$(LIBSOMAJ): $(LIBSOVER)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500105 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500106
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600107$(LIBSOVER): $(OBJSDLL)
108 $(CC) -G -Wl,-h,$(LIBSOMAJ) -o $(LIBSOVER) \
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500109 $(OBJSDLL)
110
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500111$(OLDSOVER): $(OBJSDLL)
112 $(CC) -G -Wl,-h,$(OLDSOMAJ) -o $(OLDSOVER) \
113 $(OBJSDLL)
114
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600115pngtest: pngtest.o $(LIBSO)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500116 LD_RUN_PATH=.:$(ZLIBLIB) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
117
118test: pngtest
119 ./pngtest
120
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600121install-headers: png.h pngconf.h
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600122 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
123 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600124 -@$(RM_F) $(DI)/png.h
125 -@$(RM_F) $(DI)/pngconf.h
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500126 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500127 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500128 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600129 -@$(RM_F) $(DI)/libpng
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500130 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600131
132install-static: install-headers libpng.a
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600133 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500134 cp libpng.a $(DL)/$(LIBNAME).a
135 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600136 -@$(RM_F) $(DL)/libpng.a
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500137 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600138
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500139install-shared: install-headers $(LIBSOVER) libpng.pc \
140 $(OLDSOVER)
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600141 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600142 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
143 -@$(RM_F) $(DL)/$(LIBSOMAJ)
144 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500145 -@$(RM_F) $(DL)/$(OLDSOMAJ)
146 -@$(RM_F) $(DL)/$(OLDSOVER)*
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600147 cp $(LIBSOVER) $(DL)
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500148 cp $(OLDSOVER) $(DL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600149 chmod 755 $(DL)/$(LIBSOVER)
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500150 chmod 755 $(DL)/$(OLDSOVER)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500151 (cd $(DL); \
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500152 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
153 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500154 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500155 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600156 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600157 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
158 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500159 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
160 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500161 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600162
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500163install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600164 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
165 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600166 -@$(RM_F) $(DM)/man3/libpng.3
167 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500168 cp libpng.3 $(DM)/man3
169 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600170 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600171 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500172 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500173
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500174install-config: libpng-config
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600175 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600176 -@$(RM_F) $(DB)/libpng-config
177 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500178 cp libpng-config $(DB)/$(LIBNAME)-config
179 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500180 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500181
182install: install-static install-shared install-man install-config
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500183
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500184# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500185# move the library to its final location. Use test-dd to test it
186# before then.
187
188test-dd:
189 echo
190 echo Testing installed dynamic shared library in $(DL).
191 $(CC) -I$(DI) $(CFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600192 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500193 -L$(DL) -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600194 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500195 ./pngtestd pngtest.png
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500196
197test-installed:
198 $(CC) $(CFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600199 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500200 -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600201 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500202 ./pngtesti pngtest.png
203
204clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600205 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600206 $(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500207 $(OLDSOVER) \
208 libpng.pc
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500209
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600210DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
211writelock:
212 chmod a-w *.[ch35] $(DOCS) scripts/*
213
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500214# DO NOT DELETE THIS LINE -- make depend depends on it.
215
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500216png.o png.pic.o: png.h pngconf.h pngpriv.h
217pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h
218pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h
219pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h
220pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h
221pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h
222pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h
223pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h
224pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h
225pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h
226pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h
227pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h
228pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h
229pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h
230pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500231
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500232pngtest.o: png.h pngconf.h pngpriv.h