215 lines
6.7 KiB
Plaintext
215 lines
6.7 KiB
Plaintext
# makefile for cygwin on x86
|
|
# builds both dll (with import lib) and static lib versions
|
|
# of the library, and builds two copies of pngtest: one
|
|
# statically linked and one dynamically linked.
|
|
#
|
|
# based on makefile for linux-elf w/mmx by:
|
|
# Copyright (C) 1998-2000 Greg Roelofs
|
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
|
# For conditions of distribution and use, see copyright notice in png.h
|
|
|
|
# override DESTDIR= on the make install command line to easily support
|
|
# installing into a temporary location. Example:
|
|
#
|
|
# make install DESTDIR=/tmp/build/libpng
|
|
#
|
|
# If you're going to install into a temporary location
|
|
# via DESTDIR, that location must already exist before
|
|
# you execute make install.
|
|
DESTDIR=
|
|
|
|
# To enable assembler optimizations, add '-DPNG_USE_PNGGCCRD' to
|
|
# $CFLAGS, and include pnggccrd.o in $OBJS, below.
|
|
|
|
CC=gcc
|
|
ifdef MINGW
|
|
MINGW_CCFLAGS=-mno-cygwin -I/usr/include/mingw
|
|
MINGW_LDFLAGS=-mno-cygwin -L/usr/lib/mingw
|
|
endif
|
|
|
|
# where "make install" puts libpng.a, libpng.so*, png.h, and pngconf.h
|
|
prefix=/usr
|
|
|
|
# Where the zlib library and include files are located
|
|
ZLIBLIB=$(DESTDIR)$(LIBPATH)
|
|
ZLIBINC=$(DESTDIR)$(INCPATH)
|
|
#ZLIBLIB=../zlib
|
|
#ZLIBINC=../zlib
|
|
|
|
ALIGN=
|
|
# for i386:
|
|
#ALIGN=-malign-loops=2 -malign-functions=2
|
|
|
|
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
|
-Wmissing-declarations -Wtraditional -Wcast-align \
|
|
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
|
|
|
#CFLAGS=-DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
|
|
# -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
|
|
CFLAGS=$(MINGW_CCFLAGS) -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
|
|
-fomit-frame-pointer
|
|
|
|
LIBNAME=libpng12
|
|
PNGMAJ = 0
|
|
PNGDLL = 12
|
|
PNGMIN = 1.2.3rc2
|
|
PNGVER = $(PNGMAJ).$(PNGMIN)
|
|
|
|
SHAREDLIB=cygpng$(PNGDLL).dll
|
|
STATLIB=libpng.a
|
|
IMPLIB=libpng.dll.a
|
|
SHAREDDEF=libpng.def
|
|
LIBS=$(SHAREDLIB) $(STATLIB)
|
|
EXE=.exe
|
|
|
|
LDFLAGS=-L. $(MINGW_LDFLAGS) -L$(ZLIBLIB) -lpng -lz
|
|
LDSFLAGS=-shared -L. $(MINGW_LDFLAGS) -Wl,--export-all
|
|
LDEXTRA=-Wl,--out-implib=$(IMPLIB)
|
|
|
|
RANLIB=ranlib
|
|
#RANLIB=echo
|
|
|
|
INCPATH=$(prefix)/include
|
|
LIBPATH=$(prefix)/lib
|
|
|
|
BINPATH=$(prefix)/bin
|
|
MANPATH=$(prefix)/man
|
|
MAN3PATH=$(MANPATH)/man3
|
|
MAN5PATH=$(MANPATH)/man5
|
|
|
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
|
pngwtran.o pngmem.o pngerror.o pngpread.o # pnggccrd.o
|
|
|
|
OBJSDLL = $(OBJS:.o=.pic.o)
|
|
|
|
.SUFFIXES: .c .o .pic.o
|
|
|
|
%.o : %.c
|
|
$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
|
%.pic.o : %.c
|
|
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
|
|
|
|
all: all-static all-shared libpng.pc
|
|
|
|
libpng.pc: scripts/libpng.pc.in
|
|
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
|
|
|
static: all-static
|
|
|
|
shared: all-shared
|
|
|
|
all-static: $(STATLIB) pngtest-stat$(EXE)
|
|
|
|
all-shared: $(SHAREDLIB) pngtest$(EXE)
|
|
|
|
pnggccrd.o: png.h pngconf.h
|
|
@echo ""
|
|
@echo ' You can ignore the single "control reaches end of non-void function"'
|
|
@echo ' warning and multiple "<variable> defined but not used" warnings:'
|
|
@echo ""
|
|
$(CC) -c $(CFLAGS) -o $@ $*.c
|
|
|
|
pnggccrd.pic.o: png.h pngconf.h
|
|
@echo ""
|
|
@echo ' You can ignore the single "control reaches end of non-void function"'
|
|
@echo ' warning and multiple "<variable> defined but not used" warnings:'
|
|
@echo ""
|
|
$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ pnggccrd.c
|
|
|
|
$(STATLIB): $(OBJS)
|
|
ar rc $@ $(OBJS)
|
|
$(RANLIB) $@
|
|
|
|
$(SHAREDDEF): projects/msvc/png32ms.def
|
|
cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \
|
|
sed -e 's/\([^;]*\);/;/' > $@
|
|
|
|
$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
|
|
$(CC) $(LDSFLAGS) -o $@ $(LDEXTRA) $(OBJSDLL) -L. -L$(ZLIBLIB) -lz
|
|
|
|
pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
|
|
$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
|
|
|
|
pngtest-stat$(EXE): pngtest.o $(STATLIB)
|
|
$(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@
|
|
|
|
pngtest.pic.o: pngtest.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
pngtest.o: pngtest.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
test: test-static test-shared
|
|
|
|
test-static: pngtest-stat$(EXE)
|
|
./pngtest-stat
|
|
|
|
test-shared: pngtest$(EXE)
|
|
./pngtest
|
|
|
|
install: install-static install-shared
|
|
|
|
install-static: $(STATLIB) install-headers install-man
|
|
-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir -p $(DESTDIR)$(LIBPATH); fi
|
|
install -m 644 $(STATLIB) $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
|
|
-@rm -f $(DESTDIR)$(LIBPATH)/$(STATLIB)
|
|
(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).a $(STATLIB))
|
|
|
|
install-shared: $(SHAREDLIB) libpng.pc install-headers install-man
|
|
-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir -p $(DESTDIR)$(LIBPATH); fi
|
|
-@if [ ! -d $(DESTDIR)$(BINPATH) ]; then mkdir -p $(DESTDIR)$(BINPATH); fi
|
|
-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
|
|
mkdir -p $(DESTDIR)$(LIBPATH)/pkgconfig; fi
|
|
install -m 644 $(IMPLIB) $(DESTDIR)$(LIBPATH)/$(LIBNAME).dll.a
|
|
-@rm -f $(DESTDIR)$(LIBPATH)/$(IMPLIB)
|
|
(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).dll.a $(IMPLIB))
|
|
install -s -m 755 $(SHAREDLIB) $(DESTDIR)$(BINPATH)
|
|
install -m 644 libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/$(LIBNAME).pc
|
|
(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
|
|
|
|
install-headers:
|
|
-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir -p $(DESTDIR)$(INCPATH); fi
|
|
-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then mkdir -p $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
|
|
-@rm -f $(DESTDIR)$(INCPATH)/png.h
|
|
-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
|
|
install -m 644 png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
|
|
-@rm -f $(DESTDIR)$(INCPATH)/libpng
|
|
(cd $(DESTDIR)$(INCPATH); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
|
|
|
|
install-man:
|
|
-@if [ ! -d $(DESTDIR)$(MAN3PATH) ]; then mkdir -p $(DESTDIR)$(MAN3PATH); fi
|
|
-@if [ ! -d $(DESTDIR)$(MAN5PATH) ]; then mkdir -p $(DESTDIR)$(MAN5PATH); fi
|
|
install -m 644 libpngpf.3 libpng.3 $(DESTDIR)$(MAN3PATH)
|
|
install -m 644 png.5 $(DESTDIR)$(MAN5PATH)
|
|
|
|
clean:
|
|
/bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
|
|
pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF)
|
|
|
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
|
writelock:
|
|
chmod a-w *.[ch35] $(DOCS) scripts/*
|
|
|
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
|
|
|
png.o png.pic.o: png.h pngconf.h png.c
|
|
pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
|
|
pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
|
|
pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
|
|
pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c
|
|
pngset.o pngset.pic.o: png.h pngconf.h pngset.c
|
|
pngget.o pngget.pic.o: png.h pngconf.h pngget.c
|
|
pngread.o pngread.pic.o: png.h pngconf.h pngread.c
|
|
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
|
|
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
|
|
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
|
|
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
|
|
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
|
|
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
|
|
pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
|
|
|
|
pngtest.o: png.h pngconf.h pngtest.c
|
|
pngtest-stat.o: png.h pngconf.h pngtest.c
|