blob: 219b8adfbe260616d83e4fd95fa98ac81398a6b3 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001# makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
2# Copyright (C) 2001-2002 Glenn Randers-Pehrson
3# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
4# For conditions of distribution and use, see copyright notice in png.h
5
6LIBNAME=libpng12
7PNGMAJ = 0
8PNGMIN = 1.2.5
9PNGVER = $(PNGMAJ).$(PNGMIN)
10
11# Where make install puts libpng.a, libpng12.so, and libpng12/png.h
12# Prefix must be a full pathname.
13
14prefix=/usr/local
15
16# Where the zlib library and include files are located
17#ZLIBLIB=/usr/local/lib32
18#ZLIBINC=/usr/local/include
19#ZLIBLIB=/usr/local/lib
20#ZLIBINC=/usr/local/include
21ZLIBLIB=../zlib
22ZLIBINC=../zlib
23
24CC=cc
25
26# ABI can be blank to use default for your system, -32, -o32, -n32, or -64
27# See "man abi". zlib must be built with the same ABI.
28ABI=
29
30WARNMORE=-fullwarn
31# Note: -KPIC is the default anyhow
32#CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_USE_PNGGCCRD # -g -DPNG_DEBUG=5
33CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD \
34 -DPNG_NO_ASSEMBLER_CODE
35LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm
36LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
37LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ) \
38 -set_version sgi$(PNGMAJ).0
39LDLEGACY=cc $(ABI) -shared -soname libpng.so.3 \
40 -set_version sgi$3.0
41# See "man dso" for info about shared objects
42
43RANLIB=echo
44#RANLIB=ranlib
45
46INCPATH=$(prefix)/include
47LIBPATH=$(prefix)/lib
48#LIBPATH=$(prefix)/lib32
49MANPATH=$(prefix)/man
50BINPATH=$(prefix)/bin
51
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
58# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
59# you execute make install.
60DESTDIR=
61
62DB=$(DESTDIR)$(BINPATH)
63DI=$(DESTDIR)$(INCPATH)
64DL=$(DESTDIR)$(LIBPATH)
65DM=$(DESTDIR)$(MANPATH)
66
67OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
68 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
69 pngwtran.o pngmem.o pngerror.o pngpread.o
70
71all: libpng.a pngtest shared libpng.pc libpng-config
72
73libpng.a: $(OBJS)
74 ar rc $@ $(OBJS)
75 $(RANLIB) $@
76
77shared: $(LIBNAME).so.$(PNGVER)
78
79libpng.pc:
80 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
81
82libpng-config:
83 ( cat scripts/libpng-config-head.in; \
84 echo prefix=\"$(prefix)\"; \
85 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
86 echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE\"; \
87 echo ccopts=\"$(ABI)\"; \
88 echo ldopts=\"$(ABI)\"; \
89 echo L_opts=\"-L$(LIBPATH)\"; \
90 echo libdir=\"$(LIBPATH)\"; \
91 echo libs=\"-lpng12 -lz -lm\"; \
92 cat scripts/libpng-config-body.in ) > libpng-config
93 chmod +x libpng-config
94
95$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
96 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
97
98$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
99 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
100
101$(LIBNAME).so.$(PNGVER): $(OBJS)
102 $(LDSHARED) -o $@ $(OBJS)
103 rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
104
105libpng.so.3.$(PNGMIN): $(OBJS)
106 $(LDLEGACY) -o $@ $(OBJS)
107
108pngtest: pngtest.o libpng.a
109 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
110
111test: pngtest
112 echo
113 echo Testing local static library.
114 ./pngtest
115
116install-headers: png.h pngconf.h
117 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
118 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
119 cp png.h pngconf.h $(DI)/$(LIBNAME)
120 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
121 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
122 -@/bin/rm -f $(DI)/libpng
123 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
124
125install-static: install-headers libpng.a
126 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
127 cp libpng.a $(DL)/$(LIBNAME).a
128 chmod 644 $(DL)/$(LIBNAME).a
129 -@/bin/rm -f $(DL)/libpng.a
130 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
131
132install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
133 libpng.so.3.$(PNGMIN)
134 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
135 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
136 -@/bin/rm -f $(DL)/libpng.so
137 -@/bin/rm -f $(DL)/libpng.so.3
138 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
139 cp $(LIBNAME).so.$(PNGVER) $(DL)
140 cp libpng.so.3.$(PNGMIN) $(DL)
141 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
142 chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
143 (cd $(DL); \
144 ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \
145 ln -sf libpng.so.3 libpng.so; \
146 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
147 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
148 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
149 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
150 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
151 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
152 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
153 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
154
155install-man: libpng.3 libpngpf.3 png.5
156 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
157 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
158 -@/bin/rm -f $(DM)/man3/libpng.3
159 -@/bin/rm -f $(DM)/man3/libpngpf.3
160 cp libpng.3 $(DM)/man3
161 cp libpngpf.3 $(DM)/man3
162 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
163 -@/bin/rm -f $(DM)/man5/png.5
164 cp png.5 $(DM)/man5
165
166install-config: libpng-config
167 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
168 -@/bin/rm -f $(DB)/libpng-config
169 -@/bin/rm -f $(DB)/$(LIBNAME)-config
170 cp libpng-config $(DB)/$(LIBNAME)-config
171 chmod 755 $(DB)/$(LIBNAME)-config
172 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
173
174install: install-static install-shared install-man install-config
175
176# If you installed in $(DESTDIR), test-installed won't work until you
177# move the library to its final location.
178
179test-installed:
180 echo
181 echo Testing installed dynamic shared library.
182 $(CC) -I$(ZLIBINC) \
183 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
184 -L$(ZLIBLIB) -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --libdir` \
185 -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
186 ./pngtesti pngtest.png
187
188clean:
189 rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
190 $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
191 libpng.so.3.$(PNGMIN) \
192 so_locations
193
194DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
195writelock:
196 chmod a-w *.[ch35] $(DOCS) scripts/*
197
198# DO NOT DELETE THIS LINE -- make depend depends on it.
199
200png.o: png.h pngconf.h
201pngerror.o: png.h pngconf.h
202pngrio.o: png.h pngconf.h
203pngwio.o: png.h pngconf.h
204pngmem.o: png.h pngconf.h
205pngset.o: png.h pngconf.h
206pngget.o: png.h pngconf.h
207pngread.o: png.h pngconf.h
208pngrtran.o: png.h pngconf.h
209pngrutil.o: png.h pngconf.h
210pngtest.o: png.h pngconf.h
211pngtrans.o: png.h pngconf.h
212pngwrite.o: png.h pngconf.h
213pngwtran.o: png.h pngconf.h
214pngwutil.o: png.h pngconf.h
215pngpread.o: png.h pngconf.h
216pnggccrd.o: png.h pngconf.h
217