Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 1 | # makefile for libpng on Solaris 9 (beta) with Forte cc |
| 2 | # Updated by Chad Schrock for Solaris 9 |
| 3 | # Contributed by William L. Sebok, based on makefile.linux |
| 4 | # Copyright (C) 1998-2001 Greg Roelofs |
| 5 | # Copyright (C) 1996-1997 Andreas Dilger |
| 6 | # For conditions of distribution and use, see copyright notice in png.h |
| 7 | |
| 8 | # gcc 2.95 doesn't work. |
| 9 | CC=cc |
| 10 | |
| 11 | # Where make install puts libpng.a, libpng.so*, and png.h |
| 12 | prefix=/usr/local |
| 13 | |
| 14 | # Where the zlib library and include files are located |
| 15 | # Changing these to ../zlib poses a security risk. If you want |
| 16 | # to have zlib in an adjacent directory, specify the full path instead of "..". |
| 17 | #ZLIBLIB=../zlib |
| 18 | #ZLIBINC=../zlib |
| 19 | #ZLIBLIB=/usr/local/lib |
| 20 | #ZLIBINC=/usr/local/include |
| 21 | #Use the preinstalled zlib that comes with Solaris 9: |
| 22 | ZLIBLIB=/usr/lib |
| 23 | ZLIBINC=/usr/include |
| 24 | |
| 25 | #WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ |
| 26 | -Wmissing-declarations -Wtraditional -Wcast-align \ |
| 27 | -Wstrict-prototypes -Wmissing-prototypes #-Wconversion |
| 28 | #CFLAGS=-I$(ZLIBINC) -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 |
| 29 | CFLAGS=-I$(ZLIBINC) -O3 |
| 30 | LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm |
| 31 | |
| 32 | #RANLIB=ranlib |
| 33 | RANLIB=echo |
| 34 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 35 | # read libpng.txt or png.h to see why PNGMAJ is 0. You should not |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 36 | # have to change it. |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 37 | PNGMAJ = 0 |
Glenn Randers-Pehrson | 25228ab | 2002-03-31 07:33:55 -0600 | [diff] [blame^] | 38 | PNGMIN = 1.2.2beta6 |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 39 | PNGVER = $(PNGMAJ).$(PNGMIN) |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 40 | LIBNAME = libpng12 |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 41 | |
| 42 | INCPATH=$(prefix)/include |
| 43 | LIBPATH=$(prefix)/lib |
| 44 | |
| 45 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
| 46 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
| 47 | pngwtran.o pngmem.o pngerror.o pngpread.o |
| 48 | |
| 49 | OBJSDLL = $(OBJS:.o=.pic.o) |
| 50 | |
| 51 | .SUFFIXES: .c .o .pic.o |
| 52 | |
| 53 | .c.pic.o: |
| 54 | $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c |
| 55 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 56 | all: libpng.a $(LIBNAME).so pngtest |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 57 | |
| 58 | libpng.a: $(OBJS) |
| 59 | ar rc $@ $(OBJS) |
| 60 | $(RANLIB) $@ |
| 61 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 62 | $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) |
| 63 | ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 64 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 65 | $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER) |
| 66 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ) |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 67 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 68 | $(LIBNAME).so.$(PNGVER): $(OBJSDLL) |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 69 | @case "`type ld`" in *ucb*) \ |
| 70 | echo; \ |
| 71 | echo '## WARNING:'; \ |
| 72 | echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \ |
| 73 | echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \ |
| 74 | echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \ |
| 75 | echo '## The environment variable LD_LIBRARY_PATH should not be set'; \ |
| 76 | echo '## at all. If it is, things are likely to break because of'; \ |
| 77 | echo '## the libucb dependency that is created.'; \ |
| 78 | echo; \ |
| 79 | ;; \ |
| 80 | esac |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 81 | $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \ |
| 82 | -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 83 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 84 | pngtest: pngtest.o $(LIBNAME).so |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 85 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
| 86 | |
| 87 | test: pngtest |
| 88 | ./pngtest |
| 89 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 90 | install-headers: png.h pngconf.h |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 91 | -@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 92 | -@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi |
| 93 | cp png.h pngconf.h $(INCPATH)/$(LIBNAME) |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 94 | chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 95 | -@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h |
Glenn Randers-Pehrson | 73d57cb | 2002-03-25 18:49:08 -0600 | [diff] [blame] | 96 | -@/bin/rm -f $(INCPATH)/libpng |
| 97 | ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 98 | |
| 99 | install-static: install-headers libpng.a |
| 100 | -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 101 | cp libpng.a $(LIBPATH)/$(LIBNAME).a |
| 102 | chmod 644 $(LIBPATH)/$(LIBNAME).a |
| 103 | -@/bin/rm -f $(LIBPATH)/libpng.a |
| 104 | ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 105 | |
| 106 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) |
| 107 | -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi |
Glenn Randers-Pehrson | 377657d | 2002-03-08 01:31:27 -0600 | [diff] [blame] | 108 | -@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so |
Glenn Randers-Pehrson | 73d57cb | 2002-03-25 18:49:08 -0600 | [diff] [blame] | 109 | -@/bin/rm -f $(LIBPATH)/libpng.so |
| 110 | -@/bin/rm -f $(LIBPATH)/libpng.so.3 |
| 111 | -@/bin/rm -f $(LIBPATH)/libpng.so.3.* |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 112 | cp $(LIBNAME).so.$(PNGVER) $(LIBPATH) |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 113 | chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER) |
Glenn Randers-Pehrson | 377657d | 2002-03-08 01:31:27 -0600 | [diff] [blame] | 114 | (cd $(LIBPATH); \ |
Glenn Randers-Pehrson | 73d57cb | 2002-03-25 18:49:08 -0600 | [diff] [blame] | 115 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \ |
| 116 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \ |
| 117 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \ |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 118 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ |
| 119 | ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 120 | -@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi |
| 121 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc |
| 122 | cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc |
| 123 | chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc |
| 124 | |
| 125 | install: install-static install-shared |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 126 | |
| 127 | clean: |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 128 | /bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \ |
| 129 | pngtest pngout.png |
Glenn Randers-Pehrson | 6c97ddb | 2001-10-24 22:01:19 -0500 | [diff] [blame] | 130 | |
| 131 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
| 132 | writelock: |
| 133 | chmod a-w *.[ch35] $(DOCS) scripts/* |
| 134 | |
| 135 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 136 | |
| 137 | png.o png.pic.o: png.h pngconf.h |
| 138 | pngerror.o pngerror.pic.o: png.h pngconf.h |
| 139 | pngrio.o pngrio.pic.o: png.h pngconf.h |
| 140 | pngwio.o pngwio.pic.o: png.h pngconf.h |
| 141 | pngmem.o pngmem.pic.o: png.h pngconf.h |
| 142 | pngset.o pngset.pic.o: png.h pngconf.h |
| 143 | pngget.o pngget.pic.o: png.h pngconf.h |
| 144 | pngread.o pngread.pic.o: png.h pngconf.h |
| 145 | pngrtran.o pngrtran.pic.o: png.h pngconf.h |
| 146 | pngrutil.o pngrutil.pic.o: png.h pngconf.h |
| 147 | pngtrans.o pngtrans.pic.o: png.h pngconf.h |
| 148 | pngwrite.o pngwrite.pic.o: png.h pngconf.h |
| 149 | pngwtran.o pngwtran.pic.o: png.h pngconf.h |
| 150 | pngwutil.o pngwutil.pic.o: png.h pngconf.h |
| 151 | pngpread.o pngpread.pic.o: png.h pngconf.h |
| 152 | |
| 153 | pngtest.o: png.h pngconf.h |