blob: a15cb2d6cd0b142e493bc7355f17c9a83bca37a8 [file] [log] [blame]
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -05001# makefile for libpng on Solaris 9 (beta) with Forte cc
2# Updated by Chad Schrock for Solaris 9
3# Contributed by William L. Sebok, based on makefile.linux
4# Copyright (C) 1998-2001 Greg Roelofs
5# Copyright (C) 1996-1997 Andreas Dilger
6# For conditions of distribution and use, see copyright notice in png.h
7
8# gcc 2.95 doesn't work.
9CC=cc
10
11# Where make install puts libpng.a, libpng.so*, and png.h
12prefix=/usr/local
13
14# Where the zlib library and include files are located
15# Changing these to ../zlib poses a security risk. If you want
16# to have zlib in an adjacent directory, specify the full path instead of "..".
17#ZLIBLIB=../zlib
18#ZLIBINC=../zlib
19#ZLIBLIB=/usr/local/lib
20#ZLIBINC=/usr/local/include
21#Use the preinstalled zlib that comes with Solaris 9:
22ZLIBLIB=/usr/lib
23ZLIBINC=/usr/include
24
25#WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
26 -Wmissing-declarations -Wtraditional -Wcast-align \
27 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
28#CFLAGS=-I$(ZLIBINC) -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5
29CFLAGS=-I$(ZLIBINC) -O3
30LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm
31
32#RANLIB=ranlib
33RANLIB=echo
34
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060035# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050036# have to change it.
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060037PNGMAJ = 0
Glenn Randers-Pehrson25228ab2002-03-31 07:33:55 -060038PNGMIN = 1.2.2beta6
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050039PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060040LIBNAME = libpng12
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050041
42INCPATH=$(prefix)/include
43LIBPATH=$(prefix)/lib
44
45OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
46 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
47 pngwtran.o pngmem.o pngerror.o pngpread.o
48
49OBJSDLL = $(OBJS:.o=.pic.o)
50
51.SUFFIXES: .c .o .pic.o
52
53.c.pic.o:
54 $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
55
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060056all: libpng.a $(LIBNAME).so pngtest
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050057
58libpng.a: $(OBJS)
59 ar rc $@ $(OBJS)
60 $(RANLIB) $@
61
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060062$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
63 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050064
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060065$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
66 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050067
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060068$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050069 @case "`type ld`" in *ucb*) \
70 echo; \
71 echo '## WARNING:'; \
72 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
73 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
74 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
75 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
76 echo '## at all. If it is, things are likely to break because of'; \
77 echo '## the libucb dependency that is created.'; \
78 echo; \
79 ;; \
80 esac
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060081 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
82 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050083
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060084pngtest: pngtest.o $(LIBNAME).so
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050085 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
86
87test: pngtest
88 ./pngtest
89
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060090install-headers: png.h pngconf.h
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060091 -@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060092 -@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
93 cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060094 chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060095 -@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -060096 -@/bin/rm -f $(INCPATH)/libpng
97 ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060098
99install-static: install-headers libpng.a
100 -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600101 cp libpng.a $(LIBPATH)/$(LIBNAME).a
102 chmod 644 $(LIBPATH)/$(LIBNAME).a
103 -@/bin/rm -f $(LIBPATH)/libpng.a
104 ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600105
106install-shared: install-headers $(LIBNAME).so.$(PNGVER)
107 -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
Glenn Randers-Pehrson377657d2002-03-08 01:31:27 -0600108 -@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600109 -@/bin/rm -f $(LIBPATH)/libpng.so
110 -@/bin/rm -f $(LIBPATH)/libpng.so.3
111 -@/bin/rm -f $(LIBPATH)/libpng.so.3.*
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600112 cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600113 chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
Glenn Randers-Pehrson377657d2002-03-08 01:31:27 -0600114 (cd $(LIBPATH); \
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600115 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
116 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
117 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600118 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
119 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600120 -@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
121 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
122 cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
123 chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
124
125install: install-static install-shared
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -0500126
127clean:
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600128 /bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
129 pngtest pngout.png
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -0500130
131DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
132writelock:
133 chmod a-w *.[ch35] $(DOCS) scripts/*
134
135# DO NOT DELETE THIS LINE -- make depend depends on it.
136
137png.o png.pic.o: png.h pngconf.h
138pngerror.o pngerror.pic.o: png.h pngconf.h
139pngrio.o pngrio.pic.o: png.h pngconf.h
140pngwio.o pngwio.pic.o: png.h pngconf.h
141pngmem.o pngmem.pic.o: png.h pngconf.h
142pngset.o pngset.pic.o: png.h pngconf.h
143pngget.o pngget.pic.o: png.h pngconf.h
144pngread.o pngread.pic.o: png.h pngconf.h
145pngrtran.o pngrtran.pic.o: png.h pngconf.h
146pngrutil.o pngrutil.pic.o: png.h pngconf.h
147pngtrans.o pngtrans.pic.o: png.h pngconf.h
148pngwrite.o pngwrite.pic.o: png.h pngconf.h
149pngwtran.o pngwtran.pic.o: png.h pngconf.h
150pngwutil.o pngwutil.pic.o: png.h pngconf.h
151pngpread.o pngpread.pic.o: png.h pngconf.h
152
153pngtest.o: png.h pngconf.h