Glenn Randers-Pehrson | 2ae022d | 2002-07-01 22:23:46 -0500 | [diff] [blame] | 1 | # makefile for libpng on Solaris 2.x with cc |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 2 | # 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 | |
| 8 | CC=cc |
| 9 | SUN_CC_FLAGS=-fast -xtarget=ultra |
| 10 | SUN_LD_FLAGS=-fast -xtarget=ultra |
| 11 | |
| 12 | # where make install puts libpng.a, libpng12.so and libpng12/png.h |
| 13 | prefix=/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 | |
| 21 | ZLIBLIB=/usr/lib |
| 22 | ZLIBINC=/usr/include |
| 23 | |
| 24 | WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ |
| 25 | -Wmissing-declarations -Wtraditional -Wcast-align \ |
| 26 | -Wstrict-prototypes -Wmissing-prototypes #-Wconversion |
| 27 | CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \ |
| 28 | # $(WARNMORE) -g -DPNG_DEBUG=5 |
Glenn Randers-Pehrson | c33ab4e | 2002-10-22 08:28:43 -0500 | [diff] [blame] | 29 | LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 30 | |
Glenn Randers-Pehrson | 5b5dcf8 | 2004-07-17 22:45:44 -0500 | [diff] [blame] | 31 | #RANLIB=ranlib |
| 32 | RANLIB=echo |
| 33 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 34 | LIBNAME=libpng12 |
| 35 | PNGMAJ = 0 |
Glenn Randers-Pehrson | dff799e | 2004-08-07 21:42:49 -0500 | [diff] [blame^] | 36 | PNGMIN = 1.2.6rc2 |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 37 | PNGVER = $(PNGMAJ).$(PNGMIN) |
| 38 | |
| 39 | INCPATH=$(prefix)/include |
| 40 | LIBPATH=$(prefix)/lib |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 41 | MANPATH=$(prefix)/man |
Glenn Randers-Pehrson | 704228f | 2002-05-02 20:49:40 -0500 | [diff] [blame] | 42 | BINPATH=$(prefix)/bin |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 43 | |
| 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-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 50 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 51 | # you execute make install. |
| 52 | DESTDIR= |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 53 | |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 54 | DB=$(DESTDIR)$(BINPATH) |
| 55 | DI=$(DESTDIR)$(INCPATH) |
| 56 | DL=$(DESTDIR)$(LIBPATH) |
| 57 | DM=$(DESTDIR)$(MANPATH) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 58 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 59 | OBJS = 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 | |
| 63 | OBJSDLL = $(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-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 70 | all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 71 | |
| 72 | libpng.a: $(OBJS) |
Glenn Randers-Pehrson | 5b5dcf8 | 2004-07-17 22:45:44 -0500 | [diff] [blame] | 73 | ar rc $@ $(OBJS) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 74 | $(RANLIB) $@ |
| 75 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 76 | libpng.pc: |
| 77 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc |
| 78 | |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 79 | libpng-config: |
| 80 | ( cat scripts/libpng-config-head.in; \ |
| 81 | echo prefix=\"$(prefix)\"; \ |
Glenn Randers-Pehrson | 5ff38d3 | 2002-09-17 23:38:46 -0500 | [diff] [blame] | 82 | 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-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 88 | echo libs=\"-lpng12 -lz -lm\"; \ |
| 89 | cat scripts/libpng-config-body.in ) > libpng-config |
| 90 | chmod +x libpng-config |
| 91 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 92 | $(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-Pehrson | 865f4f0 | 2002-09-15 20:30:38 -0500 | [diff] [blame] | 112 | -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 113 | |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 114 | libpng.so.3.$(PNGMIN): $(OBJS) |
| 115 | $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.3 \ |
Glenn Randers-Pehrson | 865f4f0 | 2002-09-15 20:30:38 -0500 | [diff] [blame] | 116 | -o libpng.so.3.$(PNGMIN) $(OBJSDLL) |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 117 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 118 | pngtest: pngtest.o $(LIBNAME).so |
| 119 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
| 120 | |
| 121 | test: pngtest |
| 122 | ./pngtest |
| 123 | |
| 124 | install-headers: png.h pngconf.h |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 125 | -@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-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 128 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 129 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h |
| 130 | -@/bin/rm $(DI)/libpng |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 131 | (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 132 | |
| 133 | install-static: install-headers libpng.a |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 134 | -@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-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 139 | |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 140 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \ |
Glenn Randers-Pehrson | c33ab4e | 2002-10-22 08:28:43 -0500 | [diff] [blame] | 141 | libpng.so.3.$(PNGMIN) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 142 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi |
Glenn Randers-Pehrson | 51d9250 | 2002-08-23 23:07:42 -0500 | [diff] [blame] | 143 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so |
Glenn Randers-Pehrson | dff799e | 2004-08-07 21:42:49 -0500 | [diff] [blame^] | 144 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 145 | -@/bin/rm -f $(DL)/libpng.so |
| 146 | -@/bin/rm -f $(DL)/libpng.so.3 |
Glenn Randers-Pehrson | 51d9250 | 2002-08-23 23:07:42 -0500 | [diff] [blame] | 147 | -@/bin/rm -f $(DL)/libpng.so.3.$(PNGVER)* |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 148 | cp $(LIBNAME).so.$(PNGVER) $(DL) |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 149 | cp libpng.so.3.$(PNGMIN) $(DL) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 150 | chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER) |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 151 | chmod 755 $(DL)/libpng.so.3.$(PNGMIN) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 152 | (cd $(DL); \ |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 153 | ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \ |
Glenn Randers-Pehrson | 51d9250 | 2002-08-23 23:07:42 -0500 | [diff] [blame] | 154 | ln -f -s libpng.so.3 libpng.so; \ |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 155 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ |
| 156 | ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) |
Glenn Randers-Pehrson | 865f4f0 | 2002-09-15 20:30:38 -0500 | [diff] [blame] | 157 | -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 158 | -@/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-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 163 | |
| 164 | install-man: libpng.3 libpngpf.3 png.5 |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 165 | -@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-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 174 | |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 175 | install-config: libpng-config |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 176 | -@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-Pehrson | 5b5dcf8 | 2004-07-17 22:45:44 -0500 | [diff] [blame] | 181 | (cd $(DB); ln -f -s libpng12-config libpng-config) |
Glenn Randers-Pehrson | 704228f | 2002-05-02 20:49:40 -0500 | [diff] [blame] | 182 | |
| 183 | install: install-static install-shared install-man install-config |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 184 | |
Glenn Randers-Pehrson | d020e9d | 2002-06-28 09:34:00 -0500 | [diff] [blame] | 185 | # If you installed in $(DESTDIR), test-installed won't work until you |
| 186 | # move the library to its final location. |
| 187 | |
| 188 | test-installed: |
| 189 | echo |
| 190 | echo Testing installed dynamic shared library. |
| 191 | $(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \ |
Glenn Randers-Pehrson | 5ff38d3 | 2002-09-17 23:38:46 -0500 | [diff] [blame] | 192 | `$(BINPATH)/libpng12-config --cflags` pngtest.c \ |
| 193 | -o pngtesti `$(BINPATH)/libpng12-config --ldflags` \ |
Glenn Randers-Pehrson | d020e9d | 2002-06-28 09:34:00 -0500 | [diff] [blame] | 194 | $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) |
Glenn Randers-Pehrson | 2ae022d | 2002-07-01 22:23:46 -0500 | [diff] [blame] | 195 | ./pngtesti pngtest.png |
Glenn Randers-Pehrson | d020e9d | 2002-06-28 09:34:00 -0500 | [diff] [blame] | 196 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 197 | clean: |
Glenn Randers-Pehrson | 51d9250 | 2002-08-23 23:07:42 -0500 | [diff] [blame] | 198 | /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \ |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 199 | libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \ |
Glenn Randers-Pehrson | 51d9250 | 2002-08-23 23:07:42 -0500 | [diff] [blame] | 200 | libpng.so.3.$(PNGMIN) \ |
| 201 | libpng.pc |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 202 | |
| 203 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
| 204 | writelock: |
| 205 | chmod a-w *.[ch35] $(DOCS) scripts/* |
| 206 | |
| 207 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 208 | |
| 209 | png.o png.pic.o: png.h pngconf.h |
| 210 | pngerror.o pngerror.pic.o: png.h pngconf.h |
| 211 | pngrio.o pngrio.pic.o: png.h pngconf.h |
| 212 | pngwio.o pngwio.pic.o: png.h pngconf.h |
| 213 | pngmem.o pngmem.pic.o: png.h pngconf.h |
| 214 | pngset.o pngset.pic.o: png.h pngconf.h |
| 215 | pngget.o pngget.pic.o: png.h pngconf.h |
| 216 | pngread.o pngread.pic.o: png.h pngconf.h |
| 217 | pngrtran.o pngrtran.pic.o: png.h pngconf.h |
| 218 | pngrutil.o pngrutil.pic.o: png.h pngconf.h |
| 219 | pngtrans.o pngtrans.pic.o: png.h pngconf.h |
| 220 | pngwrite.o pngwrite.pic.o: png.h pngconf.h |
| 221 | pngwtran.o pngwtran.pic.o: png.h pngconf.h |
| 222 | pngwutil.o pngwutil.pic.o: png.h pngconf.h |
| 223 | pngpread.o pngpread.pic.o: png.h pngconf.h |
| 224 | |
| 225 | pngtest.o: png.h pngconf.h |