blob: bd13573540fe77be9b7e2655a9885ce37de44825 [file] [log] [blame]
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -05001# makefile for libpng on Solaris 2.x with cc
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -06002# Contributed by William L. Sebok, based on makefile.linux
3# Copyright (C) 2002 Glenn Randers-Pehrson
4# Copyright (C) 1998 Greg Roelofs
5# Copyright (C) 1996, 1997 Andreas Dilger
6# For conditions of distribution and use, see copyright notice in png.h
7
8CC=cc
9SUN_CC_FLAGS=-fast -xtarget=ultra
10SUN_LD_FLAGS=-fast -xtarget=ultra
11
12# where make install puts libpng.a, libpng12.so and libpng12/png.h
13prefix=/a
14
15# Where the zlib library and include files are located
16# Changing these to ../zlib poses a security risk. If you want
17# to have zlib in an adjacent directory, specify the full path instead of "..".
18#ZLIBLIB=../zlib
19#ZLIBINC=../zlib
20
21ZLIBLIB=/usr/lib
22ZLIBINC=/usr/include
23
24WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
25 -Wmissing-declarations -Wtraditional -Wcast-align \
26 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
27CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \
28 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrsonc33ab4e2002-10-22 08:28:43 -050029LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060030
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -050031#RANLIB=ranlib
32RANLIB=echo
33
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060034LIBNAME=libpng12
35PNGMAJ = 0
Glenn Randers-Pehrsondff799e2004-08-07 21:42:49 -050036PNGMIN = 1.2.6rc2
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060037PNGVER = $(PNGMAJ).$(PNGMIN)
38
39INCPATH=$(prefix)/include
40LIBPATH=$(prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050041MANPATH=$(prefix)/man
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -050042BINPATH=$(prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050043
44# override DESTDIR= on the make install command line to easily support
45# installing into a temporary location. Example:
46#
47# make install DESTDIR=/tmp/build/libpng
48#
49# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050050# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050051# you execute make install.
52DESTDIR=
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060053
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050054DB=$(DESTDIR)$(BINPATH)
55DI=$(DESTDIR)$(INCPATH)
56DL=$(DESTDIR)$(LIBPATH)
57DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050058
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060059OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
60 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
61 pngwtran.o pngmem.o pngerror.o pngpread.o
62
63OBJSDLL = $(OBJS:.o=.pic.o)
64
65.SUFFIXES: .c .o .pic.o
66
67.c.pic.o:
68 $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
69
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050070all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060071
72libpng.a: $(OBJS)
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -050073 ar rc $@ $(OBJS)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060074 $(RANLIB) $@
75
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050076libpng.pc:
77 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
78
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050079libpng-config:
80 ( cat scripts/libpng-config-head.in; \
81 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050082 echo libdir=\"$(LIBPATH)\"; \
83 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
84 echo L_opts=\"-L$(LIBPATH)\"; \
85 echo R_opts=\"-R$(LIBPATH)\"; \
86 echo ccopts=\"-xtarget=ultra\"; \
87 echo ldopts=\"-xtarget=ultra\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050088 echo libs=\"-lpng12 -lz -lm\"; \
89 cat scripts/libpng-config-body.in ) > libpng-config
90 chmod +x libpng-config
91
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060092$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
93 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
94
95$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
96 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
97
98$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
99 @case "`type ld`" in *ucb*) \
100 echo; \
101 echo '## WARNING:'; \
102 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
103 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
104 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
105 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
106 echo '## at all. If it is, things are likely to break because of'; \
107 echo '## the libucb dependency that is created.'; \
108 echo; \
109 ;; \
110 esac
111 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
Glenn Randers-Pehrson865f4f02002-09-15 20:30:38 -0500112 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600113
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500114libpng.so.3.$(PNGMIN): $(OBJS)
115 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.3 \
Glenn Randers-Pehrson865f4f02002-09-15 20:30:38 -0500116 -o libpng.so.3.$(PNGMIN) $(OBJSDLL)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500117
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600118pngtest: pngtest.o $(LIBNAME).so
119 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
120
121test: pngtest
122 ./pngtest
123
124install-headers: png.h pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500125 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
126 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
127 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500128 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500129 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
130 -@/bin/rm $(DI)/libpng
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500131 (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600132
133install-static: install-headers libpng.a
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500134 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
135 cp libpng.a $(DL)/$(LIBNAME).a
136 chmod 644 $(DL)/$(LIBNAME).a
137 -@/bin/rm -f $(DL)/libpng.a
138 (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600139
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500140install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
Glenn Randers-Pehrsonc33ab4e2002-10-22 08:28:43 -0500141 libpng.so.3.$(PNGMIN)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500142 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500143 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
Glenn Randers-Pehrsondff799e2004-08-07 21:42:49 -0500144 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500145 -@/bin/rm -f $(DL)/libpng.so
146 -@/bin/rm -f $(DL)/libpng.so.3
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500147 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGVER)*
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500148 cp $(LIBNAME).so.$(PNGVER) $(DL)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500149 cp libpng.so.3.$(PNGMIN) $(DL)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500150 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500151 chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500152 (cd $(DL); \
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500153 ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500154 ln -f -s libpng.so.3 libpng.so; \
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600155 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
156 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
Glenn Randers-Pehrson865f4f02002-09-15 20:30:38 -0500157 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500158 -@/bin/rm -f $(DL)/pkgconfig/libpng12.pc
159 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
160 cp libpng.pc $(DL)/pkgconfig/libpng12.pc
161 chmod 644 $(DL)/pkgconfig/libpng12.pc
162 (cd $(DL)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500163
164install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500165 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
166 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
167 -@/bin/rm -f $(DM)/man3/libpng.3
168 -@/bin/rm -f $(DM)/man3/libpngpf.3
169 cp libpng.3 $(DM)/man3
170 cp libpngpf.3 $(DM)/man3
171 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
172 -@/bin/rm -f $(DM)/man5/png.5
173 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500174
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500175install-config: libpng-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500176 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
177 -@/bin/rm -f $(DB)/libpng-config
178 -@/bin/rm -f $(DB)/libpng12-config
179 cp libpng-config $(DB)/libpng12-config
180 chmod 755 $(DB)/libpng12-config
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -0500181 (cd $(DB); ln -f -s libpng12-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500182
183install: install-static install-shared install-man install-config
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600184
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500185# If you installed in $(DESTDIR), test-installed won't work until you
186# move the library to its final location.
187
188test-installed:
189 echo
190 echo Testing installed dynamic shared library.
191 $(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500192 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
193 -o pngtesti `$(BINPATH)/libpng12-config --ldflags` \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500194 $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500195 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500196
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600197clean:
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500198 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500199 libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500200 libpng.so.3.$(PNGMIN) \
201 libpng.pc
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600202
203DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
204writelock:
205 chmod a-w *.[ch35] $(DOCS) scripts/*
206
207# DO NOT DELETE THIS LINE -- make depend depends on it.
208
209png.o png.pic.o: png.h pngconf.h
210pngerror.o pngerror.pic.o: png.h pngconf.h
211pngrio.o pngrio.pic.o: png.h pngconf.h
212pngwio.o pngwio.pic.o: png.h pngconf.h
213pngmem.o pngmem.pic.o: png.h pngconf.h
214pngset.o pngset.pic.o: png.h pngconf.h
215pngget.o pngget.pic.o: png.h pngconf.h
216pngread.o pngread.pic.o: png.h pngconf.h
217pngrtran.o pngrtran.pic.o: png.h pngconf.h
218pngrutil.o pngrutil.pic.o: png.h pngconf.h
219pngtrans.o pngtrans.pic.o: png.h pngconf.h
220pngwrite.o pngwrite.pic.o: png.h pngconf.h
221pngwtran.o pngwtran.pic.o: png.h pngconf.h
222pngwutil.o pngwutil.pic.o: png.h pngconf.h
223pngpread.o pngpread.pic.o: png.h pngconf.h
224
225pngtest.o: png.h pngconf.h