blob: b69abb7c16bba27790e0e1303f657f1093e3bcc6 [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
35PNGMIN = 1.2.2beta1
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060036PNGVER = $(PNGMAJ).$(PNGMIN)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060037
Andreas Dilger47a0c421997-05-16 02:46:07 -050038INCPATH=$(prefix)/include
39LIBPATH=$(prefix)/lib
Guy Schalnat4ee97b01996-01-16 01:51:56 -060040
Andreas Dilger47a0c421997-05-16 02:46:07 -050041OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050042 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
43 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060044
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060045OBJSDLL = $(OBJS:.o=.pic.o)
46
47.SUFFIXES: .c .o .pic.o
48
49.c.pic.o:
50 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
51
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060052all: libpng.a libpng12.so pngtest
Guy Schalnat4ee97b01996-01-16 01:51:56 -060053
54libpng.a: $(OBJS)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060055 ar rc $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060056 $(RANLIB) $@
57
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060058libpng12.so: libpng12.so.$(PNGMAJ)
59 ln -f -s libpng12.so.$(PNGMAJ) libpng12.so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060060
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060061libpng12.so.$(PNGMAJ): libpng12.so.$(PNGVER)
62 ln -f -s libpng12.so.$(PNGVER) libpng12.so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060063
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060064libpng12.so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -060065 @case "`type ld`" in *ucb*) \
66 echo; \
67 echo '## WARNING:'; \
68 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
69 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
70 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
71 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
72 echo '## at all. If it is, things are likely to break because of'; \
73 echo '## the libucb dependency that is created.'; \
74 echo; \
75 ;; \
76 esac
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060077 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng12.so.$(PNGMAJ) \
78 -o libpng12.so.$(PNGVER) $(OBJSDLL) -lz
Guy Schalnat4ee97b01996-01-16 01:51:56 -060079
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060080pngtest: pngtest.o libpng12.so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060081 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060082
83test: pngtest
84 ./pngtest
85
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060086install: libpng.a libpng12.so.$(PNGVER)
Andreas Dilger47a0c421997-05-16 02:46:07 -050087 -@mkdir $(INCPATH) $(LIBPATH)
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060088 -@mkdir $(INCPATH)/libpng12
89 cp png.h pngconf.h $(INCPATH)/libpng12
90 cp png.h pngconf.h $(INCPATH)/libpng12
Andreas Dilger47a0c421997-05-16 02:46:07 -050091 chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060092 chmod 644 $(INCPATH)/libpng12/png.h \
93 $(INCPATH)/libpng12/pngconf.h
94 cp libpng.a libpng12.so.$(PNGVER) $(LIBPATH)
95 chmod 755 $(LIBPATH)/libpng12.so.$(PNGVER)
96 -@/bin/rm -f $(LIBPATH)/libpng12.so.$(PNGMAJ) \
97 $(LIBPATH)/libpng12.so
98 (cd $(LIBPATH); \
99 ln -f -s libpng12.so.$(PNGVER) libpng12.so.$(PNGMAJ); \
100 ln -f -s libpng12.so.$(PNGMAJ) libpng12.so)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600101
102clean:
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600103 /bin/rm -f *.o libpng.a libpng12.so libpng12.so.$(PNGMAJ)* \
104 pngtest pngout.png
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600105
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600106DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
107writelock:
108 chmod a-w *.[ch35] $(DOCS) scripts/*
109
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600110# DO NOT DELETE THIS LINE -- make depend depends on it.
111
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600112png.o png.pic.o: png.h pngconf.h
113pngerror.o pngerror.pic.o: png.h pngconf.h
114pngrio.o pngrio.pic.o: png.h pngconf.h
115pngwio.o pngwio.pic.o: png.h pngconf.h
116pngmem.o pngmem.pic.o: png.h pngconf.h
117pngset.o pngset.pic.o: png.h pngconf.h
118pngget.o pngget.pic.o: png.h pngconf.h
119pngread.o pngread.pic.o: png.h pngconf.h
120pngrtran.o pngrtran.pic.o: png.h pngconf.h
121pngrutil.o pngrutil.pic.o: png.h pngconf.h
122pngtrans.o pngtrans.pic.o: png.h pngconf.h
123pngwrite.o pngwrite.pic.o: png.h pngconf.h
124pngwtran.o pngwtran.pic.o: png.h pngconf.h
125pngwutil.o pngwutil.pic.o: png.h pngconf.h
126pngpread.o pngpread.pic.o: png.h pngconf.h
127
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600128pngtest.o: png.h pngconf.h