-
Notifications
You must be signed in to change notification settings - Fork 35
/
Makefile.common
121 lines (100 loc) · 3.39 KB
/
Makefile.common
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# the components of imagestack
IMAGESTACK_OBJECTS = \
Calculus.o \
Color.o \
Complex.o \
Control.o \
Convolve.o \
Deconvolution.o \
DFT.o \
Display.o \
DisplayWindow.o \
Exception.o \
File.o \
FileEXR.o \
FileCSV.o \
FileHDR.o \
FileJPG.o \
FilePNG.o \
FileTMP.o \
FileMAT.o \
FilePPM.o \
FilePBA.o \
FileTGA.o \
FileTIFF.o \
FileFLO.o \
FileWAV.o \
Filter.o \
GaussTransform.o \
Geometry.o \
HDR.o \
KernelEstimation.o \
LAHBPCG.o \
LightField.o \
LocalLaplacian.o \
Arithmetic.o \
Alignment.o \
NetworkOps.o \
Network.o \
Operation.o \
Paint.o \
PatchMatch.o \
Parser.o \
Plugin.o \
Prediction.o \
Stack.o \
Statistics.o \
Wavelet.o \
WLS.o \
main.o \
# This adds the appropriate defines for dependencies not included
SDL_CCFLAGS ?= -DNO_SDL
JPEG_CCFLAGS ?= -DNO_JPEG
TIFF_CCFLAGS ?= -DNO_TIFF
PNG_CCFLAGS ?= -DNO_PNG
FFTW_CCFLAGS ?= -DNO_FFTW
OPENEXR_CCFLAGS ?= -DNO_OPENEXR
##########################
# Top-level targets #
##########################
all: $(BIN_TARGET) library
clean:
-rm -f $(BIN_TARGET) lib/*.* bin/build/*.* lib/build/*.* include/*.*
##########################
# ImageStack the program #
##########################
$(BIN_TARGET): IMAGESTACK_CCFLAGS = $(BIN_CCFLAGS) $(SDL_CCFLAGS) $(JPEG_CCFLAGS) $(TIFF_CCFLAGS) $(PNG_CCFLAGS) $(FFTW_CCFLAGS) $(OPENEXR_CCFLAGS)
$(BIN_TARGET): IMAGESTACK_LIBS = $(SDL_LIBS) $(JPEG_LIBS) $(TIFF_LIBS) $(PNG_LIBS) $(FFTW_LIBS) $(OPENEXR_LIBS) -ldl
BIN_OBJECTS = $(foreach f,$(IMAGESTACK_OBJECTS),bin/build/$f)
# Everything includes main.h. By precompiling that header we can speed up compilation about 30%
bin/build/main.h.gch: src/main.h
mkdir -p bin/build
$(CXX) $(IMAGESTACK_CCFLAGS) -x c++-header -O3 -o bin/build/main.h.gch src/main.h
$(BIN_TARGET): $(BIN_OBJECTS)
$(CXX) $(IMAGESTACK_CCFLAGS) $(BIN_OBJECTS) $(IMAGESTACK_LIBS) -o $(BIN_TARGET)
-include $(addprefix bin/build/, $(IMAGESTACK_OBJECTS:.o=.d))
bin/build/%.o: src/%.cpp bin/build/main.h.gch
$(CXX) -include bin/build/main.h $(IMAGESTACK_CCFLAGS) -MMD -MP -MF bin/build/$*.d -MT $@ -c $< -o $@
##########################
# ImageStack the library #
##########################
$(LIB_TARGET): IMAGESTACK_CCFLAGS = $(LIB_CCFLAGS) -DNO_MAIN $(SDL_CCFLAGS) $(JPEG_CCFLAGS) $(TIFF_CCFLAGS) $(PNG_CCFLAGS) $(FFTW_CCFLAGS) $(OPENEXR_CCFLAGS)
$(LIB_TARGET): IMAGESTACK_LIBS = $(JPEG_LIBS) $(TIFF_LIBS) $(PNG_LIBS) $(FFTW_LIBS) $(OPENEXR_LIBS) -ldl
LIB_OBJECTS = $(foreach f,$(IMAGESTACK_OBJECTS),lib/build/$f)
library: $(LIB_TARGET) include/ImageStack.h
lib/build/main.h.gch: src/main.h
mkdir -p lib/build
$(CXX) $(IMAGESTACK_CCFLAGS) -x c++-header -O3 -o lib/build/main.h.gch src/main.h
$(LIB_TARGET): $(LIB_OBJECTS)
$(CXX) $(LIB_FLAGS) $(LIB_OBJECTS) -o $(LIB_TARGET) $(IMAGESTACK_LIBS)
include/ImageStack.h: src/ImageStack.h
mkdir include
cp src/*.h include
lib/build/%.o: src/%.cpp lib/build/main.h.gch
$(CXX) -include lib/build/main.h $(IMAGESTACK_CCFLAGS) -c $< -o $@
##########################
# Source Style Fixing #
##########################
STYLE_OPTS = --indent=spaces=4 --brackets=attach --indent-labels --indent-preprocessor --indent-col1-comments --max-instatement-indent=60 --min-conditional-indent=0 --pad-header --unpad-paren --keep-one-line-blocks --keep-one-line-statements --convert-tabs --align-pointer=name --suffix=none --options=none
style:
astyle $(STYLE_OPTS) `find . -name '[A-Za-z]*.h'` `find . -name '[A-Za-z]*.cpp'`