blob: c84b6cea9a768cb675a64f3a4f4a596f667772be [file] [log] [blame]
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -06001# makefile for libpng on Linux ELF with gcc
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06002# Copyright (C) 1996, 1997 Andreas Dilger
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -05003# Copyright (C) 1998, 1999 Greg Roelofs
Guy Schalnat4ee97b01996-01-16 01:51:56 -06004# For conditions of distribution and use, see copyright notice in png.h
5
6CC=gcc
Andreas Dilger47a0c421997-05-16 02:46:07 -05007
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -05008# where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -06009prefix=/usr/local
10
Andreas Dilger47a0c421997-05-16 02:46:07 -050011# Where the zlib library and include files are located
12#ZLIBLIB=/usr/local/lib
13#ZLIBINC=/usr/local/include
14ZLIBLIB=../zlib
15ZLIBINC=../zlib
16
Glenn Randers-Pehrson896239b1998-04-21 15:03:57 -050017ALIGN=
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -050018# for i386:
Glenn Randers-Pehrson896239b1998-04-21 15:03:57 -050019#ALIGN=-malign-loops=2 -malign-functions=2
20
Andreas Dilger47a0c421997-05-16 02:46:07 -050021WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050022 -Wmissing-declarations -Wtraditional -Wcast-align \
23 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
Glenn Randers-Pehrson896239b1998-04-21 15:03:57 -050024
Glenn Randers-Pehrsonbcfd15d1999-10-01 14:22:25 -050025# for pgcc version 2.95.1, -O3 is buggy; don't us it.
26
Glenn Randers-Pehrson896239b1998-04-21 15:03:57 -050027CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050028 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
Andreas Dilger47a0c421997-05-16 02:46:07 -050029LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060030
31RANLIB=ranlib
32#RANLIB=echo
33
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060034# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
35# have to change it.
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060036PNGMAJ = 2
Glenn Randers-Pehrsonbcfd15d1999-10-01 14:22:25 -050037PNGMIN = 1.0.4c
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060038PNGVER = $(PNGMAJ).$(PNGMIN)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060039
Andreas Dilger47a0c421997-05-16 02:46:07 -050040INCPATH=$(prefix)/include
41LIBPATH=$(prefix)/lib
Guy Schalnat4ee97b01996-01-16 01:51:56 -060042
Andreas Dilger47a0c421997-05-16 02:46:07 -050043OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050044 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
45 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060046
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060047OBJSDLL = $(OBJS:.o=.pic.o)
48
49.SUFFIXES: .c .o .pic.o
50
51.c.pic.o:
52 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
53
54all: libpng.a libpng.so pngtest
Guy Schalnat4ee97b01996-01-16 01:51:56 -060055
56libpng.a: $(OBJS)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060057 ar rc $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060058 $(RANLIB) $@
59
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060060libpng.so: libpng.so.$(PNGMAJ)
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -050061 ln -sf libpng.so.$(PNGMAJ) libpng.so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060062
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060063libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -050064 ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060065
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060066libpng.so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrsonea3bcd71998-03-07 14:33:00 -060067 $(CC) -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060068 $(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
Guy Schalnat4ee97b01996-01-16 01:51:56 -060069
70pngtest: pngtest.o libpng.so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060071 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060072
73test: pngtest
74 ./pngtest
75
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060076install: libpng.a libpng.so.$(PNGVER)
Andreas Dilger47a0c421997-05-16 02:46:07 -050077 -@mkdir $(INCPATH) $(LIBPATH)
78 cp png.h pngconf.h $(INCPATH)
79 chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060080 cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
Andreas Dilger47a0c421997-05-16 02:46:07 -050081 chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060082 -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -050083 (cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
84 ln -sf libpng.so.$(PNGMAJ) libpng.so)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060085
86clean:
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060087 /bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
Guy Schalnat4ee97b01996-01-16 01:51:56 -060088
89# DO NOT DELETE THIS LINE -- make depend depends on it.
90
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060091png.o png.pic.o: png.h pngconf.h
92pngerror.o pngerror.pic.o: png.h pngconf.h
93pngrio.o pngrio.pic.o: png.h pngconf.h
94pngwio.o pngwio.pic.o: png.h pngconf.h
95pngmem.o pngmem.pic.o: png.h pngconf.h
96pngset.o pngset.pic.o: png.h pngconf.h
97pngget.o pngget.pic.o: png.h pngconf.h
98pngread.o pngread.pic.o: png.h pngconf.h
99pngrtran.o pngrtran.pic.o: png.h pngconf.h
100pngrutil.o pngrutil.pic.o: png.h pngconf.h
101pngtrans.o pngtrans.pic.o: png.h pngconf.h
102pngwrite.o pngwrite.pic.o: png.h pngconf.h
103pngwtran.o pngwtran.pic.o: png.h pngconf.h
104pngwutil.o pngwutil.pic.o: png.h pngconf.h
105pngpread.o pngpread.pic.o: png.h pngconf.h
106
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600107pngtest.o: png.h pngconf.h