1all: library all_samples
2
3CFLAGS=-m64 -fPIC -mfpmath=sse -msse4.2 -ffunction-sections -fdata-sections -ffast-math -fvisibility=hidden -fvisibility-inlines-hidden -fnon-call-exceptions -O3 -I. -w
4CC=clang
5CXX=clang++
6
7# OpenMP support
8#CFLAGS+=-fopenmp
9
10# RawSpeed Support
11#CFLAGS+=-pthread -DUSE_RAWSPEED -I../RawSpeed -I/usr/local/include/libxml2
12#LDADD+=-L../RawSpeed/RawSpeed -lrawspeed -L/usr/local/lib -ljpeg -lxml2
13#RAWSPEED_DATA=../RawSpeed/data/cameras.xml
14
15# DNG SDK Support
16# CFLAGS+=-DUSE_DNGSDK -I../dng_sdk/source
17# LDADDD+=-L../dng_sdk/release -ldng -lXMPCore -ljpeg -lz
18
19# Jasper support for RedCine
20#CFLAGS+=-DUSE_JASPER -I/usr/local/include
21#LDADD+=-L/usr/local/lib -ljasper
22
23# JPEG support for lossy DNG
24#CFLAGS+=-DUSE_JPEG -I/usr/local/include
25#LDADD+=-L/usr/local/lib -ljpeg
26# LIBJPEG8:
27#CFLAGS+=-DUSE_JPEG8
28
29# LCMS support
30#CFLAGS+=-DUSE_LCMS -I/usr/local/include
31#LDADD+=-L/usr/local/lib -llcms
32
33# LCMS2.x support
34#CFLAGS+=-DUSE_LCMS2 -I/usr/local/include
35#LDADD+=-L/usr/local/lib -llcms2
36
37
38DCRAW_LIB_OBJECTS=object/dcraw_common.o object/libraw_cxx.o object/libraw_datastream.o object/libraw_c_api.o object/dcraw_fileio.o object/demosaic_packs.o
39DCRAW_LIB_MT_OBJECTS=object/dcraw_common_mt.o object/libraw_cxx_mt.o object/libraw_datastream_mt.o object/libraw_c_api_mt.o object/dcraw_fileio_mt.o object/demosaic_packs_mt.o
40
41library: lib/libraw.a lib/libraw_r.a
42
43all_samples: bin/raw-identify bin/simple_dcraw  bin/dcraw_emu bin/dcraw_half bin/half_mt bin/mem_image \
44             bin/unprocessed_raw bin/4channels bin/multirender_test bin/postprocessing_benchmark
45
46install: library
47	@if [ -d /usr/local/include ] ; then cp -R libraw /usr/local/include/ ; else echo 'no /usr/local/include' ; fi
48	@if [ -d /usr/local/lib ] ; then cp lib/libraw.a lib/libraw_r.a /usr/local/lib/ ; else echo 'no /usr/local/lib' ; fi
49
50install-binaries: all_samples
51	@if [ -d /usr/local/bin ] ; then cp bin/[a-z]* /usr/local/bin/ ; else echo 'no /usr/local/bin' ; fi
52
53
54## RawSpeed xml file
55
56RawSpeed/rawspeed_xmldata.cpp: ${RAWSPEED_DATA}
57	./rsxml2c.sh ${RAWSPEED_DATA} > RawSpeed/rawspeed_xmldata.cpp
58
59#binaries
60
61bin/raw-identify: lib/libraw.a samples/raw-identify.cpp
62	${CXX} -DLIBRAW_NOTHREADS  ${CFLAGS} -o bin/raw-identify samples/raw-identify.cpp -L./lib -lraw  -lm ${LDADD}
63
64bin/unprocessed_raw: lib/libraw.a samples/unprocessed_raw.cpp
65	${CXX} -DLIBRAW_NOTHREADS  ${CFLAGS} -o bin/unprocessed_raw samples/unprocessed_raw.cpp -L./lib -lraw  -lm  ${LDADD}
66
67bin/4channels: lib/libraw.a samples/4channels.cpp
68	${CXX} -DLIBRAW_NOTHREADS  ${CFLAGS} -o bin/4channels samples/4channels.cpp -L./lib -lraw  -lm  ${LDADD}
69
70bin/simple_dcraw: lib/libraw.a samples/simple_dcraw.cpp
71	${CXX} -DLIBRAW_NOTHREADS   ${CFLAGS} -o bin/simple_dcraw samples/simple_dcraw.cpp -L./lib -lraw  -lm  ${LDADD}
72
73bin/multirender_test: lib/libraw.a samples/multirender_test.cpp
74	${CXX} -DLIBRAW_NOTHREADS   ${CFLAGS} -o bin/multirender_test samples/multirender_test.cpp -L./lib -lraw  -lm  ${LDADD}
75
76bin/postprocessing_benchmark: lib/libraw.a samples/postprocessing_benchmark.cpp
77	${CXX} -DLIBRAW_NOTHREADS   ${CFLAGS} -o bin/postprocessing_benchmark samples/postprocessing_benchmark.cpp -L./lib -lraw  -lm  ${LDADD}
78
79bin/mem_image: lib/libraw.a samples/mem_image.cpp
80	${CXX} -DLIBRAW_NOTHREADS  ${CFLAGS} -o bin/mem_image samples/mem_image.cpp -L./lib -lraw  -lm  ${LDADD}
81
82bin/dcraw_half: lib/libraw.a object/dcraw_half.o
83	${CC} -DLIBRAW_NOTHREADS  ${CFLAGS} -o bin/dcraw_half object/dcraw_half.o -L./lib -lraw  -lm -lstdc++  ${LDADD}
84
85bin/half_mt: lib/libraw_r.a object/half_mt.o
86	${CC}   -pthread ${CFLAGS} -o bin/half_mt object/half_mt.o -L./lib -lraw_r  -lm -lstdc++  ${LDADD}
87
88bin/dcraw_emu: lib/libraw.a samples/dcraw_emu.cpp
89	${CXX} -DLIBRAW_NOTHREADS  ${CFLAGS} -o bin/dcraw_emu samples/dcraw_emu.cpp -L./lib -lraw  -lm  ${LDADD}
90
91#objects
92
93object/demosaic_packs.o: internal/demosaic_packs.cpp
94	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} ${DPCFLAGS} -o object/demosaic_packs.o internal/demosaic_packs.cpp
95
96object/dcraw_common.o: internal/dcraw_common.cpp
97	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/dcraw_common.o internal/dcraw_common.cpp
98
99object/dcraw_fileio.o: internal/dcraw_fileio.cpp
100	${CXX} -c -DLIBRAW_NOTHREADS ${CFLAGS}  -o object/dcraw_fileio.o internal/dcraw_fileio.cpp
101
102object/libraw_cxx.o: src/libraw_cxx.cpp RawSpeed/rawspeed_xmldata.cpp src/libraw_fuji_compressed.cpp
103	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/libraw_cxx.o src/libraw_cxx.cpp
104
105object/libraw_datastream.o: src/libraw_datastream.cpp
106	${CXX} -c -DLIBRAW_NOTHREADS  ${CFLAGS} -o object/libraw_datastream.o src/libraw_datastream.cpp
107
108object/libraw_c_api.o: src/libraw_c_api.cpp
109	${CXX} -c -DLIBRAW_NOTHREADS   ${CFLAGS} -o object/libraw_c_api.o src/libraw_c_api.cpp
110
111object/dcraw_half.o: samples/dcraw_half.c
112	${CC} -c -DLIBRAW_NOTHREADS   ${CFLAGS} -o object/dcraw_half.o samples/dcraw_half.c
113
114object/half_mt.o: samples/half_mt.c
115	${CC} -c -pthread   ${CFLAGS} -o object/half_mt.o samples/half_mt.c
116
117
118lib/libraw.a: ${DCRAW_LIB_OBJECTS}
119	rm -f lib/libraw.a
120	ar crv lib/libraw.a ${DCRAW_LIB_OBJECTS}
121	ranlib lib/libraw.a
122
123lib/libraw_r.a: ${DCRAW_LIB_MT_OBJECTS}
124	rm -f lib/libraw_r.a
125	ar crv lib/libraw_r.a ${DCRAW_LIB_MT_OBJECTS}
126	ranlib lib/libraw_r.a
127
128object/demosaic_packs_mt.o: internal/demosaic_packs.cpp
129	${CXX} -c -pthread   ${CFLAGS} ${DPCFLAGS} -o object/demosaic_packs_mt.o internal/demosaic_packs.cpp
130
131object/dcraw_common_mt.o: internal/dcraw_common.cpp
132	${CXX} -c -pthread   ${CFLAGS} -o object/dcraw_common_mt.o internal/dcraw_common.cpp
133
134object/dcraw_fileio_mt.o: internal/dcraw_fileio.cpp
135	${CXX} -c -pthread  ${CFLAGS} -o object/dcraw_fileio_mt.o internal/dcraw_fileio.cpp
136
137object/libraw_cxx_mt.o: src/libraw_cxx.cpp RawSpeed/rawspeed_xmldata.cpp src/libraw_fuji_compressed.cpp
138	${CXX} -c   -pthread ${CFLAGS} -o object/libraw_cxx_mt.o src/libraw_cxx.cpp
139
140object/libraw_datastream_mt.o: src/libraw_datastream.cpp
141	${CXX} -c   -pthread ${CFLAGS} -o object/libraw_datastream_mt.o src/libraw_datastream.cpp
142
143object/libraw_c_api_mt.o: src/libraw_c_api.cpp
144	${CXX} -c   -pthread ${CFLAGS} -o object/libraw_c_api_mt.o src/libraw_c_api.cpp
145
146clean:
147	rm -fr bin/*.dSYM
148	rm -f *.o *~ src/*~ samples/*~ internal/*~ libraw/*~ lib/lib*.a bin/[4a-z]* object/*o dcraw/*~ doc/*~ bin/*~
149
150