blob: b79690714c71e59af8be3e4951c67700e4357f9e [file] [log] [blame]
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -06001# makefile for libpng on Solaris 2.x with gcc
Glenn Randers-Pehrsonbcfd15d1999-10-01 14:22:25 -05002# Contributed by William L. Sebok, based on makefile.linux
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-Pehrson166c5a31999-12-10 09:43:02 -06009case "`type ld`" in *ucb*) echo "
10# WARNING:
11# The commands "CC" and "LD" must NOT refer to /usr/ucb/cc and
12# /usr/ucb/ld. If they do, you need to adjust your PATH environment
13# variable to put /usr/ccs/bin ahead of /usr/ucb. The environment
14# variable LD_LIBRARY_PATH should not be set at all. If it is,
15# things are likely to break because of the libucb dependency that
16# is created.
17" ;;
18esac
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050019
20# Where make install puts libpng.a, libpng.so*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060021prefix=/usr/local
22
Andreas Dilger47a0c421997-05-16 02:46:07 -050023# Where the zlib library and include files are located
Glenn Randers-Pehrsonf9f2fe01998-03-15 18:20:23 -060024# Changing these to ../zlib poses a security risk. If you want
25# to have zlib in an adjacent directory, specify the full path instead of "..".
26#ZLIBLIB=../zlib
27#ZLIBINC=../zlib
28
29ZLIBLIB=/usr/local/lib
30ZLIBINC=/usr/local/include
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060031
Andreas Dilger47a0c421997-05-16 02:46:07 -050032WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050033 -Wmissing-declarations -Wtraditional -Wcast-align \
34 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060035CFLAGS=-I$(ZLIBINC) -Wall -O3 \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050036 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060037LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060038
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060039#RANLIB=ranlib
40RANLIB=echo
Guy Schalnat4ee97b01996-01-16 01:51:56 -060041
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060042# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
43# have to change it.
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060044PNGMAJ = 2
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -060045PNGMIN = 1.0.5h
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060046PNGVER = $(PNGMAJ).$(PNGMIN)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060047
Andreas Dilger47a0c421997-05-16 02:46:07 -050048INCPATH=$(prefix)/include
49LIBPATH=$(prefix)/lib
Guy Schalnat4ee97b01996-01-16 01:51:56 -060050
Andreas Dilger47a0c421997-05-16 02:46:07 -050051OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050052 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
53 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060054
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060055OBJSDLL = $(OBJS:.o=.pic.o)
56
57.SUFFIXES: .c .o .pic.o
58
59.c.pic.o:
60 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
61
62all: libpng.a libpng.so pngtest
Guy Schalnat4ee97b01996-01-16 01:51:56 -060063
64libpng.a: $(OBJS)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060065 ar rc $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060066 $(RANLIB) $@
67
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060068libpng.so: libpng.so.$(PNGMAJ)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050069 ln -f -s libpng.so.$(PNGMAJ) libpng.so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060070
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060071libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050072 ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060073
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060074libpng.so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060075 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.$(PNGMAJ) \
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060076 -o libpng.so.$(PNGVER) $(OBJSDLL) -lz
Guy Schalnat4ee97b01996-01-16 01:51:56 -060077
78pngtest: pngtest.o libpng.so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060079 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060080
81test: pngtest
82 ./pngtest
83
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060084install: libpng.a libpng.so.$(PNGVER)
Andreas Dilger47a0c421997-05-16 02:46:07 -050085 -@mkdir $(INCPATH) $(LIBPATH)
86 cp png.h pngconf.h $(INCPATH)
87 chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060088 cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
Andreas Dilger47a0c421997-05-16 02:46:07 -050089 chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060090 -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050091 (cd $(LIBPATH); ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
92 ln -f -s libpng.so.$(PNGMAJ) libpng.so)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060093
94clean:
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060095 /bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
Guy Schalnat4ee97b01996-01-16 01:51:56 -060096
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -060097DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
98writelock:
99 chmod a-w *.[ch35] $(DOCS) scripts/*
100
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600101# DO NOT DELETE THIS LINE -- make depend depends on it.
102
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600103png.o png.pic.o: png.h pngconf.h
104pngerror.o pngerror.pic.o: png.h pngconf.h
105pngrio.o pngrio.pic.o: png.h pngconf.h
106pngwio.o pngwio.pic.o: png.h pngconf.h
107pngmem.o pngmem.pic.o: png.h pngconf.h
108pngset.o pngset.pic.o: png.h pngconf.h
109pngget.o pngget.pic.o: png.h pngconf.h
110pngread.o pngread.pic.o: png.h pngconf.h
111pngrtran.o pngrtran.pic.o: png.h pngconf.h
112pngrutil.o pngrutil.pic.o: png.h pngconf.h
113pngtrans.o pngtrans.pic.o: png.h pngconf.h
114pngwrite.o pngwrite.pic.o: png.h pngconf.h
115pngwtran.o pngwtran.pic.o: png.h pngconf.h
116pngwutil.o pngwutil.pic.o: png.h pngconf.h
117pngpread.o pngpread.pic.o: png.h pngconf.h
118
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600119pngtest.o: png.h pngconf.h