This repository has been archived on 2023-11-11. You can view files and clone it, but cannot push or open issues or pull requests.
libpng/scripts/makefile.cygwin

303 lines
9.5 KiB
Plaintext
Raw Normal View History

2000-07-14 13:15:12 +00:00
# makefile for cygwin on x86
2002-05-21 23:06:08 +00:00
# Builds both dll (with import lib) and static lib versions
2000-07-14 13:15:12 +00:00
# of the library, and builds two copies of pngtest: one
# statically linked and one dynamically linked.
2000-11-23 17:51:42 +00:00
#
2008-08-02 17:21:03 +00:00
# Copyright (C) 2002, 2006-2008 Soren Anderson, Charles Wilson,
2006-03-20 13:24:58 +00:00
# and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by:
2000-07-14 13:15:12 +00:00
# Copyright (C) 1998-2000 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
2000-07-14 13:15:12 +00:00
2002-05-21 23:06:08 +00:00
# This makefile intends to support building outside the src directory
# if desired. When invoking it, specify an argument to SRCDIR on the
2002-05-11 01:19:58 +00:00
# command line that points to the top of the directory where your source
# is located.
2002-05-13 23:17:09 +00:00
ifdef SRCDIR
VPATH = $(SRCDIR)
2002-05-11 01:19:58 +00:00
else
2002-05-13 23:17:09 +00:00
SRCDIR = .
2002-05-11 01:19:58 +00:00
endif
2002-05-21 23:06:08 +00:00
# Override DESTDIR= on the make install command line to easily support
2002-04-27 15:11:25 +00:00
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
2002-05-25 16:12:10 +00:00
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
2002-04-27 15:11:25 +00:00
# you execute make install.
2002-05-11 01:19:58 +00:00
2002-04-27 15:11:25 +00:00
DESTDIR=
2000-07-14 13:15:12 +00:00
CC=gcc
2002-04-07 21:35:38 +00:00
ifdef MINGW
MINGW_CCFLAGS=-mno-cygwin -I/usr/include/mingw
MINGW_LDFLAGS=-mno-cygwin -L/usr/lib/mingw
endif
2000-07-14 13:15:12 +00:00
2002-05-21 23:06:08 +00:00
# Where "make install" puts libpng*.a, *png*.dll, png.h, and pngconf.h
2002-05-11 01:19:58 +00:00
ifndef prefix
2000-07-14 13:15:12 +00:00
prefix=/usr
2002-05-11 01:19:58 +00:00
$(warning You haven't specified a 'prefix=' location. Defaulting to "/usr")
endif
2006-04-18 10:31:20 +00:00
exec_prefix=$(prefix)
2000-07-14 13:15:12 +00:00
# Where the zlib library and include files are located
2002-05-13 23:17:09 +00:00
ZLIBLIB= /usr/lib
ZLIBINC=
2000-07-14 13:15:12 +00:00
#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
2002-05-11 01:19:58 +00:00
### if you don't need thread safety, but want the asm accel
2007-06-20 00:05:48 +00:00
#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK \
2008-08-02 17:21:03 +00:00
# $(addprefix -I,$(ZLIBINC)) -W -Wall -O $(ALIGN) -funroll-loops \
2002-05-11 01:19:58 +00:00
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### if you need thread safety and want (minimal) asm accel
2007-06-20 00:05:48 +00:00
#CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
2008-08-02 17:21:03 +00:00
# -W -Wall -O $(ALIGN) -funroll-loops \
2002-05-11 01:19:58 +00:00
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### Normal (non-asm) compilation
CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
2008-08-02 17:21:03 +00:00
-W -Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \
2002-05-11 01:19:58 +00:00
-fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
LIBNAME = libpng12
2002-02-22 05:14:23 +00:00
PNGMAJ = 0
2002-08-06 23:06:11 +00:00
CYGDLL = 12
PNGMIN = 1.2.41beta09
2000-11-10 18:26:19 +00:00
PNGVER = $(PNGMAJ).$(PNGMIN)
2002-08-06 23:06:11 +00:00
SHAREDLIB=cygpng$(CYGDLL).dll
2000-11-10 18:26:19 +00:00
STATLIB=libpng.a
IMPLIB=libpng.dll.a
SHAREDDEF=libpng.def
LIBS=$(SHAREDLIB) $(STATLIB)
EXE=.exe
2002-05-13 23:17:09 +00:00
LDFLAGS=$(strip -L. $(MINGW_LDFLAGS) -lpng $(addprefix -L,$(ZLIBLIB)) -lz)
2002-05-11 01:19:58 +00:00
LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS) -Wl,--export-all)
2002-05-13 23:17:09 +00:00
LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz
2000-07-14 13:15:12 +00:00
2006-03-20 13:24:58 +00:00
MKDIR_P=/bin/mkdir -pv
2004-07-18 03:45:44 +00:00
RANLIB=ranlib
#RANLIB=echo
2000-07-14 13:15:12 +00:00
INCPATH=$(prefix)/include
2006-03-07 13:09:22 +00:00
LIBPATH=$(exec_prefix)/lib
2002-04-27 15:11:25 +00:00
2006-03-07 13:09:22 +00:00
BINPATH=$(exec_prefix)/bin
2000-07-14 13:15:12 +00:00
MANPATH=$(prefix)/man
2002-05-11 01:19:58 +00:00
MAN3PATH=$(MANPATH)/man3
MAN5PATH=$(MANPATH)/man5
2000-07-14 13:15:12 +00:00
2002-05-21 23:06:08 +00:00
# cosmetic: shortened strings:
S =$(SRCDIR)
D =$(DESTDIR)
2002-05-25 16:12:10 +00:00
DB =$(D)$(BINPATH)
DI =$(D)$(INCPATH)
DL =$(D)$(LIBPATH)
2002-05-21 23:06:08 +00:00
2000-07-14 13:15:12 +00:00
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
2007-09-01 20:12:50 +00:00
pngwtran.o pngmem.o pngerror.o pngpread.o
2000-07-14 13:15:12 +00:00
OBJSDLL = $(OBJS:.o=.pic.o)
2002-05-11 01:19:58 +00:00
.SUFFIXES: .c .o .pic.o
2000-07-14 13:15:12 +00:00
%.o : %.c
2002-04-27 15:11:25 +00:00
$(CC) -c $(CFLAGS) -o $@ $<
2002-05-11 01:19:58 +00:00
%.pic.o : CFLAGS += -DPNG_BUILD_DLL
2000-07-14 13:15:12 +00:00
%.pic.o : %.c
2002-05-11 01:19:58 +00:00
$(CC) -c $(CFLAGS) -o $@ $<
2000-07-14 13:15:12 +00:00
2002-05-25 16:12:10 +00:00
all: all-static all-shared libpng.pc libpng-config libpng.pc libpng-config
2002-05-11 01:19:58 +00:00
2002-05-21 23:06:08 +00:00
# Make this to verify that "make [...] install" will do what you want.
2002-05-11 01:19:58 +00:00
buildsetup-tell:
@echo VPATH is set to: \"$(VPATH)\"
@echo prefix is set to: \"$(prefix)\"
@echo -e INCPATH,LIBPATH, etc. are set to:'\n' \
2002-05-13 23:17:09 +00:00
$(addprefix $(D),$(INCPATH)'\n' $(LIBPATH)'\n' $(BINPATH)'\n' \
2002-05-11 01:19:58 +00:00
$(MANPATH)'\n' $(MAN3PATH)'\n' $(MAN5PATH)'\n')'\n'
2002-04-27 15:11:25 +00:00
libpng.pc: scripts/libpng.pc.in
2002-05-11 01:19:58 +00:00
@echo -e Making pkg-config file for this libpng installation..'\n' \
using PREFIX=\"$(prefix)\"'\n'
2007-09-27 00:34:29 +00:00
cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
2007-09-27 12:13:46 +00:00
-e s!-lpng12!-lpng12\ -lz! > libpng.pc
2002-05-11 01:19:58 +00:00
2002-05-21 23:06:08 +00:00
libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in
2002-05-13 23:17:09 +00:00
@echo -e Making $(LIBNAME) libpng-config file for this libpng \
installation..'\n' using PREFIX=\"$(prefix)\"'\n'
( cat $(S)/scripts/libpng-config-head.in; \
2002-05-11 01:19:58 +00:00
echo prefix=\"$(prefix)\"; \
2002-09-18 04:38:46 +00:00
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \
2002-08-06 23:06:11 +00:00
echo libs=\"-lpng$(CYGDLL) -lz\"; \
2002-05-13 23:17:09 +00:00
cat $(S)/scripts/libpng-config-body.in ) > libpng-config
2002-05-11 01:19:58 +00:00
chmod +x libpng-config
2000-11-10 18:26:19 +00:00
static: all-static
shared: all-shared
all-static: $(STATLIB) pngtest-stat$(EXE)
all-shared: $(SHAREDLIB) pngtest$(EXE)
2000-07-14 13:15:12 +00:00
$(STATLIB): $(OBJS)
2004-07-18 03:45:44 +00:00
ar rc $@ $(OBJS)
2000-07-14 13:15:12 +00:00
$(RANLIB) $@
2006-02-21 04:09:05 +00:00
$(SHAREDDEF): scripts/pngw32.def
2001-05-14 14:20:53 +00:00
cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \
sed -e 's/\([^;]*\);/;/' > $@
2000-07-14 13:15:12 +00:00
$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
2002-05-13 23:17:09 +00:00
$(CC) $(LDSFLAGS) -o $@ $(OBJSDLL) -L. $(LDEXTRA)
2000-07-14 13:15:12 +00:00
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 png.h pngconf.h
2002-04-27 15:11:25 +00:00
$(CC) $(CFLAGS) -c $< -o $@
2000-07-14 13:15:12 +00:00
2000-11-10 18:26:19 +00:00
test: test-static test-shared
2000-07-14 13:15:12 +00:00
2000-11-10 18:26:19 +00:00
test-static: pngtest-stat$(EXE)
2002-05-13 23:17:09 +00:00
./pngtest-stat $(S)/pngtest.png
2000-07-14 13:15:12 +00:00
2000-11-10 18:26:19 +00:00
test-shared: pngtest$(EXE)
2002-05-13 23:17:09 +00:00
./pngtest $(S)/pngtest.png
2000-07-14 13:15:12 +00:00
2002-04-27 15:11:25 +00:00
install-static: $(STATLIB) install-headers install-man
2006-03-20 13:24:58 +00:00
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
2002-05-21 23:06:08 +00:00
install -m 644 $(STATLIB) $(DL)/$(LIBNAME).a
-@rm -f $(DL)/$(STATLIB)
(cd $(DL); ln -sf $(LIBNAME).a $(STATLIB))
2002-04-27 15:11:25 +00:00
2002-05-11 01:19:58 +00:00
install-shared: $(SHAREDLIB) libpng.pc libpng-config install-headers install-man
2006-03-20 13:24:58 +00:00
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
2002-05-21 23:06:08 +00:00
-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
install -m 644 $(IMPLIB) $(DL)/$(LIBNAME).dll.a
-@rm -f $(DL)/$(IMPLIB)
(cd $(DL); ln -sf $(LIBNAME).dll.a $(IMPLIB))
install -s -m 755 $(SHAREDLIB) $(DB)
install -m 644 libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
2000-11-10 18:26:19 +00:00
install-headers:
2006-03-20 13:24:58 +00:00
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
2002-05-21 23:06:08 +00:00
-@rm -f $(DI)/png.h
-@rm -f $(DI)/pngconf.h
install -m 644 $(S)/png.h $(S)/pngconf.h $(DI)/$(LIBNAME)
-@rm -f $(DI)/libpng
(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
2000-11-10 18:26:19 +00:00
install-man:
2006-03-20 13:24:58 +00:00
-@if [ ! -d $(D)$(MAN3PATH) ]; then $(MKDIR_P) $(D)$(MAN3PATH); fi
-@if [ ! -d $(D)$(MAN5PATH) ]; then $(MKDIR_P) $(D)$(MAN5PATH); fi
2002-05-13 23:17:09 +00:00
install -m 644 $(S)/libpngpf.3 $(S)/libpng.3 $(D)$(MAN3PATH)
install -m 644 $(S)/png.5 $(D)$(MAN5PATH)
2000-07-14 13:15:12 +00:00
2002-05-11 01:19:58 +00:00
install-config: libpng-config
2006-03-20 13:24:58 +00:00
-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
2002-05-21 23:06:08 +00:00
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
# Run this to verify that a future `configure' run will pick up the settings
2002-05-13 23:17:09 +00:00
# you want.
2002-05-11 01:19:58 +00:00
test-config-install: SHELL=/bin/bash
2002-05-21 23:06:08 +00:00
test-config-install: $(DB)/libpng-config
2002-05-11 01:19:58 +00:00
@echo -e Testing libpng-config functions...'\n'
@ for TYRA in LDFLAGS CPPFLAGS CFLAGS LIBS VERSION; \
do \
2002-05-21 23:06:08 +00:00
printf "(%d)\t %10s =%s\n" $$(($$gytiu + 1)) $$TYRA \
"$$($(DB)/libpng-config `echo --$$TYRA |tr '[:upper:]' '[:lower:]'`)"; \
2002-05-11 01:19:58 +00:00
gytiu=$$(( $$gytiu + 1 )); \
done
2002-05-03 01:49:40 +00:00
install: install-static install-shared install-man install-config
2002-07-02 03:23:46 +00:00
# If you installed in $(DESTDIR), test-installed won't work until you
2004-08-26 03:00:45 +00:00
# move the library to its final location. Use test-dd to test it
# before then.
test-dd:
echo
echo Testing installed dynamic shared library in $(DL).
$(CC) -I$(DI) $(CFLAGS) \
`$(BINPATH)/libpng12-config --cflags` pngtest.c \
-L$(DL) -L$(ZLIBLIB) \
-o pngtestd `$(BINPATH)/libpng12-config --ldflags`
./pngtestd pngtest.png
2002-07-02 03:23:46 +00:00
test-installed:
$(CC) $(CFLAGS) \
2002-09-18 04:38:46 +00:00
`$(BINPATH)/libpng12-config --cflags` pngtest.c \
2002-07-02 03:23:46 +00:00
-L$(ZLIBLIB) \
2002-09-18 04:38:46 +00:00
-o pngtesti$(EXE) `$(BINPATH)/libpng12-config --ldflags`
2002-07-02 03:23:46 +00:00
./pngtesti$(EXE) pngtest.png
2000-07-14 13:15:12 +00:00
clean:
/bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
2002-05-13 23:17:09 +00:00
pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \
2002-07-02 03:23:46 +00:00
libpng-config libpng.pc pngtesti$(EXE)
2000-07-14 13:15:12 +00:00
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
chmod a-w *.[ch35] $(DOCS) scripts/*
2002-05-11 01:19:58 +00:00
.PHONY: buildsetup-tell libpng.pc libpng-config test-config-install clean
2000-07-14 13:15:12 +00:00
# DO NOT DELETE THIS LINE -- make depend depends on it.
2001-01-12 21:13:06 +00:00
png.o png.pic.o: png.h pngconf.h png.c
2000-07-14 13:15:12 +00:00
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
2001-01-12 21:13:06 +00:00
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
2000-07-14 13:15:12 +00:00
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
2002-05-11 01:19:58 +00:00