-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
86 lines (70 loc) · 3.01 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Makefile for the cr2hdr software
#---
SRC_DIR=.
HOSTCC=gcc
#---
CR2HDR_BIN=cr2hdr
#HOSTCC=$(HOST_CC)
# CR2HDR_CFLAGS=-mno-ms-bitfields -O2 -Wall -I$(SRC_DIR) -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -msse -msse2 -std=gnu99
CR2HDR_CFLAGS=-mno-ms-bitfields -O2 -g -Wall -I$(SRC_DIR) -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -msse -msse2 -std=gnu99
# CR2HDR_LDFLAGS=-lm -m32
CR2HDR_LDFLAGS=-lm
CR2HDR_DEPS=dcraw-bridge.c exiftool-bridge.c adobedng-bridge.c amaze_demosaic_RT.c dither.c timing.c kelvin.c
HOST=host
EXIFTOOL_VERS=10.33
ifdef CROSS
HOSTCC=$(MINGW_GCC)
CR2HDR_BIN=cr2hdr.exe
endif
$(CR2HDR_BIN): cr2hdr.c $(CR2HDR_DEPS) $(MODULE_STRINGS)
# $(call build,$(notdir $(HOSTCC)),$(HOSTCC) $(CR2HDR_CFLAGS) cr2hdr.c $(CR2HDR_DEPS) -o $@ $(CR2HDR_LDFLAGS))
$(HOSTCC) $(CR2HDR_CFLAGS) cr2hdr.c $(CR2HDR_DEPS) -o $@ $(CR2HDR_LDFLAGS)
$(CR2HDR_BIN).exe: cr2hdr.c $(CR2HDR_DEPS) $(MODULE_STRINGS)
CROSS=1 $(MAKE) $@
clean:
rm -f cr2hdr cr2hdr.exe dcraw dcraw.c dcraw.exe exiftool.exe exiftool.tar.gz exiftool exiftool.zip cr2hdr.zip cr2hdr-win.zip cr2hdr-win_exiftool-perl-script.zip
rm -rf lib
dcraw.c:
wget https://www.cybercom.net/~dcoffin/dcraw/dcraw.c
# Sometimes there is a problem with this domain's issuer authority--go insecure if you dare.
# wget --no-check-certificate https://www.cybercom.net/~dcoffin/dcraw/dcraw.c
# Alternate site in case cybercom.net is completely down
# wget https://raw.githubusercontent.com/LibRaw/LibRaw/master/dcraw/dcraw.c
dcraw: dcraw.c
# This works on Mac and Linux to create a dcraw binary
# It also works on Cygwin but it requires cygwin1.dll.
# Does not work on msys/MinGW or msys2/i686-w64-mingw32.
$(call build,$(notdir $(HOSTCC)),$(HOSTCC) -o dcraw -O4 dcraw.c -lm -DNODEPS )
dcraw.exe: dcraw.c
# This works on Mac, Linux, msys2/i686-w64-mingw32 and Cygwin/i686-w64-mingw32.
# Does not work on msys/MinGW.
$(call build,$(notdir $(MINGW_GCC)),$(MINGW_GCC) -o dcraw.exe -O4 dcraw.c -lm -lws2_32 -DNODEPS )
exiftool.tar.gz:
# Mac and Linux
wget http://www.sno.phy.queensu.ca/~phil/exiftool/Image-ExifTool-$(EXIFTOOL_VERS).tar.gz -O exiftool.tar.gz
exiftool.zip:
# Windows
wget http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool-$(EXIFTOOL_VERS).zip -O exiftool.zip
exiftool: exiftool.tar.gz
# exiftool perl script - Mac and Linux
tar -zxf exiftool.tar.gz Image-ExifTool-$(EXIFTOOL_VERS)/exiftool Image-ExifTool-$(EXIFTOOL_VERS)/lib
mv Image-ExifTool-$(EXIFTOOL_VERS)/exiftool exiftool
mv Image-ExifTool-$(EXIFTOOL_VERS)/lib lib
rm -rf Image-ExifTool-$(EXIFTOOL_VERS)
exiftool.exe: exiftool.zip
# Windows binary
unzip exiftool.zip
mv exiftool\(-k\).exe exiftool.exe
cr2hdr.zip: cr2hdr dcraw exiftool
# Use for Mac and Linux
#
# Can also can be used with msys2/MinGW-64 and Cygwin/MinGW if exiftool perl script is preferred.
# - run “make cr2hdr.exe && make dcraw.exe && make cr2hdr.zip”
ifeq ($(OS),Windows_NT)
zip -rq cr2hdr-win_exiftool-perl-script cr2hdr.exe dcraw.exe exiftool lib
else
zip -rq $@ $< $^ lib
endif
cr2hdr-win.zip: cr2hdr.exe dcraw.exe exiftool.exe
# Windows
zip $@ $< $^