blob: 8b3636ba6a1afdb517708f8d9aa702a2101d3658 [file] [log] [blame]
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06001# makefile for libpng on DEC Alpha Unix
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -06002# Copyright (C) 2000-2002, 2006 Glenn Randers-Pehrson
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06003# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
4# For conditions of distribution and use, see copyright notice in png.h
5
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -06006# Library name:
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -05007PNGMAJ = 0
Glenn Randers-Pehrson43aaf6e2008-08-05 22:17:03 -05008PNGMIN = 1.4.0beta28
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -06009PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050010LIBNAME = libpng14
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060011
12# Shared library names:
13LIBSO=$(LIBNAME).so
14LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
15LIBSOVER=$(LIBNAME).so.$(PNGVER)
16OLDSO=libpng.so
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060017
18# Utilities:
19AR_RC=ar rc
20CC=cc
21MKDIR_P=mkdir
22LN_SF=ln -f -s
23RANLIB=ranlib
24RM_F=/bin/rm -f
25
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060026# where make install puts libpng.a and png.h
27prefix=/usr/local
Glenn Randers-Pehrsonad310542006-04-18 05:31:20 -050028exec_prefix=$(prefix)
Glenn Randers-Pehrson5e5c1e12000-11-10 12:26:19 -060029INCPATH=$(prefix)/include
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060030LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050031MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060032BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050033
34# override DESTDIR= on the make install command line to easily support
35# installing into a temporary location. Example:
36#
37# make install DESTDIR=/tmp/build/libpng
38#
39# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050040# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050041# you execute make install.
42DESTDIR=
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060043
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050044DB=$(DESTDIR)$(BINPATH)
45DI=$(DESTDIR)$(INCPATH)
46DL=$(DESTDIR)$(LIBPATH)
47DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050048
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060049# Where the zlib library and include files are located
50#ZLIBLIB=/usr/local/lib
51#ZLIBINC=/usr/local/include
52ZLIBLIB=../zlib
53ZLIBINC=../zlib
54
Glenn Randers-Pehrson761bf9f2002-10-31 19:53:20 -060055CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
56LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
57
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060058OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
59 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
60 pngwtran.o pngmem.o pngerror.o pngpread.o
61
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050062all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config pngdefs.h
63
64pngdefs.h:
65 echo "/* pngdefs.h was built by makefile.dec */" > pngdefs.h
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060066
67libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060068 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060069 $(RANLIB) $@
70
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050071libpng.pc:
72 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
73
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050074libpng-config:
75 ( cat scripts/libpng-config-head.in; \
76 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050077 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
78 echo ccopts=\"-std\"; \
79 echo L_opts=\"-L$(LIBPATH)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050080 echo libs=\"-lpng14 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050081 cat scripts/libpng-config-body.in ) > libpng-config
82 chmod +x libpng-config
83
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060084$(LIBSO): $(LIBSOMAJ)
85 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060086
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060087$(LIBSOMAJ): $(LIBSOVER)
88 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060089
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060090$(LIBSOVER): $(OBJS)
Glenn Randers-Pehrsonc33ab4e2002-10-22 08:28:43 -050091 $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060092 -soname $(LIBSOMAJ)
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060093
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060094pngtest: pngtest.o libpng.a
Glenn Randers-Pehrsonea3bcd71998-03-07 14:33:00 -060095 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060096
97test: pngtest
98 ./pngtest
99
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500100install-headers: png.h pngconf.h pngdefs.h
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600101 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
102 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500103 cp png.h pngconf.h pngdefs.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500104 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500105 chmod 644 $(DI)/$(LIBNAME)/pngdefs.h
106 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h $(DI)/pngdefs.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500107 -@/bin/rm -f $(DI)/libpng
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600108 (cd $(DI); $(LN_SF)(LIBNAME) libpng; $(LN_SF)(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600109
110install-static: install-headers libpng.a
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600111 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500112 cp libpng.a $(DL)/$(LIBNAME).a
113 chmod 644 $(DL)/$(LIBNAME).a
114 -@/bin/rm -f $(DL)/libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600115 (cd $(DL); $(LN_SF)(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600116
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500117install-shared: install-headers $(LIBSOVER) libpng.pc
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600118 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600119 -@/bin/rm -f $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
120 -@/bin/rm -f $(DL)/$(LIBSOMAJ)
121 -@/bin/rm -f $(DL)/$(OLDSO)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600122 cp $(LIBSOVER) $(DL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600123 chmod 755 $(DL)/$(LIBSOVER)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500124 (cd $(DL); \
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500125 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
126 $(LN_SF) $(LIBSOMAJ) $(LIBSO); \
127 $(LN_SF) $(OLDSO) $(LIBSO))
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600128 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500129 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
130 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
131 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
132 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600133 (cd $(DL)/pkgconfig; $(LN_SF)(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600134
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500135install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600136 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
137 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500138 -@/bin/rm -f $(DM)/man3/libpng.3
139 -@/bin/rm -f $(DM)/man3/libpngpf.3
140 cp libpng.3 $(DM)/man3
141 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600142 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500143 -@/bin/rm -f $(DM)/man5/png.5
144 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500145
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500146install-config: libpng-config
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600147 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500148 -@/bin/rm -f $(DB)/libpng-config
149 -@/bin/rm -f $(DB)/$(LIBNAME)-config
150 cp libpng-config $(DB)/$(LIBNAME)-config
151 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600152 (cd $(DB); $(LN_SF)(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500153
154install: install-static install-shared install-man install-config
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600155
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500156# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500157# move the library to its final location. Use test-dd to test it
158# before then.
159
160test-dd:
161 echo
162 echo Testing installed dynamic shared library in $(DL).
163 $(CC) -w1 -I$(DI) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600164 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500165 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600166 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500167 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500168
169test-installed:
170 echo
171 echo Testing installed dynamic shared library.
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500172 $(CC) -w1 -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600173 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500174 -L$(ZLIBLIB) -R$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600175 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500176 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500177
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600178clean:
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500179 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600180 libpng-config $(LIBSO) $(LIBSOMAJ)* \
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500181 libpng.pc pngdefs.h
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600182
183# DO NOT DELETE THIS LINE -- make depend depends on it.
184
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500185png.o: png.h pngconf.h pngdefs.h pngpriv.h
186pngerror.o: png.h pngconf.h pngdefs.h pngpriv.h
187pngrio.o: png.h pngconf.h pngdefs.h pngpriv.h
188pngwio.o: png.h pngconf.h pngdefs.h pngpriv.h
189pngmem.o: png.h pngconf.h pngdefs.h pngpriv.h
190pngset.o: png.h pngconf.h pngdefs.h pngpriv.h
191pngget.o: png.h pngconf.h pngdefs.h pngpriv.h
192pngread.o: png.h pngconf.h pngdefs.h pngpriv.h
193pngrtran.o: png.h pngconf.h pngdefs.h pngpriv.h
194pngrutil.o: png.h pngconf.h pngdefs.h pngpriv.h
195pngtrans.o: png.h pngconf.h pngdefs.h pngpriv.h
196pngwrite.o: png.h pngconf.h pngdefs.h pngpriv.h
197pngwtran.o: png.h pngconf.h pngdefs.h pngpriv.h
198pngwutil.o: png.h pngconf.h pngdefs.h pngpriv.h
199pngpread.o: png.h pngconf.h pngdefs.h pngpriv.h
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600200
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500201pngtest.o: png.h pngconf.h pngdefs.h