blob: 9b30f2c7ff38a1aa15f2ba62462de5c222f37661 [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
29LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
30
31#RANLIB=ranlib
32RANLIB=echo
33
34LIBNAME=libpng12
35PNGMAJ = 0
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -050036PNGMIN = 1.2.5rc1
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)
73 ar rc $@ $(OBJS)
74 $(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-Pehrson22f28962002-05-13 18:17:09 -050082 echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050083 echo cflags=\"-xtarget=ultra\"; \
84 echo ldflags=\"-xtarget=ultra -L$(LIBPATH) -R$(LIBPATH)\"; \
85 echo libs=\"-lpng12 -lz -lm\"; \
86 cat scripts/libpng-config-body.in ) > libpng-config
87 chmod +x libpng-config
88
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060089$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
90 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
91
92$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
93 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
94
95$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
96 @case "`type ld`" in *ucb*) \
97 echo; \
98 echo '## WARNING:'; \
99 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
100 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
101 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
102 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
103 echo '## at all. If it is, things are likely to break because of'; \
104 echo '## the libucb dependency that is created.'; \
105 echo; \
106 ;; \
107 esac
108 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
109 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz
110
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500111libpng.so.3.$(PNGMIN): $(OBJS)
112 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.3 \
113 -o libpng.so.3.$(PNGMIN) $(OBJSDLL) -lz
114
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600115pngtest: pngtest.o $(LIBNAME).so
116 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
117
118test: pngtest
119 ./pngtest
120
121install-headers: png.h pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500122 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
123 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
124 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500125 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500126 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
127 -@/bin/rm $(DI)/libpng
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500128 (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600129
130install-static: install-headers libpng.a
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500131 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
132 cp libpng.a $(DL)/$(LIBNAME).a
133 chmod 644 $(DL)/$(LIBNAME).a
134 -@/bin/rm -f $(DL)/libpng.a
135 (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600136
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500137install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
138 libpng.so.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500139 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500140 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500141 -@/bin/rm -f $(DL)/libpng.so
142 -@/bin/rm -f $(DL)/libpng.so.3
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500143 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGVER)*
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500144 cp $(LIBNAME).so.$(PNGVER) $(DL)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500145 cp libpng.so.3.$(PNGMIN) $(DL)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500146 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500147 chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500148 (cd $(DL); \
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500149 ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500150 ln -f -s libpng.so.3 libpng.so; \
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600151 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
152 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500153 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig
154 -@/bin/rm -f $(DL)/pkgconfig/libpng12.pc
155 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
156 cp libpng.pc $(DL)/pkgconfig/libpng12.pc
157 chmod 644 $(DL)/pkgconfig/libpng12.pc
158 (cd $(DL)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500159
160install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500161 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
162 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
163 -@/bin/rm -f $(DM)/man3/libpng.3
164 -@/bin/rm -f $(DM)/man3/libpngpf.3
165 cp libpng.3 $(DM)/man3
166 cp libpngpf.3 $(DM)/man3
167 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
168 -@/bin/rm -f $(DM)/man5/png.5
169 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500170
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500171install-config: libpng-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500172 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
173 -@/bin/rm -f $(DB)/libpng-config
174 -@/bin/rm -f $(DB)/libpng12-config
175 cp libpng-config $(DB)/libpng12-config
176 chmod 755 $(DB)/libpng12-config
177 (cd $(DB); ln -sf libpng12-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500178
179install: install-static install-shared install-man install-config
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600180
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500181# If you installed in $(DESTDIR), test-installed won't work until you
182# move the library to its final location.
183
184test-installed:
185 echo
186 echo Testing installed dynamic shared library.
187 $(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \
188 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
189 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` \
190 $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500191 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500192
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600193clean:
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500194 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500195 libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500196 libpng.so.3.$(PNGMIN) \
197 libpng.pc
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600198
199DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
200writelock:
201 chmod a-w *.[ch35] $(DOCS) scripts/*
202
203# DO NOT DELETE THIS LINE -- make depend depends on it.
204
205png.o png.pic.o: png.h pngconf.h
206pngerror.o pngerror.pic.o: png.h pngconf.h
207pngrio.o pngrio.pic.o: png.h pngconf.h
208pngwio.o pngwio.pic.o: png.h pngconf.h
209pngmem.o pngmem.pic.o: png.h pngconf.h
210pngset.o pngset.pic.o: png.h pngconf.h
211pngget.o pngget.pic.o: png.h pngconf.h
212pngread.o pngread.pic.o: png.h pngconf.h
213pngrtran.o pngrtran.pic.o: png.h pngconf.h
214pngrutil.o pngrutil.pic.o: png.h pngconf.h
215pngtrans.o pngtrans.pic.o: png.h pngconf.h
216pngwrite.o pngwrite.pic.o: png.h pngconf.h
217pngwtran.o pngwtran.pic.o: png.h pngconf.h
218pngwutil.o pngwutil.pic.o: png.h pngconf.h
219pngpread.o pngpread.pic.o: png.h pngconf.h
220
221pngtest.o: png.h pngconf.h