all repos — mgba @ 9de8f084ba55460b02d300c1dd8b8e6c56f691d5

mGBA Game Boy Advance Emulator

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

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