blob: bdb0831a798182ee11e9d0e66b4614c988569381 [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-Pehrson73d57cb2002-03-25 18:49:08 -060035PNGMIN = 1.2.2beta5
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-Pehrsonc1bfe682002-03-06 22:08:00 -060087install-headers: png.h pngconf.h
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060088 -@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060089 -@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
90 cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
91 chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
92 -@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -060093 -@/bin/rm -f $(INCPATH)/libpng
94 ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060095
96install-static: install-headers libpng.a
97 -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060098 cp libpng.a $(LIBPATH)/$(LIBNAME).a
99 chmod 644 $(LIBPATH)/$(LIBNAME).a
100 -@/bin/rm -f $(LIBPATH)/libpng.a
101 ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600102
103install-shared: install-headers $(LIBNAME).so.$(PNGVER)
104 -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
Glenn Randers-Pehrson377657d2002-03-08 01:31:27 -0600105 -@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600106 -@/bin/rm -f $(LIBPATH)/libpng.so
107 -@/bin/rm -f $(LIBPATH)/libpng.so.3
108 -@/bin/rm -f $(LIBPATH)/libpng.so.3.*
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600109 cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
110 chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
Glenn Randers-Pehrson377657d2002-03-08 01:31:27 -0600111 (cd $(LIBPATH); \
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600112 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
113 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
114 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
115 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
116 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600117 -@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
118 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
119 cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
120 chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
121
122install: install-static install-shared
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600123
124clean:
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600125 /bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600126 pngtest pngout.png
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600127
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600128DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
129writelock:
130 chmod a-w *.[ch35] $(DOCS) scripts/*
131
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600132# DO NOT DELETE THIS LINE -- make depend depends on it.
133
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600134png.o png.pic.o: png.h pngconf.h
135pngerror.o pngerror.pic.o: png.h pngconf.h
136pngrio.o pngrio.pic.o: png.h pngconf.h
137pngwio.o pngwio.pic.o: png.h pngconf.h
138pngmem.o pngmem.pic.o: png.h pngconf.h
139pngset.o pngset.pic.o: png.h pngconf.h
140pngget.o pngget.pic.o: png.h pngconf.h
141pngread.o pngread.pic.o: png.h pngconf.h
142pngrtran.o pngrtran.pic.o: png.h pngconf.h
143pngrutil.o pngrutil.pic.o: png.h pngconf.h
144pngtrans.o pngtrans.pic.o: png.h pngconf.h
145pngwrite.o pngwrite.pic.o: png.h pngconf.h
146pngwtran.o pngwtran.pic.o: png.h pngconf.h
147pngwutil.o pngwutil.pic.o: png.h pngconf.h
148pngpread.o pngpread.pic.o: png.h pngconf.h
149
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600150pngtest.o: png.h pngconf.h