• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
2# Copyright (C) 2002, 2006-2008, 2010-2014 Glenn Randers-Pehrson
3# Copyright (C) 2001, Laurent faillie
4# Copyright (C) 1998, 1999 Greg Roelofs
5# Copyright (C) 1996, 1997 Andreas Dilger
6#
7# This code is released under the libpng license.
8# For conditions of distribution and use, see the disclaimer
9# and license in png.h
10
11# Library name:
12LIBNAME = libpng16
13PNGMAJ = 16
14
15# Shared library names:
16LIBSO=$(LIBNAME).sl
17LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
18LIBSOREL=$(LIBSOMAJ).$(RELEASE)
19OLDSO=libpng.sl
20
21# Utilities:
22CC=gcc
23LD=ld
24AR_RC=ar rc
25MKDIR_P=mkdir -p
26LN_SF=ln -sf
27RANLIB=ranlib
28CP=cp
29RM_F=/bin/rm -f
30
31# where "make install" puts libpng.a, $(OLDSO)*, png.h, pngconf.h
32# and pnglibconf.h
33prefix=/usr/local
34exec_prefix=$(prefix)
35
36# Where the zlib library and include files are located
37ZLIBLIB=/opt/zlib/lib
38ZLIBINC=/opt/zlib/include
39
40# Note that if you plan to build a libpng shared library, zlib must also
41# be a shared library, which zlib's configure does not do.  After running
42# zlib's configure, edit the appropriate lines of makefile to read:
43#   CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
44#   LDSHARED=ld -b
45#   SHAREDLIB=libz.sl
46
47ALIGN=
48# for i386:
49#ALIGN=-malign-loops=2 -malign-functions=2
50
51WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
52	-Wmissing-declarations -Wtraditional -Wcast-align \
53	-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
54
55# for pgcc version 2.95.1, -O3 is buggy; don't use it.
56
57CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
58CFLAGS=-W -Wall -O3 -funroll-loops $(ALIGN) # $(WARNMORE) -g
59#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
60LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm
61
62INCPATH=$(prefix)/include
63LIBPATH=$(exec_prefix)/lib
64MANPATH=$(prefix)/man
65BINPATH=$(exec_prefix)/bin
66
67# override DESTDIR= on the make install command line to easily support
68# installing into a temporary location.  Example:
69#
70#    make install DESTDIR=/tmp/build/libpng
71#
72# If you're going to install into a temporary location
73# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
74# you execute make install.
75DESTDIR=
76
77DB=$(DESTDIR)$(BINPATH)
78DI=$(DESTDIR)$(INCPATH)
79DL=$(DESTDIR)$(LIBPATH)
80DM=$(DESTDIR)$(MANPATH)
81
82OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
83	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
84	pngwtran.o pngmem.o pngerror.o pngpread.o
85
86OBJSDLL = $(OBJS:.o=.pic.o)
87
88.SUFFIXES:      .c .o .pic.o
89
90.c.o:
91	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
92
93.c.pic.o:
94	$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c
95
96all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
97
98libpng.a: $(OBJS)
99	$(AR_RC) $@ $(OBJS)
100	$(RANLIB) $@
101
102libpng.pc:
103	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
104	-e s!@exec_prefix@!$(exec_prefix)! \
105	-e s!@libdir@!$(LIBPATH)! \
106	-e s!@includedir@!$(INCPATH)! \
107	-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
108
109libpng-config:
110	( cat scripts/libpng-config-head.in; \
111	echo prefix=\"$(prefix)\"; \
112	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
113	echo libs=\"-lpng16 -lz -lm\"; \
114	cat scripts/libpng-config-body.in ) > libpng-config
115	chmod +x libpng-config
116
117$(LIBSO): $(LIBSOMAJ)
118	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
119
120$(LIBSOMAJ): $(OBJSDLL)
121	$(LD) -b +s \
122	+h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
123
124pngtest: pngtest.o $(LIBSO)
125	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
126
127test: pngtest
128	./pngtest
129
130
131install-headers: png.h pngconf.h pnglibconf.h
132	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
133	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
134	cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
135	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
136	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
137	-@$(RM_F) $(DI)/libpng
138	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
139
140install-static: install-headers libpng.a
141	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
142	cp libpng.a $(DL)/$(LIBNAME).a
143	chmod 644 $(DL)/$(LIBNAME).a
144	-@$(RM_F) $(DL)/libpng.a
145	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
146
147install-shared: install-headers $(LIBSOMAJ) libpng.pc
148	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
149	-@$(RM_F) $(DL)/$(LIBSO)
150	-@$(RM_F) $(DL)/$(LIBSOREL)
151	-@$(RM_F) $(DL)/$(OLDSO)
152	cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
153	chmod 755 $(DL)/$(LIBSOREL)
154	(cd $(DL); \
155	$(LN_SF) $(LIBSOREL) $(LIBSO); \
156	$(LN_SF) $(LIBSO) $(OLDSO))
157	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
158	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
159	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
160	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
161	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
162	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
163
164install-man: libpng.3 libpngpf.3 png.5
165	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
166	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
167	-@$(RM_F) $(DM)/man3/libpng.3
168	-@$(RM_F) $(DM)/man3/libpngpf.3
169	cp libpng.3 $(DM)/man3
170	cp libpngpf.3 $(DM)/man3
171	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
172	-@$(RM_F) $(DM)/man5/png.5
173	cp png.5 $(DM)/man5
174
175install-config: libpng-config
176	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
177	-@$(RM_F) $(DB)/libpng-config
178	-@$(RM_F) $(DB)/$(LIBNAME)-config
179	cp libpng-config $(DB)/$(LIBNAME)-config
180	chmod 755 $(DB)/$(LIBNAME)-config
181	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
182
183install: install-static install-shared install-man install-config
184
185# If you installed in $(DESTDIR), test-installed won't work until you
186# move the library to its final location.  Use test-dd to test it
187# before then.
188
189test-dd:
190	echo
191	echo Testing installed dynamic shared library in $(DL).
192	$(CC) -I$(DI) $(CPPFLAGS) \
193	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
194	   -L$(DL) -L$(ZLIBLIB) -Wl,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
195	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
196	./pngtestd pngtest.png
197
198test-installed:
199	echo
200	echo Testing installed dynamic shared library.
201	$(CC) $(CPPFLAGS) \
202	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
203	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
204	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
205	./pngtesti pngtest.png
206
207clean:
208	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
209	libpng-config $(LIBSO) $(LIBSOMAJ)* \
210	libpng.pc pnglibconf.h
211
212DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
213writelock:
214	chmod a-w *.[ch35] $(DOCS) scripts/*
215
216# DO NOT DELETE THIS LINE -- make depend depends on it.
217
218png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
219pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
220pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
221pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
222pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
223pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
224pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
225pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
226pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
227pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
228pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
229pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
230pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
231pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
232pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
233
234pngtest.o: png.h pngconf.h pnglibconf.h
235