all: library all_samples

CC=clang
CXX=clang++

#CC=gcc
#CXX=g++

LDADD+=-lz

CFLAGS=-DLIBRAW_USE_AUTOPTR
CFLAGS+= -g -I. -pedantic -Wno-long-long -Wno-overflow -O3 -Wall

# macOS dual arch
# CFLAGS+=-arch x86_64 -arch arm64

# RawSpeed Support
# CFLAGS+=-DUSE_RAWSPEED -I../RawSpeed -I/opt/local/include/libxml2
# LDADD+=-L../RawSpeed/RawSpeed/release -lrawspeed -L/opt/local/include -ljpeg -lxml2
# RAWSPEED_DATA=../RawSpeed/data/cameras.xml

# RawSpeed3 Support
#CFLAGS+=-DUSE_RAWSPEED3 -DUSE_RAWSPEED_BITS -I./RawSpeed3/
#LDADD+=-L../RawSpeed-v3/release -lrawspeed3 -L/usr/local/lib -ljpeg -lz


# DNG SDK Support
# CFLAGS+=-DUSE_DNGSDK -I../dng_sdk/source
# LDADDD+=-L../dng_sdk/release -ldng -ljpeg -lz

# LCMS support
# For lcms2 set -DUSE_LCMS2
#CFLAGS+=-DUSE_LCMS2 -I/opt/local/include
#LDADD+=-L/opt/local/lib -llcms

# ZLIB support (FP dng)
CFLAGS+=-DUSE_ZLIB
LDADD+=-lz

# JPEG support for DNG and Kodak
#CFLAGS+=-DUSE_JPEG -I/usr/local/include
#LDADD+=-L/usr/local/lib -ljpeg

# LIBJPEG8:
#CFLAGS+=-DUSE_JPEG8

CSTFLAGS=$(CFLAGS) -DLIBRAW_NOTHREADS
HEADERS=libraw/libraw.h libraw/libraw_alloc.h libraw/libraw_const.h \
  libraw/libraw_datastream.h libraw/libraw_internal.h  \
  libraw/libraw_types.h libraw/libraw_version.h \
  internal/dcraw_defs.h internal/dcraw_fileio_defs.h internal/defines.h \
  internal/dmp_include.h internal/libraw_cameraids.h internal/libraw_cxx_defs.h \
  internal/libraw_internal_funcs.h internal/var_defines.h internal/x3f_tools.h

LIB_OBJECTS= object/libraw_datastream.o object/libraw_c_api.o \
  object/cameralist.o object/fuji_compressed.o \
  object/crx.o object/pana8.o object/olympus14.o \
  object/fp_dng.o object/decoders_libraw.o \
  object/sonycc.o object/losslessjpeg.o \
  object/unpack.o object/unpack_thumb.o \
  object/rawspeed_glue.o object/dngsdk_glue.o \
  object/colorconst.o object/utils_libraw.o object/init_close_utils.o \
  object/decoder_info.o object/open.o object/phaseone_processing.o \
  object/thumb_utils.o \
  object/tiff_writer.o object/subtract_black.o object/postprocessing_utils.o \
  object/dcraw_process.o object/raw2image.o object/mem_image.o \
  object/x3f_utils_patched.o object/x3f_parse_process.o \
  object/read_utils.o object/curves.o object/utils_dcraw.o \
  object/colordata.o \
  object/canon_600.o  object/decoders_dcraw.o \
  object/decoders_libraw_dcrdefs.o  object/generic.o \
  object/kodak_decoders.o object/dng.o object/smal.o \
  object/load_mfbacks.o \
  object/sony.o object/nikon.o object/samsung.o object/cr3_parser.o \
  object/canon.o  object/epson.o object/olympus.o object/leica.o \
  object/fuji.o object/adobepano.o object/pentax.o object/p1.o \
  object/makernotes.o object/exif_gps.o object/kodak.o \
  object/tiff.o object/ciff.o object/mediumformat.o object/minolta.o \
  object/identify_tools.o \
  object/hasselblad_model.o object/normalize_model.o object/identify.o \
  object/misc_parsers.o object/wblists.o \
  object/postprocessing_aux.o object/postprocessing_utils_dcrdefs.o \
  object/aspect_ratio.o \
  object/misc_demosaic.o object/xtrans_demosaic.o object/ahd_demosaic.o \
  object/dht_demosaic.o  object/aahd_demosaic.o  object/dcb_demosaic.o \
  object/file_write.o \
  object/ext_preprocess.o   object/apply_profile.o


