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