blob: f897bc18938b247303077afeb942f1a30769b6ca [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-Pehrson03008a02002-04-27 10:11:25 -05004# Copyright (C) 2002 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-Pehrson1d963611998-05-02 12:52:25 -05007# For conditions of distribution and use, see copyright notice in png.h
8
9CC=cc
10
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060011# where make install puts libpng.a, libpng.so*, and png.h
12prefix=/usr/local
13
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050014# Where the zlib library and include files are located
15#ZLIBLIB=/usr/local/lib
16#ZLIBINC=/usr/local/include
17ZLIBLIB=../zlib
18ZLIBINC=../zlib
19
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -060020CFLAGS= -dy -belf -I$(ZLIBINC) -O3
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050021LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
22
23#RANLIB=ranlib
24RANLIB=echo
25
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060026# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050027# have to change it.
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060028PNGMAJ = 0
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -050029PNGMIN = 1.2.3rc3
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050030PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060031LIBNAME = libpng12
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050032
Glenn Randers-Pehrsonfcbd7872002-04-07 16:35:38 -050033INCPATH=$(prefix)/include/libpng
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050034LIBPATH=$(prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050035MANPATH=$(prefix)/man
36
37# override DESTDIR= on the make install command line to easily support
38# installing into a temporary location. Example:
39#
40# make install DESTDIR=/tmp/build/libpng
41#
42# If you're going to install into a temporary location
43# via DESTDIR, that location must already exist before
44# you execute make install.
45DESTDIR=
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050046
47OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050048 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
49 pngwtran.o pngmem.o pngerror.o pngpread.o
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050050
51OBJSDLL = $(OBJS:.o=.pic.o)
52
53.SUFFIXES: .c .o .pic.o
54
55.c.pic.o:
56 $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
57
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050058all: libpng.a $(LIBNAME).so pngtest libpng.pc
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050059
60libpng.a: $(OBJS)
61 ar rc $@ $(OBJS)
62 $(RANLIB) $@
63
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050064libpng.pc:
65 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
66
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060067$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
68 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050069
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060070$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
71 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050072
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060073$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
74 $(CC) -G -Wl,-h,$(LIBNAME).so.$(PNGMAJ) -o $(LIBNAME).so.$(PNGVER) \
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050075 $(OBJSDLL)
76
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060077pngtest: pngtest.o $(LIBNAME).so
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050078 LD_RUN_PATH=.:$(ZLIBLIB) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
79
80test: pngtest
81 ./pngtest
82
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060083
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060084install-headers: png.h pngconf.h
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050085 -@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
86 -@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
87 mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
88 -@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h
89 -@/bin/rm -f $(DESTDIR)$(INCPATH)/pngconf.h
90 cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
91 chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
92 $(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
93 -@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
94 -@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
95 (cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
96 ln -f -s $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060097
98install-static: install-headers libpng.a
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050099 -@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
100 cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
101 chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
102 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
103 (cd $(DESTDIR)$(LIBPATH); ln -f -s $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600104
Glenn Randers-Pehrson25d82242002-05-01 11:51:26 -0500105install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500106 -@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
107 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
108 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so
109 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
110 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
111 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
112 cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
113 chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
114 (cd $(DESTDIR)$(LIBPATH); \
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600115 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
116 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
117 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600118 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
119 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500120 -@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
121 mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -0500122 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/pkgconfig/libpng.12.pc
123 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/pkgconfig/libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500124 cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
125 chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
126 (cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600127
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500128install-man: libpng.3 libpngpf.3 png.5
129 -@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
130 -@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
131 -@/bin/rm -f $(MANPATH)/man3/libpng.3
132 -@/bin/rm -f $(MANPATH)/man3/libpngpf.3
133 cp libpng.3 $(MANPATH)/man3
134 cp libpngpf.3 $(MANPATH)/man3
135 -@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
136 -@/bin/rm -f $(MANPATH)/man5/png.5
137 cp png.5 $(MANPATH)/man5
138
139install: install-static install-shared install-man
140
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500141
142clean:
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600143 /bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500144
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600145DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
146writelock:
147 chmod a-w *.[ch35] $(DOCS) scripts/*
148
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500149# DO NOT DELETE THIS LINE -- make depend depends on it.
150
151png.o png.pic.o: png.h pngconf.h
152pngerror.o pngerror.pic.o: png.h pngconf.h
153pngrio.o pngrio.pic.o: png.h pngconf.h
154pngwio.o pngwio.pic.o: png.h pngconf.h
155pngmem.o pngmem.pic.o: png.h pngconf.h
156pngset.o pngset.pic.o: png.h pngconf.h
157pngget.o pngget.pic.o: png.h pngconf.h
158pngread.o pngread.pic.o: png.h pngconf.h
159pngrtran.o pngrtran.pic.o: png.h pngconf.h
160pngrutil.o pngrutil.pic.o: png.h pngconf.h
161pngtrans.o pngtrans.pic.o: png.h pngconf.h
162pngwrite.o pngwrite.pic.o: png.h pngconf.h
163pngwtran.o pngwtran.pic.o: png.h pngconf.h
164pngwutil.o pngwutil.pic.o: png.h pngconf.h
165pngpread.o pngpread.pic.o: png.h pngconf.h
166
167pngtest.o: png.h pngconf.h