Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 1 | # makefile for libpng on Linux ELF with gcc |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 2 | # Copyright (C) 1996, 1997 Andreas Dilger |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame] | 3 | # Copyright (C) 1998, 1999 Greg Roelofs |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 4 | # For conditions of distribution and use, see copyright notice in png.h |
| 5 | |
| 6 | CC=gcc |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 7 | |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame] | 8 | # where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 9 | prefix=/usr/local |
| 10 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 11 | # Where the zlib library and include files are located |
| 12 | #ZLIBLIB=/usr/local/lib |
| 13 | #ZLIBINC=/usr/local/include |
| 14 | ZLIBLIB=../zlib |
| 15 | ZLIBINC=../zlib |
| 16 | |
Glenn Randers-Pehrson | 896239b | 1998-04-21 15:03:57 -0500 | [diff] [blame] | 17 | ALIGN= |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame] | 18 | # for i386: |
Glenn Randers-Pehrson | 896239b | 1998-04-21 15:03:57 -0500 | [diff] [blame] | 19 | #ALIGN=-malign-loops=2 -malign-functions=2 |
| 20 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 21 | WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 22 | -Wmissing-declarations -Wtraditional -Wcast-align \ |
| 23 | -Wstrict-prototypes -Wmissing-prototypes #-Wconversion |
Glenn Randers-Pehrson | 896239b | 1998-04-21 15:03:57 -0500 | [diff] [blame] | 24 | |
Glenn Randers-Pehrson | bcfd15d | 1999-10-01 14:22:25 -0500 | [diff] [blame^] | 25 | # for pgcc version 2.95.1, -O3 is buggy; don't us it. |
| 26 | |
Glenn Randers-Pehrson | 896239b | 1998-04-21 15:03:57 -0500 | [diff] [blame] | 27 | CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \ |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 28 | $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 29 | LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 30 | |
| 31 | RANLIB=ranlib |
| 32 | #RANLIB=echo |
| 33 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 34 | # read libpng.txt or png.h to see why PNGMAJ is 2. You should not |
| 35 | # have to change it. |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 36 | PNGMAJ = 2 |
Glenn Randers-Pehrson | bcfd15d | 1999-10-01 14:22:25 -0500 | [diff] [blame^] | 37 | PNGMIN = 1.0.4c |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 38 | PNGVER = $(PNGMAJ).$(PNGMIN) |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 39 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 40 | INCPATH=$(prefix)/include |
| 41 | LIBPATH=$(prefix)/lib |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 42 | |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 43 | 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] | 44 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
| 45 | pngwtran.o pngmem.o pngerror.o pngpread.o |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 46 | |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 47 | OBJSDLL = $(OBJS:.o=.pic.o) |
| 48 | |
| 49 | .SUFFIXES: .c .o .pic.o |
| 50 | |
| 51 | .c.pic.o: |
| 52 | $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c |
| 53 | |
| 54 | all: libpng.a libpng.so pngtest |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 55 | |
| 56 | libpng.a: $(OBJS) |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 57 | ar rc $@ $(OBJS) |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 58 | $(RANLIB) $@ |
| 59 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 60 | libpng.so: libpng.so.$(PNGMAJ) |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame] | 61 | ln -sf libpng.so.$(PNGMAJ) libpng.so |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 62 | |
Andreas Dilger | 02ad0ef | 1997-01-17 01:34:35 -0600 | [diff] [blame] | 63 | libpng.so.$(PNGMAJ): libpng.so.$(PNGVER) |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame] | 64 | ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ) |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 65 | |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 66 | libpng.so.$(PNGVER): $(OBJSDLL) |
Glenn Randers-Pehrson | ea3bcd7 | 1998-03-07 14:33:00 -0600 | [diff] [blame] | 67 | $(CC) -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \ |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 68 | $(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 69 | |
| 70 | pngtest: pngtest.o libpng.so |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 71 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 72 | |
| 73 | test: pngtest |
| 74 | ./pngtest |
| 75 | |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 76 | install: libpng.a libpng.so.$(PNGVER) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 77 | -@mkdir $(INCPATH) $(LIBPATH) |
| 78 | cp png.h pngconf.h $(INCPATH) |
| 79 | chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 80 | cp libpng.a libpng.so.$(PNGVER) $(LIBPATH) |
Andreas Dilger | 47a0c42 | 1997-05-16 02:46:07 -0500 | [diff] [blame] | 81 | chmod 755 $(LIBPATH)/libpng.so.$(PNGVER) |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 82 | -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so |
Glenn Randers-Pehrson | f8b008c | 1999-09-18 10:54:36 -0500 | [diff] [blame] | 83 | (cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \ |
| 84 | ln -sf libpng.so.$(PNGMAJ) libpng.so) |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 85 | |
| 86 | clean: |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 87 | /bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 88 | |
| 89 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 90 | |
Glenn Randers-Pehrson | 2687fcc | 1998-01-07 20:54:20 -0600 | [diff] [blame] | 91 | png.o png.pic.o: png.h pngconf.h |
| 92 | pngerror.o pngerror.pic.o: png.h pngconf.h |
| 93 | pngrio.o pngrio.pic.o: png.h pngconf.h |
| 94 | pngwio.o pngwio.pic.o: png.h pngconf.h |
| 95 | pngmem.o pngmem.pic.o: png.h pngconf.h |
| 96 | pngset.o pngset.pic.o: png.h pngconf.h |
| 97 | pngget.o pngget.pic.o: png.h pngconf.h |
| 98 | pngread.o pngread.pic.o: png.h pngconf.h |
| 99 | pngrtran.o pngrtran.pic.o: png.h pngconf.h |
| 100 | pngrutil.o pngrutil.pic.o: png.h pngconf.h |
| 101 | pngtrans.o pngtrans.pic.o: png.h pngconf.h |
| 102 | pngwrite.o pngwrite.pic.o: png.h pngconf.h |
| 103 | pngwtran.o pngwtran.pic.o: png.h pngconf.h |
| 104 | pngwutil.o pngwutil.pic.o: png.h pngconf.h |
| 105 | pngpread.o pngpread.pic.o: png.h pngconf.h |
| 106 | |
Guy Schalnat | 4ee97b0 | 1996-01-16 01:51:56 -0600 | [diff] [blame] | 107 | pngtest.o: png.h pngconf.h |