blob: 5f3a412c96e06faf358522ec5df405a40a531104 [file] [log] [blame]
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -06001# makefile for libpng on Solaris 2.x with gcc
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -06002# Contributed by William L. Sebok, based on makefile.lnx
Andreas Dilger02ad0ef1997-01-17 01:34:35 -06003# Copyright (C) 1996, 1997 Andreas Dilger
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -06004# Copyright (C) 1998 Greg Roelofs
Guy Schalnat4ee97b01996-01-16 01:51:56 -06005# For conditions of distribution and use, see copyright notice in png.h
6
7CC=gcc
Andreas Dilger47a0c421997-05-16 02:46:07 -05008
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -05009# The commands "CC" and "LD" must NOT refer to /usr/ucb/cc and /usr/ucb/ld.
10# If they do, you need to adjust your PATH environment variable.
11# The environment variable LD_LIBRARY_PATH should not be set at all. If
12# it is, things are likely to break.
13
14# Where make install puts libpng.a, libpng.so*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060015prefix=/usr/local
16
Andreas Dilger47a0c421997-05-16 02:46:07 -050017# Where the zlib library and include files are located
Glenn Randers-Pehrsonf9f2fe01998-03-15 18:20:23 -060018# Changing these to ../zlib poses a security risk. If you want
19# to have zlib in an adjacent directory, specify the full path instead of "..".
20#ZLIBLIB=../zlib
21#ZLIBINC=../zlib
22
23ZLIBLIB=/usr/local/lib
24ZLIBINC=/usr/local/include
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060025
Andreas Dilger47a0c421997-05-16 02:46:07 -050026WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050027 -Wmissing-declarations -Wtraditional -Wcast-align \
28 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060029CFLAGS=-I$(ZLIBINC) -Wall -O3 \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050030 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060031LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060032
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060033#RANLIB=ranlib
34RANLIB=echo
Guy Schalnat4ee97b01996-01-16 01:51:56 -060035
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060036# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
37# have to change it.
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060038PNGMAJ = 2
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050039PNGMIN = 1.0.4
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060040PNGVER = $(PNGMAJ).$(PNGMIN)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060041
Andreas Dilger47a0c421997-05-16 02:46:07 -050042INCPATH=$(prefix)/include
43LIBPATH=$(prefix)/lib
Guy Schalnat4ee97b01996-01-16 01:51:56 -060044
Andreas Dilger47a0c421997-05-16 02:46:07 -050045OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050046 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
47 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060048
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060049OBJSDLL = $(OBJS:.o=.pic.o)
50
51.SUFFIXES: .c .o .pic.o
52
53.c.pic.o:
54 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
55
56all: libpng.a libpng.so pngtest
Guy Schalnat4ee97b01996-01-16 01:51:56 -060057
58libpng.a: $(OBJS)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060059 ar rc $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060060 $(RANLIB) $@
61
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060062libpng.so: libpng.so.$(PNGMAJ)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050063 ln -f -s libpng.so.$(PNGMAJ) libpng.so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060064
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060065libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050066 ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060067
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060068libpng.so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060069 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.$(PNGMAJ) \
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060070 -o libpng.so.$(PNGVER) $(OBJSDLL) -lz
Guy Schalnat4ee97b01996-01-16 01:51:56 -060071
72pngtest: pngtest.o libpng.so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060073 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060074
75test: pngtest
76 ./pngtest
77
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060078install: libpng.a libpng.so.$(PNGVER)
Andreas Dilger47a0c421997-05-16 02:46:07 -050079 -@mkdir $(INCPATH) $(LIBPATH)
80 cp png.h pngconf.h $(INCPATH)
81 chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060082 cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
Andreas Dilger47a0c421997-05-16 02:46:07 -050083 chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060084 -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050085 (cd $(LIBPATH); ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
86 ln -f -s libpng.so.$(PNGMAJ) libpng.so)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060087
88clean:
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060089 /bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
Guy Schalnat4ee97b01996-01-16 01:51:56 -060090
91# DO NOT DELETE THIS LINE -- make depend depends on it.
92
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060093png.o png.pic.o: png.h pngconf.h
94pngerror.o pngerror.pic.o: png.h pngconf.h
95pngrio.o pngrio.pic.o: png.h pngconf.h
96pngwio.o pngwio.pic.o: png.h pngconf.h
97pngmem.o pngmem.pic.o: png.h pngconf.h
98pngset.o pngset.pic.o: png.h pngconf.h
99pngget.o pngget.pic.o: png.h pngconf.h
100pngread.o pngread.pic.o: png.h pngconf.h
101pngrtran.o pngrtran.pic.o: png.h pngconf.h
102pngrutil.o pngrutil.pic.o: png.h pngconf.h
103pngtrans.o pngtrans.pic.o: png.h pngconf.h
104pngwrite.o pngwrite.pic.o: png.h pngconf.h
105pngwtran.o pngwtran.pic.o: png.h pngconf.h
106pngwutil.o pngwutil.pic.o: png.h pngconf.h
107pngpread.o pngpread.pic.o: png.h pngconf.h
108
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600109pngtest.o: png.h pngconf.h