VirtualBox

source: vbox/trunk/src/libs/libpng-1.2.54/scripts/makefile.linux@ 72337

Last change on this file since 72337 was 58796, checked in by vboxsync, 9 years ago

libpng 1.2.54 unmodified

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette