]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | # makefile for libpng on Linux ELF with gcc |
2 | # Copyright (C) 1996, 1997 Andreas Dilger | |
3 | # Copyright (C) 1998 Greg Roelofs | |
4 | # For conditions of distribution and use, see copyright notice in png.h | |
5 | ||
6 | CC=gcc | |
7 | ||
8 | # Where the zlib library and include files are located | |
9 | #ZLIBLIB=/usr/local/lib | |
10 | #ZLIBINC=/usr/local/include | |
11 | ZLIBLIB=../zlib | |
12 | ZLIBINC=../zlib | |
13 | ||
14 | WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ | |
15 | -Wmissing-declarations -Wtraditional -Wcast-align \ | |
16 | -Wstrict-prototypes -Wmissing-prototypes #-Wconversion | |
17 | CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -malign-loops=2 \ | |
18 | -malign-functions=2 #$(WARNMORE) -g -DPNG_DEBUG=5 | |
19 | LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm | |
20 | ||
21 | RANLIB=ranlib | |
22 | #RANLIB=echo | |
23 | ||
24 | # read libpng.txt or png.h to see why PNGMAJ is 2. You should not | |
25 | # have to change it. | |
26 | PNGMAJ = 2 | |
27 | PNGMIN = 1.0 | |
28 | PNGVER = $(PNGMAJ).$(PNGMIN) | |
29 | ||
30 | # where make install puts libpng.a, libpng.so*, and png.h | |
31 | prefix=/usr/local | |
32 | INCPATH=$(prefix)/include | |
33 | LIBPATH=$(prefix)/lib | |
34 | ||
35 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ | |
36 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ | |
37 | pngwtran.o pngmem.o pngerror.o pngpread.o | |
38 | ||
39 | OBJSDLL = $(OBJS:.o=.pic.o) | |
40 | ||
41 | .SUFFIXES: .c .o .pic.o | |
42 | ||
43 | .c.pic.o: | |
44 | $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c | |
45 | ||
46 | all: libpng.a libpng.so pngtest | |
47 | ||
48 | libpng.a: $(OBJS) | |
49 | ar rc $@ $(OBJS) | |
50 | $(RANLIB) $@ | |
51 | ||
52 | libpng.so: libpng.so.$(PNGMAJ) | |
53 | ln -sf libpng.so.$(PNGMAJ) libpng.so | |
54 | ||
55 | libpng.so.$(PNGMAJ): libpng.so.$(PNGVER) | |
56 | ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ) | |
57 | ||
58 | libpng.so.$(PNGVER): $(OBJSDLL) | |
59 | $(CC) -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \ | |
60 | $(OBJSDLL) | |
61 | ||
62 | pngtest: pngtest.o libpng.so | |
63 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
64 | ||
65 | test: pngtest | |
66 | ./pngtest | |
67 | ||
68 | install: libpng.a libpng.so.$(PNGVER) | |
69 | -@mkdir $(INCPATH) $(LIBPATH) | |
70 | cp png.h pngconf.h $(INCPATH) | |
71 | chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h | |
72 | cp libpng.a libpng.so.$(PNGVER) $(LIBPATH) | |
73 | chmod 755 $(LIBPATH)/libpng.so.$(PNGVER) | |
74 | -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so | |
75 | (cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \ | |
76 | ln -sf libpng.so.$(PNGMAJ) libpng.so) | |
77 | ||
78 | clean: | |
79 | /bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png | |
80 | ||
81 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
82 | ||
83 | png.o png.pic.o: png.h pngconf.h | |
84 | pngerror.o pngerror.pic.o: png.h pngconf.h | |
85 | pngrio.o pngrio.pic.o: png.h pngconf.h | |
86 | pngwio.o pngwio.pic.o: png.h pngconf.h | |
87 | pngmem.o pngmem.pic.o: png.h pngconf.h | |
88 | pngset.o pngset.pic.o: png.h pngconf.h | |
89 | pngget.o pngget.pic.o: png.h pngconf.h | |
90 | pngread.o pngread.pic.o: png.h pngconf.h | |
91 | pngrtran.o pngrtran.pic.o: png.h pngconf.h | |
92 | pngrutil.o pngrutil.pic.o: png.h pngconf.h | |
93 | pngtrans.o pngtrans.pic.o: png.h pngconf.h | |
94 | pngwrite.o pngwrite.pic.o: png.h pngconf.h | |
95 | pngwtran.o pngwtran.pic.o: png.h pngconf.h | |
96 | pngwutil.o pngwutil.pic.o: png.h pngconf.h | |
97 | pngpread.o pngpread.pic.o: png.h pngconf.h | |
98 | ||
99 | pngtest.o: png.h pngconf.h |