blob: 4a9cafc6d645754611d7f65a9cc047f49aab4a4a [file] [log] [blame]
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -06001# makefile for libpng on Solaris 2.x with gcc
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -06002# Copyright (C) 2002 Glenn Randers-Pehrson
Glenn Randers-Pehrsonbcfd15d1999-10-01 14:22:25 -05003# Contributed by William L. Sebok, based on makefile.linux
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -05004# Copyright (C) 1998 Greg Roelofs
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05005# Copyright (C) 1996, 1997 Andreas Dilger
Guy Schalnat4ee97b01996-01-16 01:51:56 -06006# For conditions of distribution and use, see copyright notice in png.h
7
8CC=gcc
Andreas Dilger47a0c421997-05-16 02:46:07 -05009
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060010# Where make install puts libpng.a, libpng12.so*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060011prefix=/usr/local
12
Andreas Dilger47a0c421997-05-16 02:46:07 -050013# Where the zlib library and include files are located
Glenn Randers-Pehrsonf9f2fe01998-03-15 18:20:23 -060014# Changing these to ../zlib poses a security risk. If you want
15# to have zlib in an adjacent directory, specify the full path instead of "..".
16#ZLIBLIB=../zlib
17#ZLIBINC=../zlib
18
19ZLIBLIB=/usr/local/lib
20ZLIBINC=/usr/local/include
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060021
Andreas Dilger47a0c421997-05-16 02:46:07 -050022WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050023 -Wmissing-declarations -Wtraditional -Wcast-align \
24 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060025CFLAGS=-I$(ZLIBINC) -Wall -O3 \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050026 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060027LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060028
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060029#RANLIB=ranlib
30RANLIB=echo
Guy Schalnat4ee97b01996-01-16 01:51:56 -060031
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060032# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060033# have to change it.
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060034PNGMAJ = 0
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060035PNGMIN = 1.2.2beta2
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060036PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060037LIBNAME = libpng12
Guy Schalnat4ee97b01996-01-16 01:51:56 -060038
Andreas Dilger47a0c421997-05-16 02:46:07 -050039INCPATH=$(prefix)/include
40LIBPATH=$(prefix)/lib
Guy Schalnat4ee97b01996-01-16 01:51:56 -060041
Andreas Dilger47a0c421997-05-16 02:46:07 -050042OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050043 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
44 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060045
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060046OBJSDLL = $(OBJS:.o=.pic.o)
47
48.SUFFIXES: .c .o .pic.o
49
50.c.pic.o:
51 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
52
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060053all: libpng.a $(LIBNAME).so pngtest
Guy Schalnat4ee97b01996-01-16 01:51:56 -060054
55libpng.a: $(OBJS)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060056 ar rc $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060057 $(RANLIB) $@
58
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060059$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
60 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060061
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060062$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
63 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060064
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060065$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -060066 @case "`type ld`" in *ucb*) \
67 echo; \
68 echo '## WARNING:'; \
69 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
70 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
71 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
72 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
73 echo '## at all. If it is, things are likely to break because of'; \
74 echo '## the libucb dependency that is created.'; \
75 echo; \
76 ;; \
77 esac
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060078 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
79 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz
Guy Schalnat4ee97b01996-01-16 01:51:56 -060080
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060081pngtest: pngtest.o $(LIBNAME).so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060082 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060083
84test: pngtest
85 ./pngtest
86
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060087install-static: libpng.a
88 -@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
89 -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
90 cp png.h pngconf.h $(INCPATH)
Andreas Dilger47a0c421997-05-16 02:46:07 -050091 chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060092 cp libpng.a $(LIBPATH)
93 chmod 644 $(LIBPATH)/libpng.a
94
95install: libpng.a $(LIBNAME).so.$(PNGVER)
96 -@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
97 -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
98 -@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
99 cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
100 chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
101 -@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
102 ln -f -s $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)
103 ln -f -s $(INCPATH)/$(LIBNAME)/pngconf.h $(INCPATH)
104 cp libpng.a $(LIBPATH)/$(LIBNAME).a
105 chmod 644 $(LIBPATH)/$(LIBNAME).a
106 -@/bin/rm -f $(LIBPATH)/libpng.a
107 ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
108 cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
109 chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
110 -@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
111 (cd $(LIBPATH);
112 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
113 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600114
115clean:
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600116 /bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600117 pngtest pngout.png
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600118
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600119DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
120writelock:
121 chmod a-w *.[ch35] $(DOCS) scripts/*
122
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600123# DO NOT DELETE THIS LINE -- make depend depends on it.
124
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600125png.o png.pic.o: png.h pngconf.h
126pngerror.o pngerror.pic.o: png.h pngconf.h
127pngrio.o pngrio.pic.o: png.h pngconf.h
128pngwio.o pngwio.pic.o: png.h pngconf.h
129pngmem.o pngmem.pic.o: png.h pngconf.h
130pngset.o pngset.pic.o: png.h pngconf.h
131pngget.o pngget.pic.o: png.h pngconf.h
132pngread.o pngread.pic.o: png.h pngconf.h
133pngrtran.o pngrtran.pic.o: png.h pngconf.h
134pngrutil.o pngrutil.pic.o: png.h pngconf.h
135pngtrans.o pngtrans.pic.o: png.h pngconf.h
136pngwrite.o pngwrite.pic.o: png.h pngconf.h
137pngwtran.o pngwtran.pic.o: png.h pngconf.h
138pngwutil.o pngwutil.pic.o: png.h pngconf.h
139pngpread.o pngpread.pic.o: png.h pngconf.h
140
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600141pngtest.o: png.h pngconf.h