LIB_MT_OBJECTS= object/libraw_datastream.mt.o object/libraw_c_api.mt.o \
  object/cameralist.mt.o object/fuji_compressed.mt.o \
  object/crx.mt.o object/pana8.mt.o \
  object/olympus14.mt.o object/fp_dng.mt.o \
  object/sonycc.mt.o object/losslessjpeg.mt.o \
  object/decoders_libraw.mt.o \
  object/unpack.mt.o object/unpack_thumb.mt.o \
  object/rawspeed_glue.mt.o object/dngsdk_glue.mt.o \
  object/colorconst.mt.o object/utils_libraw.mt.o \
  object/init_close_utils.mt.o \
  object/decoder_info.mt.o object/open.mt.o object/phaseone_processing.mt.o \
  object/thumb_utils.mt.o \
  object/tiff_writer.mt.o object/subtract_black.mt.o \
  object/postprocessing_utils.mt.o object/dcraw_process.mt.o \
  object/raw2image.mt.o object/mem_image.mt.o \
  object/x3f_utils_patched.mt.o object/x3f_parse_process.mt.o \
  object/read_utils.mt.o object/curves.mt.o object/utils_dcraw.mt.o \
  object/colordata.mt.o \
  object/canon_600.mt.o  object/decoders_dcraw.mt.o \
  object/decoders_libraw_dcrdefs.mt.o  object/generic.mt.o \
  object/kodak_decoders.mt.o object/dng.mt.o object/smal.mt.o \
  object/load_mfbacks.mt.o \
  object/sony.mt.o object/nikon.mt.o object/samsung.mt.o \
  object/cr3_parser.mt.o object/canon.mt.o  object/epson.mt.o \
  object/olympus.mt.o object/leica.mt.o \
  object/fuji.mt.o object/adobepano.mt.o object/pentax.mt.o object/p1.mt.o \
  object/makernotes.mt.o object/exif_gps.mt.o object/kodak.mt.o \
  object/tiff.mt.o object/ciff.mt.o object/mediumformat.mt.o \
  object/minolta.mt.o \
  object/identify_tools.mt.o \
  object/hasselblad_model.mt.o object/normalize_model.mt.o object/identify.mt.o \
  object/misc_parsers.mt.o object/wblists.mt.o \
  object/postprocessing_aux.mt.o object/postprocessing_utils_dcrdefs.mt.o \
  object/aspect_ratio.mt.o \
  object/misc_demosaic.mt.o object/xtrans_demosaic.mt.o \
  object/ahd_demosaic.mt.o object/dht_demosaic.mt.o \
  object/aahd_demosaic.mt.o object/dcb_demosaic.mt.o \
  object/file_write.mt.o \
  object/ext_preprocess.mt.o   object/apply_profile.mt.o


LR_INCLUDES=libraw/libraw.h libraw/libraw_alloc.h \
  libraw/libraw_const.h libraw/libraw_datastream.h \
  libraw/libraw_internal.h libraw/libraw_types.h \
  libraw/libraw_version.h

library: lib/libraw.a lib/libraw_r.a

all_samples: bin/raw-identify bin/simple_dcraw  bin/dcraw_emu \
	     bin/dcraw_half bin/half_mt bin/mem_image \
             bin/unprocessed_raw bin/4channels bin/multirender_test \
	     bin/postprocessing_benchmark bin/rawtextdump

## RawSpeed xml file

RawSpeed/rawspeed_xmldata.cpp: ${RAWSPEED_DATA}
	./rsxml2c.sh ${RAWSPEED_DATA} > RawSpeed/rawspeed_xmldata.cpp

