MingWlibtiffBuild — wiki
Building libtiff¶
Trying to build libtiff with MingW using configure is frustrating. Instead, use these custom makefiles. libtiff is dependent on the jpeg and zip libraries.
# tiff-3.8.2/libtiff/Makefile.mingw
# For used with msys. All dependencies are assumed to be installed
# in msys's /usr/local .
# To build libtiff.dll and import library libtiff.a :
# make -fMakefile.mingw
# To install the tiff library in msys's /usr/local :
# make install -fMakefile.mingw
# To clean up the libtiff subdirectory :
# make clean -fMakefile.mingw
DLL_NAME = libtiff.dll
EXTRA_INCLS = C:/prg/msys/1.0/local/include
EXTRA_LIBS = C:/prg/msys/1.0/local/lib
HDRS = \
tiff.h \
tiffconf.h \
tiffio.h \
tiffvers.h
SRCS = \
tif_aux.c \
tif_close.c \
tif_codec.c \
tif_color.c \
tif_compress.c \
tif_dir.c \
tif_dirinfo.c \
tif_dirread.c \
tif_dirwrite.c \
tif_dumpmode.c \
tif_error.c \
tif_extension.c \
tif_fax3.c \
tif_fax3sm.c \
tif_flush.c \
tif_getimage.c \
tif_jpeg.c \
tif_luv.c \
tif_lzw.c \
tif_next.c \
tif_ojpeg.c \
tif_open.c \
tif_packbits.c \
tif_pixarlog.c \
tif_predict.c \
tif_print.c \
tif_read.c \
tif_strip.c \
tif_swab.c \
tif_thunder.c \
tif_tile.c \
tif_unix.c \
tif_version.c \
tif_warning.c \
tif_write.c \
tif_zip.c
all: $(DLL_NAME) libtiff.a
tif_config.h: tif_config.h.vc
cp -fp tif_config.h.vc tif_config.h
tiffconf.h: tiffconf.h.vc
cp -fp tiffconf.h.vc tiffconf.h
$(DLL_NAME): tif_config.h tiffconf.h
gcc -shared -s -O2 -W3 -I. -I$(EXTRA_INCLS) -L$(EXTRA_LIBS) -o $(DLL_NAME) $(SRCS) libtiff.def -ljpeg -lz
libtiff.a:
dlltool -d libtiff.def -D $(DLL_NAME) -l libtiff.a
install: libtiff.a $(DLL_NAME)
cp -fp $(DLL_NAME) /usr/local/bin
cp -fp libtiff.a /usr/local/lib
cp -fp tiff.h /usr/local/include
cp -fp tiffconf.h /usr/local/include
cp -fp tif_config.h /usr/local/include
cp -fp tiffio.h /usr/local/include
cp -fp tiffvers.h /usr/local/include
clean:
rm $(DLL_NAME)
rm libtiff.a
rm tiffconf.h
rm tif_config.h
# tiff-3.8.2/test/Makefile.mingw
# For building and executing the tiff test programs using msys.
# The tiff library and its dependencies are assumed to be installed
# in msys's /usr/local .
# To build the test programs :
# make -fMakefile.mingw
# To run the test programs :
# make test -fmakefile.mingw
# To clean up the test subdirectory :
# make clean -fmakefile.mingw
EXTRA_INCLS = C:/prg/msys/1.0/local/include
EXTRA_LIBS = C:/prg/msys/1.0/local/lib
COMPILE_OPTIONS = -W3 -I.
all: ascii_tag.exe long_tag.exe short_tag.exe strip_rw.exe
check_tag.o:
gcc -c $(COMPILE_OPTIONS) check_tag.c
strip.o:
gcc -c $(COMPILE_OPTIONS) strip.c
test_arrays.o:
gcc -c $(COMPILE_OPTIONS) test_arrays.c
ascii_tag.exe:
gcc $(COMPILE_OPTIONS) -I$(EXTRA_INCLS) -L$(EXTRA_LIBS) -o ascii_tag.exe ascii_tag.c -ltiff
long_tag.exe: check_tag.o
gcc $(COMPILE_OPTIONS) -I$(EXTRA_INCLS) -L$(EXTRA_LIBS) -o long_tag.exe long_tag.c check_tag.o -ltiff
short_tag.exe: check_tag.o
gcc $(COMPILE_OPTIONS) -I$(EXTRA_INCLS) -L$(EXTRA_LIBS) -o short_tag.exe short_tag.c check_tag.o -ltiff
strip_rw.exe: strip.o test_arrays.o
gcc $(COMPILE_OPTIONS) -I$(EXTRA_INCLS) -L$(EXTRA_LIBS) -o strip_rw.exe strip_rw.c strip.o test_arrays.o -ltiff
test: ascii_tag.exe long_tag.exe short_tag.exe strip_rw.exe
ascii_tag.exe
long_tag.exe
short_tag.exe
strip_rw.exe
clean:
rm *.exe
rm *.o