blob: fbe5ec9958b78cb4d730502e8ff9b422bef7ab3f [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
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -05003# Copyright (C) 1998 Greg Roelofs
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05004# Copyright (C) 1996, 1997 Andreas Dilger
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# Where make install puts libpng.a, libpng.so*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060010prefix=/usr/local
11
Andreas Dilger47a0c421997-05-16 02:46:07 -050012# Where the zlib library and include files are located
Glenn Randers-Pehrsonf9f2fe01998-03-15 18:20:23 -060013# Changing these to ../zlib poses a security risk. If you want
14# to have zlib in an adjacent directory, specify the full path instead of "..".
15#ZLIBLIB=../zlib
16#ZLIBINC=../zlib
17
18ZLIBLIB=/usr/local/lib
19ZLIBINC=/usr/local/include
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060020
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-Pehrson08a33431998-03-07 06:06:55 -060024CFLAGS=-I$(ZLIBINC) -Wall -O3 \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050025 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060026LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060027
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060028#RANLIB=ranlib
29RANLIB=echo
Guy Schalnat4ee97b01996-01-16 01:51:56 -060030
Glenn Randers-Pehrson8b6a8892001-05-18 04:54:50 -050031# read libpng.txt or png.h to see why PNGMAJ is 3. You should not
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060032# have to change it.
Glenn Randers-Pehrson8b6a8892001-05-18 04:54:50 -050033PNGMAJ = 3
Glenn Randers-Pehrsonf50c91b2001-12-12 17:37:30 -060034PNGMIN = 1.2.1
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060035PNGVER = $(PNGMAJ).$(PNGMIN)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060036
Andreas Dilger47a0c421997-05-16 02:46:07 -050037INCPATH=$(prefix)/include
38LIBPATH=$(prefix)/lib
Guy Schalnat4ee97b01996-01-16 01:51:56 -060039
Andreas Dilger47a0c421997-05-16 02:46:07 -050040OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050041 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
42 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060043
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060044OBJSDLL = $(OBJS:.o=.pic.o)
45
46.SUFFIXES: .c .o .pic.o
47
48.c.pic.o:
49 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
50
51all: libpng.a libpng.so pngtest
Guy Schalnat4ee97b01996-01-16 01:51:56 -060052
53libpng.a: $(OBJS)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060054 ar rc $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060055 $(RANLIB) $@
56
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060057libpng.so: libpng.so.$(PNGMAJ)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050058 ln -f -s libpng.so.$(PNGMAJ) libpng.so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060059
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060060libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050061 ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060062
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060063libpng.so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -060064 @case "`type ld`" in *ucb*) \
65 echo; \
66 echo '## WARNING:'; \
67 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
68 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
69 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
70 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
71 echo '## at all. If it is, things are likely to break because of'; \
72 echo '## the libucb dependency that is created.'; \
73 echo; \
74 ;; \
75 esac
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060076 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.$(PNGMAJ) \
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060077 -o libpng.so.$(PNGVER) $(OBJSDLL) -lz
Guy Schalnat4ee97b01996-01-16 01:51:56 -060078
79pngtest: pngtest.o libpng.so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060080 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060081
82test: pngtest
83 ./pngtest
84
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060085install: libpng.a libpng.so.$(PNGVER)
Andreas Dilger47a0c421997-05-16 02:46:07 -050086 -@mkdir $(INCPATH) $(LIBPATH)
87 cp png.h pngconf.h $(INCPATH)
88 chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060089 cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
Andreas Dilger47a0c421997-05-16 02:46:07 -050090 chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060091 -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050092 (cd $(LIBPATH); ln -f -s libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
93 ln -f -s libpng.so.$(PNGMAJ) libpng.so)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060094
95clean:
Glenn Randers-Pehrsonae498dc2001-11-24 14:53:31 -060096 /bin/rm -f *.o libpng.a libpng.so libpng.so.$(PNGMAJ)* pngtest pngout.png
Guy Schalnat4ee97b01996-01-16 01:51:56 -060097
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -060098DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
99writelock:
100 chmod a-w *.[ch35] $(DOCS) scripts/*
101
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600102# DO NOT DELETE THIS LINE -- make depend depends on it.
103
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600104png.o png.pic.o: png.h pngconf.h
105pngerror.o pngerror.pic.o: png.h pngconf.h
106pngrio.o pngrio.pic.o: png.h pngconf.h
107pngwio.o pngwio.pic.o: png.h pngconf.h
108pngmem.o pngmem.pic.o: png.h pngconf.h
109pngset.o pngset.pic.o: png.h pngconf.h
110pngget.o pngget.pic.o: png.h pngconf.h
111pngread.o pngread.pic.o: png.h pngconf.h
112pngrtran.o pngrtran.pic.o: png.h pngconf.h
113pngrutil.o pngrutil.pic.o: png.h pngconf.h
114pngtrans.o pngtrans.pic.o: png.h pngconf.h
115pngwrite.o pngwrite.pic.o: png.h pngconf.h
116pngwtran.o pngwtran.pic.o: png.h pngconf.h
117pngwutil.o pngwutil.pic.o: png.h pngconf.h
118pngpread.o pngpread.pic.o: png.h pngconf.h
119
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600120pngtest.o: png.h pngconf.h