## Samples ##
bin/raw-identify: lib/libraw.a samples/raw-identify.cpp $(HEADERS)
	$(CXX) ${CFLAGS} -o bin/raw-identify samples/raw-identify.cpp -L./lib -lraw  -lm  ${LDADD}

bin/simple_dcraw: lib/libraw.a samples/simple_dcraw.cpp $(HEADERS)
	$(CXX) -DLIBRAW_NOTHREADS ${CFLAGS} -o bin/simple_dcraw samples/simple_dcraw.cpp -L./lib -lraw  -lm  ${LDADD}

bin/multirender_test: lib/libraw.a samples/multirender_test.cpp $(HEADERS)
	$(CXX) -DLIBRAW_NOTHREADS ${CFLAGS} -o bin/multirender_test samples/multirender_test.cpp -L./lib -lraw  -lm  ${LDADD}

bin/postprocessing_benchmark: lib/libraw.a samples/postprocessing_benchmark.cpp $(HEADERS)
	$(CXX) -DLIBRAW_NOTHREADS ${CFLAGS} -o bin/postprocessing_benchmark samples/postprocessing_benchmark.cpp -L./lib -lraw  -lm  ${LDADD}

bin/unprocessed_raw: lib/libraw.a samples/unprocessed_raw.cpp $(HEADERS)
	$(CXX) -DLIBRAW_NOTHREADS ${CFLAGS} -o bin/unprocessed_raw samples/unprocessed_raw.cpp -L./lib -lraw  -lm  ${LDADD}

bin/rawtextdump: lib/libraw.a samples/rawtextdump.cpp $(HEADERS)
	${CXX} -DLIBRAW_NOTHREADS  ${CFLAGS} -o bin/rawtextdump samples/rawtextdump.cpp -L./lib -lraw  -lm  ${LDADD}

bin/4channels: lib/libraw.a samples/4channels.cpp $(HEADERS)
	$(CXX) -DLIBRAW_NOTHREADS ${CFLAGS} -o bin/4channels samples/4channels.cpp -L./lib -lraw  -lm  ${LDADD}

bin/mem_image: lib/libraw.a samples/mem_image_sample.cpp $(HEADERS)
	$(CXX) ${CFLAGS} -o bin/mem_image samples/mem_image_sample.cpp -L./lib -lraw  -lm  ${LDADD}

bin/dcraw_half: lib/libraw.a samples/dcraw_half.c $(HEADERS)
	$(CC) ${CFLAGS} -o bin/dcraw_half samples/dcraw_half.c -L./lib -lraw  -lm -lstdc++  ${LDADD}

bin/half_mt: lib/libraw_r.a samples/half_mt.c $(HEADERS)
	$(CC) -pthread ${CFLAGS} -o bin/half_mt samples/half_mt.c -L./lib -lraw_r  -lm -lstdc++  ${LDADD}

bin/dcraw_emu: lib/libraw.a samples/dcraw_emu.cpp $(HEADERS)
	$(CXX) ${CFLAGS} -o bin/dcraw_emu samples/dcraw_emu.cpp -L./lib -lraw_r  -lm ${LDADD}

lib/libraw.a: ${LIB_OBJECTS}
	rm -f lib/libraw.a
	ar crv lib/libraw.a ${LIB_OBJECTS}
	ranlib lib/libraw.a

lib/libraw_r.a: ${LIB_MT_OBJECTS}
	rm -f lib/libraw_r.a
	ar crv lib/libraw_r.a ${LIB_MT_OBJECTS}
	ranlib lib/libraw_r.a

clean:
	rm -fr bin/*.dSYM
	rm -f *.o *~ src/*~ samples/*~ internal/*~ libraw/*~ lib/lib*.a bin/[4a-z]* object/*.o object/*.mto dcraw/*~ doc/*~ bin/*~ src/*/*~

## script-created rules
object/libraw_c_api.o: src/libraw_c_api.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/libraw_c_api.o src/libraw_c_api.cpp
object/libraw_c_api.mt.o: src/libraw_c_api.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/libraw_c_api.mt.o src/libraw_c_api.cpp

