blob: f2b4c2c528747a98e35f4bb76188524587d00825 [file] [log] [blame]
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -06001# makefile for libpng on Solaris 2.x with gcc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -06002# Copyright (C) 2004, 2006 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
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -06008AR_RC=ar rc
Guy Schalnat4ee97b01996-01-16 01:51:56 -06009CC=gcc
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -060010MKDIR_P=mkdir -p
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060011LN_SF=ln -f -s
12RANLIB=echo
13RM_F=/bin/rm -f
Andreas Dilger47a0c421997-05-16 02:46:07 -050014
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060015# Where make install puts libpng.a, libpng12.so*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060016prefix=/usr/local
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060017exec_prefix=$prefix
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060018
Andreas Dilger47a0c421997-05-16 02:46:07 -050019# Where the zlib library and include files are located
Glenn Randers-Pehrsonf9f2fe01998-03-15 18:20:23 -060020# Changing these to ../zlib poses a security risk. If you want
21# to have zlib in an adjacent directory, specify the full path instead of "..".
22#ZLIBLIB=../zlib
23#ZLIBINC=../zlib
24
25ZLIBLIB=/usr/local/lib
26ZLIBINC=/usr/local/include
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060027
Andreas Dilger47a0c421997-05-16 02:46:07 -050028WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050029 -Wmissing-declarations -Wtraditional -Wcast-align \
30 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
Glenn Randers-Pehrsondff799e2004-08-07 21:42:49 -050031CFLAGS=-I$(ZLIBINC) -Wall -O \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050032 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050033LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060034
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060035PNGMAJ = 0
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -060036PNGMIN = 1.2.9beta8
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060037PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060038LIBNAME = libpng12
Guy Schalnat4ee97b01996-01-16 01:51:56 -060039
Andreas Dilger47a0c421997-05-16 02:46:07 -050040INCPATH=$(prefix)/include
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060041LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050042MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060043BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050044
45# override DESTDIR= on the make install command line to easily support
46# installing into a temporary location. Example:
47#
48# make install DESTDIR=/tmp/build/libpng
49#
50# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050051# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050052# you execute make install.
53DESTDIR=
Guy Schalnat4ee97b01996-01-16 01:51:56 -060054
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050055DB=$(DESTDIR)$(BINPATH)
56DI=$(DESTDIR)$(INCPATH)
57DL=$(DESTDIR)$(LIBPATH)
58DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050059
Andreas Dilger47a0c421997-05-16 02:46:07 -050060OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050061 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
62 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060063
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060064OBJSDLL = $(OBJS:.o=.pic.o)
65
66.SUFFIXES: .c .o .pic.o
67
68.c.pic.o:
69 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
70
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050071all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -060072
73libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060074 $(AR_RC) $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060075 $(RANLIB) $@
76
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050077libpng.pc:
78 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
79
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050080libpng-config:
81 ( cat scripts/libpng-config-head.in; \
82 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050083 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
84 echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE\"; \
85 echo L_opts=\"-L$(LIBPATH)\"; \
86 echo R_opts=\"-R$(LIBPATH)\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050087 echo libs=\"-lpng12 -lz -lm\"; \
88 cat scripts/libpng-config-body.in ) > libpng-config
89 chmod +x libpng-config
90
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060091$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060092 $(LN_FS) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060093
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060094$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060095 $(LN_FS) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060096
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060097$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -060098 @case "`type ld`" in *ucb*) \
99 echo; \
100 echo '## WARNING:'; \
101 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
102 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
103 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
104 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
105 echo '## at all. If it is, things are likely to break because of'; \
106 echo '## the libucb dependency that is created.'; \
107 echo; \
108 ;; \
109 esac
Glenn Randers-Pehrson865f4f02002-09-15 20:30:38 -0500110 $(LD) -G -h $(LIBNAME).so.$(PNGMAJ) \
111 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600112
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600113libpng.so.0.$(PNGMIN): $(OBJS)
114 $(LD) -G -h libpng.so.0 \
115 -o libpng.so.0.$(PNGMIN) $(OBJSDLL)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500116
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600117pngtest: pngtest.o $(LIBNAME).so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600118 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600119
120test: pngtest
121 ./pngtest
122
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600123install-headers: png.h pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600124 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
125 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500126 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500127 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600128 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
129 -@$(RM_F) $(DI)/libpng
130 (cd $(DI); $(LN_FS) $(LIBNAME) libpng; $(LN_FS) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600131
132install-static: install-headers libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600133 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500134 cp libpng.a $(DL)/$(LIBNAME).a
135 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600136 -@$(RM_F) $(DL)/libpng.a
137 (cd $(DL); $(LN_FS) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600138
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500139install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600140 libpng.so.0.$(PNGMIN)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600141 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
142 -@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
143 -@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
144 -@$(RM_F) $(DL)/libpng.so
145 -@$(RM_F) $(DL)/libpng.so.0
146 -@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500147 cp $(LIBNAME).so.$(PNGVER) $(DL)
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600148 cp libpng.so.0.$(PNGMIN) $(DL)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500149 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600150 chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500151 (cd $(DL); \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600152 $(LN_FS) libpng.so.0.$(PNGMIN) libpng.so.0; \
153 $(LN_FS) libpng.so.0 libpng.so; \
154 $(LN_FS) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
155 $(LN_FS) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
156 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
157 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
158 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500159 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
160 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600161 (cd $(DL)/pkgconfig; $(LN_FS) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600162
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500163install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600164 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
165 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
166 -@$(RM_F) $(DM)/man3/libpng.3
167 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500168 cp libpng.3 $(DM)/man3
169 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600170 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
171 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500172 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500173
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500174install-config: libpng-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600175 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
176 -@$(RM_F) $(DB)/libpng-config
177 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500178 cp libpng-config $(DB)/$(LIBNAME)-config
179 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600180 (cd $(DB); $(LN_FS) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500181
182install: install-static install-shared install-man install-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600183
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500184# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500185# move the library to its final location. Use test-dd to test it
186# before then.
187
188test-dd:
189 echo
190 echo Testing installed dynamic shared library in $(DL).
191 $(CC) -I$(DI) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600192 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
193 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500194 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
195 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500196
197test-installed:
198 echo
199 echo Testing installed dynamic shared library.
200 $(CC) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600201 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
202 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500203 -L$(ZLIBLIB) -R$(ZLIBLIB)
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500204 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500205
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600206clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600207 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500208 libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600209 libpng.so.0.$(PNGMIN) \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500210 libpng.pc
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600211
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600212DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
213writelock:
214 chmod a-w *.[ch35] $(DOCS) scripts/*
215
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600216# DO NOT DELETE THIS LINE -- make depend depends on it.
217
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600218png.o png.pic.o: png.h pngconf.h
219pngerror.o pngerror.pic.o: png.h pngconf.h
220pngrio.o pngrio.pic.o: png.h pngconf.h
221pngwio.o pngwio.pic.o: png.h pngconf.h
222pngmem.o pngmem.pic.o: png.h pngconf.h
223pngset.o pngset.pic.o: png.h pngconf.h
224pngget.o pngget.pic.o: png.h pngconf.h
225pngread.o pngread.pic.o: png.h pngconf.h
226pngrtran.o pngrtran.pic.o: png.h pngconf.h
227pngrutil.o pngrutil.pic.o: png.h pngconf.h
228pngtrans.o pngtrans.pic.o: png.h pngconf.h
229pngwrite.o pngwrite.pic.o: png.h pngconf.h
230pngwtran.o pngwtran.pic.o: png.h pngconf.h
231pngwutil.o pngwutil.pic.o: png.h pngconf.h
232pngpread.o pngpread.pic.o: png.h pngconf.h
233
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600234pngtest.o: png.h pngconf.h