blob: 5d7a11e15d71ca641e44356324e6ad057283d1eb [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001# makefile for libpng on DEC Alpha Unix
2# Copyright (C) 2000-2002 Glenn Randers-Pehrson
3# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
4# For conditions of distribution and use, see copyright notice in png.h
5
6# where make install puts libpng.a and png.h
7prefix=/usr/local
8INCPATH=$(prefix)/include
9LIBPATH=$(prefix)/lib
10MANPATH=$(prefix)/man
11BINPATH=$(prefix)/bin
12
13# override DESTDIR= on the make install command line to easily support
14# installing into a temporary location. Example:
15#
16# make install DESTDIR=/tmp/build/libpng
17#
18# If you're going to install into a temporary location
19# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
20# you execute make install.
21DESTDIR=
22
23DB=$(DESTDIR)$(BINPATH)
24DI=$(DESTDIR)$(INCPATH)
25DL=$(DESTDIR)$(LIBPATH)
26DM=$(DESTDIR)$(MANPATH)
27
28# Where the zlib library and include files are located
29#ZLIBLIB=/usr/local/lib
30#ZLIBINC=/usr/local/include
31ZLIBLIB=../zlib
32ZLIBINC=../zlib
33
34PNGMAJ = 0
35PNGMIN = 1.2.5
36PNGVER = $(PNGMAJ).$(PNGMIN)
37LIBNAME = libpng12
38
39CC=cc
40CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
41LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
42
43#RANLIB=echo
44RANLIB=ranlib
45
46OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
47 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
48 pngwtran.o pngmem.o pngerror.o pngpread.o
49
50all: $(LIBNAME).so libpng.a pngtest libpng.pc libpng-config
51
52libpng.a: $(OBJS)
53 ar rc $@ $(OBJS)
54 $(RANLIB) $@
55
56libpng.pc:
57 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
58
59libpng-config:
60 ( cat scripts/libpng-config-head.in; \
61 echo prefix=\"$(prefix)\"; \
62 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
63 echo ccopts=\"-std\"; \
64 echo L_opts=\"-L$(LIBPATH)\"; \
65 echo libs=\"-lpng12 -lz -lm\"; \
66 cat scripts/libpng-config-body.in ) > libpng-config
67 chmod +x libpng-config
68
69$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
70 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
71
72$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
73 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
74
75$(LIBNAME).so.$(PNGVER): $(OBJS)
76 $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB)
77 -soname $(LIBNAME).so.$(PNGMAJ)
78
79libpng.so.3.$(PNGMIN): $(OBJS)
80 $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB)
81 -soname libpng.so.3
82
83pngtest: pngtest.o libpng.a
84 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
85
86test: pngtest
87 ./pngtest
88
89install-headers: png.h pngconf.h
90 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
91 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
92 cp png.h pngconf.h $(DI)/$(LIBNAME)
93 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
94 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
95 -@/bin/rm -f $(DI)/libpng
96 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
97
98install-static: install-headers libpng.a
99 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
100 cp libpng.a $(DL)/$(LIBNAME).a
101 chmod 644 $(DL)/$(LIBNAME).a
102 -@/bin/rm -f $(DL)/libpng.a
103 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
104
105install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
106 libpng.so.3.$(PNGMIN)
107 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
108 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
109 -@/bin/rm -f $(DL)/libpng.so
110 -@/bin/rm -f $(DL)/libpng.so.3
111 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
112 cp $(LIBNAME).so.$(PNGVER) $(DL)
113 cp libpng.so.3.$(PNGMIN) $(DL)
114 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
115 chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
116 (cd $(DL); \
117 ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
118 ln -f -s libpng.so.3 libpng.so; \
119 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
120 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
121 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
122 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
123 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
124 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
125 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
126 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
127
128install-man: libpng.3 libpngpf.3 png.5
129 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
130 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
131 -@/bin/rm -f $(DM)/man3/libpng.3
132 -@/bin/rm -f $(DM)/man3/libpngpf.3
133 cp libpng.3 $(DM)/man3
134 cp libpngpf.3 $(DM)/man3
135 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
136 -@/bin/rm -f $(DM)/man5/png.5
137 cp png.5 $(DM)/man5
138
139install-config: libpng-config
140 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
141 -@/bin/rm -f $(DB)/libpng-config
142 -@/bin/rm -f $(DB)/$(LIBNAME)-config
143 cp libpng-config $(DB)/$(LIBNAME)-config
144 chmod 755 $(DB)/$(LIBNAME)-config
145 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
146
147install: install-static install-shared install-man install-config
148
149# If you installed in $(DESTDIR), test-installed won't work until you
150# move the library to its final location.
151
152test-installed:
153 echo
154 echo Testing installed dynamic shared library.
155 $(CC) -w1 -I$(ZLIBINC) \
156 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
157 -L$(ZLIBLIB) -R$(ZLIBLIB) \
158 -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
159 ./pngtesti pngtest.png
160
161clean:
162 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
163 libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
164 libpng.so.3.$(PNGMIN) \
165 libpng.pc
166
167# DO NOT DELETE THIS LINE -- make depend depends on it.
168
169png.o: png.h pngconf.h
170pngerror.o: png.h pngconf.h
171pngrio.o: png.h pngconf.h
172pngwio.o: png.h pngconf.h
173pngmem.o: png.h pngconf.h
174pngset.o: png.h pngconf.h
175pngget.o: png.h pngconf.h
176pngread.o: png.h pngconf.h
177pngrtran.o: png.h pngconf.h
178pngrutil.o: png.h pngconf.h
179pngtest.o: png.h pngconf.h
180pngtrans.o: png.h pngconf.h
181pngwrite.o: png.h pngconf.h
182pngwtran.o: png.h pngconf.h
183pngwutil.o: png.h pngconf.h
184pngpread.o: png.h pngconf.h
185