object/libraw_datastream.o: src/libraw_datastream.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/libraw_datastream.o src/libraw_datastream.cpp
object/libraw_datastream.mt.o: src/libraw_datastream.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/libraw_datastream.mt.o src/libraw_datastream.cpp
object/canon_600.o: src/decoders/canon_600.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/canon_600.o src/decoders/canon_600.cpp
object/canon_600.mt.o: src/decoders/canon_600.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/canon_600.mt.o src/decoders/canon_600.cpp
object/crx.o: src/decoders/crx.cpp
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/crx.o src/decoders/crx.cpp
object/crx.mt.o: src/decoders/crx.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/crx.mt.o src/decoders/crx.cpp
object/olympus14.o: src/decoders/olympus14.cpp
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/olympus14.o src/decoders/olympus14.cpp
object/olympus14.mt.o: src/decoders/olympus14.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/olympus14.mt.o src/decoders/olympus14.cpp
object/pana8.o: src/decoders/pana8.cpp
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/pana8.o src/decoders/pana8.cpp
object/pana8.mt.o: src/decoders/pana8.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/pana8.mt.o src/decoders/pana8.cpp
object/sonycc.o: src/decoders/sonycc.cpp
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/sonycc.o src/decoders/sonycc.cpp
object/sonycc.mt.o: src/decoders/sonycc.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/sonycc.mt.o src/decoders/sonycc.cpp
object/losslessjpeg.o: src/decompressors/losslessjpeg.cpp
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/losslessjpeg.o src/decompressors/losslessjpeg.cpp
object/losslessjpeg.mt.o: src/decompressors/losslessjpeg.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/losslessjpeg.mt.o src/decompressors/losslessjpeg.cpp
object/decoders_dcraw.o: src/decoders/decoders_dcraw.cpp
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/decoders_dcraw.o src/decoders/decoders_dcraw.cpp
object/decoders_dcraw.mt.o: src/decoders/decoders_dcraw.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/decoders_dcraw.mt.o src/decoders/decoders_dcraw.cpp
object/decoders_libraw_dcrdefs.o: src/decoders/decoders_libraw_dcrdefs.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/decoders_libraw_dcrdefs.o src/decoders/decoders_libraw_dcrdefs.cpp
object/decoders_libraw_dcrdefs.mt.o: src/decoders/decoders_libraw_dcrdefs.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/decoders_libraw_dcrdefs.mt.o src/decoders/decoders_libraw_dcrdefs.cpp
object/decoders_libraw.o: src/decoders/decoders_libraw.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/decoders_libraw.o src/decoders/decoders_libraw.cpp
object/decoders_libraw.mt.o: src/decoders/decoders_libraw.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/decoders_libraw.mt.o src/decoders/decoders_libraw.cpp
object/dng.o: src/decoders/dng.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/dng.o src/decoders/dng.cpp
object/dng.mt.o: src/decoders/dng.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/dng.mt.o src/decoders/dng.cpp
object/fp_dng.o: src/decoders/fp_dng.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/fp_dng.o src/decoders/fp_dng.cpp
object/fp_dng.mt.o: src/decoders/fp_dng.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/fp_dng.mt.o src/decoders/fp_dng.cpp
object/fuji_compressed.o: src/decoders/fuji_compressed.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/fuji_compressed.o src/decoders/fuji_compressed.cpp
object/fuji_compressed.mt.o: src/decoders/fuji_compressed.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/fuji_compressed.mt.o src/decoders/fuji_compressed.cpp
object/generic.o: src/decoders/generic.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/generic.o src/decoders/generic.cpp
object/generic.mt.o: src/decoders/generic.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/generic.mt.o src/decoders/generic.cpp
object/kodak_decoders.o: src/decoders/kodak_decoders.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/kodak_decoders.o src/decoders/kodak_decoders.cpp
object/kodak_decoders.mt.o: src/decoders/kodak_decoders.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/kodak_decoders.mt.o src/decoders/kodak_decoders.cpp
object/load_mfbacks.o: src/decoders/load_mfbacks.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/load_mfbacks.o src/decoders/load_mfbacks.cpp
object/load_mfbacks.mt.o: src/decoders/load_mfbacks.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/load_mfbacks.mt.o src/decoders/load_mfbacks.cpp
object/smal.o: src/decoders/smal.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/smal.o src/decoders/smal.cpp 
object/smal.mt.o: src/decoders/smal.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/smal.mt.o src/decoders/smal.cpp
object/unpack_thumb.o: src/decoders/unpack_thumb.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/unpack_thumb.o src/decoders/unpack_thumb.cpp
object/unpack_thumb.mt.o: src/decoders/unpack_thumb.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/unpack_thumb.mt.o src/decoders/unpack_thumb.cpp
object/unpack.o: src/decoders/unpack.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/unpack.o src/decoders/unpack.cpp
object/unpack.mt.o: src/decoders/unpack.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/unpack.mt.o src/decoders/unpack.cpp
object/aahd_demosaic.o: src/demosaic/aahd_demosaic.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/aahd_demosaic.o src/demosaic/aahd_demosaic.cpp
object/aahd_demosaic.mt.o: src/demosaic/aahd_demosaic.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/aahd_demosaic.mt.o src/demosaic/aahd_demosaic.cpp
object/ahd_demosaic.o: src/demosaic/ahd_demosaic.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/ahd_demosaic.o src/demosaic/ahd_demosaic.cpp
object/ahd_demosaic.mt.o: src/demosaic/ahd_demosaic.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/ahd_demosaic.mt.o src/demosaic/ahd_demosaic.cpp
object/dcb_demosaic.o: src/demosaic/dcb_demosaic.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/dcb_demosaic.o src/demosaic/dcb_demosaic.cpp
object/dcb_demosaic.mt.o: src/demosaic/dcb_demosaic.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/dcb_demosaic.mt.o src/demosaic/dcb_demosaic.cpp
object/dht_demosaic.o: src/demosaic/dht_demosaic.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/dht_demosaic.o src/demosaic/dht_demosaic.cpp
object/dht_demosaic.mt.o: src/demosaic/dht_demosaic.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/dht_demosaic.mt.o src/demosaic/dht_demosaic.cpp
object/misc_demosaic.o: src/demosaic/misc_demosaic.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/misc_demosaic.o src/demosaic/misc_demosaic.cpp
object/misc_demosaic.mt.o: src/demosaic/misc_demosaic.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/misc_demosaic.mt.o src/demosaic/misc_demosaic.cpp
object/xtrans_demosaic.o: src/demosaic/xtrans_demosaic.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/xtrans_demosaic.o src/demosaic/xtrans_demosaic.cpp
object/xtrans_demosaic.mt.o: src/demosaic/xtrans_demosaic.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/xtrans_demosaic.mt.o src/demosaic/xtrans_demosaic.cpp
object/dngsdk_glue.o: src/integration/dngsdk_glue.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/dngsdk_glue.o src/integration/dngsdk_glue.cpp
object/dngsdk_glue.mt.o: src/integration/dngsdk_glue.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/dngsdk_glue.mt.o src/integration/dngsdk_glue.cpp
object/rawspeed_glue.o: src/integration/rawspeed_glue.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/rawspeed_glue.o src/integration/rawspeed_glue.cpp
object/rawspeed_glue.mt.o: src/integration/rawspeed_glue.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/rawspeed_glue.mt.o src/integration/rawspeed_glue.cpp
object/adobepano.o: src/metadata/adobepano.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/adobepano.o src/metadata/adobepano.cpp
object/adobepano.mt.o: src/metadata/adobepano.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/adobepano.mt.o src/metadata/adobepano.cpp
object/canon.o: src/metadata/canon.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/canon.o src/metadata/canon.cpp
object/canon.mt.o: src/metadata/canon.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/canon.mt.o src/metadata/canon.cpp
object/ciff.o: src/metadata/ciff.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/ciff.o src/metadata/ciff.cpp
object/ciff.mt.o: src/metadata/ciff.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/ciff.mt.o src/metadata/ciff.cpp
object/cr3_parser.o: src/metadata/cr3_parser.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/cr3_parser.o src/metadata/cr3_parser.cpp
object/cr3_parser.mt.o: src/metadata/cr3_parser.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/cr3_parser.mt.o src/metadata/cr3_parser.cpp
object/epson.o: src/metadata/epson.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/epson.o src/metadata/epson.cpp
object/epson.mt.o: src/metadata/epson.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/epson.mt.o src/metadata/epson.cpp
object/exif_gps.o: src/metadata/exif_gps.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/exif_gps.o src/metadata/exif_gps.cpp
object/exif_gps.mt.o: src/metadata/exif_gps.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/exif_gps.mt.o src/metadata/exif_gps.cpp
object/fuji.o: src/metadata/fuji.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/fuji.o src/metadata/fuji.cpp
object/fuji.mt.o: src/metadata/fuji.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/fuji.mt.o src/metadata/fuji.cpp
object/identify_tools.o: src/metadata/identify_tools.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/identify_tools.o src/metadata/identify_tools.cpp
object/identify_tools.mt.o: src/metadata/identify_tools.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/identify_tools.mt.o src/metadata/identify_tools.cpp
object/identify.o: src/metadata/identify.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/identify.o src/metadata/identify.cpp
object/identify.mt.o: src/metadata/identify.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/identify.mt.o src/metadata/identify.cpp
object/kodak.o: src/metadata/kodak.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/kodak.o src/metadata/kodak.cpp
object/kodak.mt.o: src/metadata/kodak.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/kodak.mt.o src/metadata/kodak.cpp
object/leica.o: src/metadata/leica.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/leica.o src/metadata/leica.cpp
object/leica.mt.o: src/metadata/leica.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/leica.mt.o src/metadata/leica.cpp
object/makernotes.o: src/metadata/makernotes.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/makernotes.o src/metadata/makernotes.cpp
object/makernotes.mt.o: src/metadata/makernotes.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/makernotes.mt.o src/metadata/makernotes.cpp
object/mediumformat.o: src/metadata/mediumformat.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/mediumformat.o src/metadata/mediumformat.cpp
object/mediumformat.mt.o: src/metadata/mediumformat.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/mediumformat.mt.o src/metadata/mediumformat.cpp
object/minolta.o: src/metadata/minolta.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/minolta.o src/metadata/minolta.cpp
object/minolta.mt.o: src/metadata/minolta.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/minolta.mt.o src/metadata/minolta.cpp
object/misc_parsers.o: src/metadata/misc_parsers.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/misc_parsers.o src/metadata/misc_parsers.cpp
object/misc_parsers.mt.o: src/metadata/misc_parsers.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/misc_parsers.mt.o src/metadata/misc_parsers.cpp
object/nikon.o: src/metadata/nikon.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/nikon.o src/metadata/nikon.cpp
object/nikon.mt.o: src/metadata/nikon.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/nikon.mt.o src/metadata/nikon.cpp
object/hasselblad_model.o: src/metadata/hasselblad_model.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/hasselblad_model.o src/metadata/hasselblad_model.cpp
object/hasselblad_model.mt.o: src/metadata/hasselblad_model.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/hasselblad_model.mt.o src/metadata/hasselblad_model.cpp
object/normalize_model.o: src/metadata/normalize_model.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/normalize_model.o src/metadata/normalize_model.cpp
object/normalize_model.mt.o: src/metadata/normalize_model.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/normalize_model.mt.o src/metadata/normalize_model.cpp
object/olympus.o: src/metadata/olympus.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/olympus.o src/metadata/olympus.cpp
object/olympus.mt.o: src/metadata/olympus.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/olympus.mt.o src/metadata/olympus.cpp
object/p1.o: src/metadata/p1.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/p1.o src/metadata/p1.cpp
object/p1.mt.o: src/metadata/p1.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/p1.mt.o src/metadata/p1.cpp
object/pentax.o: src/metadata/pentax.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/pentax.o src/metadata/pentax.cpp
object/pentax.mt.o: src/metadata/pentax.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/pentax.mt.o src/metadata/pentax.cpp
object/samsung.o: src/metadata/samsung.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/samsung.o src/metadata/samsung.cpp
object/samsung.mt.o: src/metadata/samsung.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/samsung.mt.o src/metadata/samsung.cpp
object/sony.o: src/metadata/sony.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/sony.o src/metadata/sony.cpp
object/sony.mt.o: src/metadata/sony.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/sony.mt.o src/metadata/sony.cpp
object/tiff.o: src/metadata/tiff.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/tiff.o src/metadata/tiff.cpp
object/tiff.mt.o: src/metadata/tiff.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/tiff.mt.o src/metadata/tiff.cpp
object/aspect_ratio.o: src/postprocessing/aspect_ratio.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/aspect_ratio.o src/postprocessing/aspect_ratio.cpp
object/aspect_ratio.mt.o: src/postprocessing/aspect_ratio.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/aspect_ratio.mt.o src/postprocessing/aspect_ratio.cpp
object/dcraw_process.o: src/postprocessing/dcraw_process.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/dcraw_process.o src/postprocessing/dcraw_process.cpp
object/dcraw_process.mt.o: src/postprocessing/dcraw_process.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/dcraw_process.mt.o src/postprocessing/dcraw_process.cpp
object/mem_image.o: src/postprocessing/mem_image.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/mem_image.o src/postprocessing/mem_image.cpp
object/mem_image.mt.o: src/postprocessing/mem_image.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/mem_image.mt.o src/postprocessing/mem_image.cpp
object/postprocessing_aux.o: src/postprocessing/postprocessing_aux.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/postprocessing_aux.o src/postprocessing/postprocessing_aux.cpp
object/postprocessing_aux.mt.o: src/postprocessing/postprocessing_aux.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/postprocessing_aux.mt.o src/postprocessing/postprocessing_aux.cpp
object/postprocessing_utils_dcrdefs.o: src/postprocessing/postprocessing_utils_dcrdefs.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/postprocessing_utils_dcrdefs.o src/postprocessing/postprocessing_utils_dcrdefs.cpp
object/postprocessing_utils_dcrdefs.mt.o: src/postprocessing/postprocessing_utils_dcrdefs.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/postprocessing_utils_dcrdefs.mt.o src/postprocessing/postprocessing_utils_dcrdefs.cpp
object/postprocessing_utils.o: src/postprocessing/postprocessing_utils.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/postprocessing_utils.o src/postprocessing/postprocessing_utils.cpp
object/postprocessing_utils.mt.o: src/postprocessing/postprocessing_utils.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/postprocessing_utils.mt.o src/postprocessing/postprocessing_utils.cpp
object/raw2image.o: src/preprocessing/raw2image.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/raw2image.o src/preprocessing/raw2image.cpp
object/raw2image.mt.o: src/preprocessing/raw2image.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/raw2image.mt.o src/preprocessing/raw2image.cpp
object/ext_preprocess.o: src/preprocessing/ext_preprocess.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/ext_preprocess.o src/preprocessing/ext_preprocess.cpp
object/ext_preprocess.mt.o: src/preprocessing/ext_preprocess.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/ext_preprocess.mt.o src/preprocessing/ext_preprocess.cpp
object/subtract_black.o: src/preprocessing/subtract_black.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/subtract_black.o src/preprocessing/subtract_black.cpp
object/subtract_black.mt.o: src/preprocessing/subtract_black.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/subtract_black.mt.o src/preprocessing/subtract_black.cpp
object/cameralist.o: src/tables/cameralist.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/cameralist.o src/tables/cameralist.cpp
object/cameralist.mt.o: src/tables/cameralist.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/cameralist.mt.o src/tables/cameralist.cpp
object/colorconst.o: src/tables/colorconst.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/colorconst.o src/tables/colorconst.cpp
object/colorconst.mt.o: src/tables/colorconst.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/colorconst.mt.o src/tables/colorconst.cpp
object/colordata.o: src/tables/colordata.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/colordata.o src/tables/colordata.cpp
object/colordata.mt.o: src/tables/colordata.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/colordata.mt.o src/tables/colordata.cpp
object/wblists.o: src/tables/wblists.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/wblists.o src/tables/wblists.cpp
object/wblists.mt.o: src/tables/wblists.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/wblists.mt.o src/tables/wblists.cpp
object/curves.o: src/utils/curves.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/curves.o src/utils/curves.cpp
object/curves.mt.o: src/utils/curves.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/curves.mt.o src/utils/curves.cpp
object/decoder_info.o: src/utils/decoder_info.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/decoder_info.o src/utils/decoder_info.cpp
object/decoder_info.mt.o: src/utils/decoder_info.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/decoder_info.mt.o src/utils/decoder_info.cpp
object/init_close_utils.o: src/utils/init_close_utils.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/init_close_utils.o src/utils/init_close_utils.cpp
object/init_close_utils.mt.o: src/utils/init_close_utils.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/init_close_utils.mt.o src/utils/init_close_utils.cpp
object/open.o: src/utils/open.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/open.o src/utils/open.cpp
object/open.mt.o: src/utils/open.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/open.mt.o src/utils/open.cpp
object/phaseone_processing.o: src/utils/phaseone_processing.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/phaseone_processing.o src/utils/phaseone_processing.cpp
object/phaseone_processing.mt.o: src/utils/phaseone_processing.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/phaseone_processing.mt.o src/utils/phaseone_processing.cpp
object/read_utils.o: src/utils/read_utils.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/read_utils.o src/utils/read_utils.cpp
object/read_utils.mt.o: src/utils/read_utils.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/read_utils.mt.o src/utils/read_utils.cpp
object/thumb_utils.o: src/utils/thumb_utils.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/thumb_utils.o src/utils/thumb_utils.cpp
object/thumb_utils.mt.o: src/utils/thumb_utils.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/thumb_utils.mt.o src/utils/thumb_utils.cpp
object/utils_dcraw.o: src/utils/utils_dcraw.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/utils_dcraw.o src/utils/utils_dcraw.cpp
object/utils_dcraw.mt.o: src/utils/utils_dcraw.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/utils_dcraw.mt.o src/utils/utils_dcraw.cpp
object/utils_libraw.o: src/utils/utils_libraw.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/utils_libraw.o src/utils/utils_libraw.cpp
object/utils_libraw.mt.o: src/utils/utils_libraw.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/utils_libraw.mt.o src/utils/utils_libraw.cpp
object/apply_profile.o: src/write/apply_profile.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/apply_profile.o src/write/apply_profile.cpp
object/apply_profile.mt.o: src/write/apply_profile.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/apply_profile.mt.o src/write/apply_profile.cpp
object/file_write.o: src/write/file_write.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/file_write.o src/write/file_write.cpp
object/file_write.mt.o: src/write/file_write.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/file_write.mt.o src/write/file_write.cpp
object/tiff_writer.o: src/write/tiff_writer.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/tiff_writer.o src/write/tiff_writer.cpp
object/tiff_writer.mt.o: src/write/tiff_writer.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/tiff_writer.mt.o src/write/tiff_writer.cpp
object/x3f_parse_process.o: src/x3f/x3f_parse_process.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/x3f_parse_process.o src/x3f/x3f_parse_process.cpp
object/x3f_parse_process.mt.o: src/x3f/x3f_parse_process.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/x3f_parse_process.mt.o src/x3f/x3f_parse_process.cpp
object/x3f_utils_patched.o: src/x3f/x3f_utils_patched.cpp $(HEADERS)
	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/x3f_utils_patched.o src/x3f/x3f_utils_patched.cpp
object/x3f_utils_patched.mt.o: src/x3f/x3f_utils_patched.cpp $(HEADERS)
	${CXX} -c ${CFLAGS} -o object/x3f_utils_patched.mt.o src/x3f/x3f_utils_patched.cpp
