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