all repos — mgba @ 6a426c08919b750eff1cee7630e23ab47a45ec0a

mGBA Game Boy Advance Emulator

src/third-party/libpng/scripts/makefile.dec (view raw)

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