Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
143 lines (115 loc) · 6.88 KB
/
Copy pathMakefile
File metadata and controls
143 lines (115 loc) · 6.88 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Makefile (for GNU make, a.k.a. gmake).
# Note: the default CONFIG (set in make/Makefile_defs) is either "win" (Windows debug) or "unix" (Unix release),
# depending on the detected platform.
# Setting "CONFIG=all" runs the make process successively on all available configurations.
# Examples:
# make PEDANTIC=1 -j12 demos
# make -j12 Filtermesh # Builds single program using default CONFIG (either "win" or "unix").
# make -j4 # Limit parallelism to 4 cores; important on a Virtual Machine.
# make CONFIG=mingw -j12 demos
# make makeall # Run all CONFIG (same as "make CONFIG=all -j12").
# make cleanall # Clean all CONFIG (same as "make CONFIG=all -j12 deepclean").
# make CONFIG=cygwin CC=clang -j12 # Use clang compiler under cygwin.
# make CONFIG=clang CXX_STD=c++26 -j12 # Test code compatibility with C++26.
# make CONFIG=win CXX_STD=c++latest -j12 # Test compatibility with proposed c++ features.
# make CONFIG=all PEDANTIC=1 # Enable most compiler warnings.
# make CXX_STD=c++26 PEDANTIC=1 -j12
# make CC=gcc CXX_STD=c++26 PEDANTIC=1 -j12
# make CONFIG=all debug # Show the compiler paths and versions.
# make SHELL='bash -x -v' # Show all executed commands.
# make -j12 mostlyclean # Remove intermediates but keep the executables (see "Cleaning" below).
# make CONFIG=unix release=0 PEDANTIC=1 sanitize=address,undefined -C ~/git/mesh_processing -j12 test
# make CONFIG=unix release=0 PEDANTIC=1 sanitize=thread -C ~/git/mesh_processing -j12 test
# make CONFIG=unix release=0 PEDANTIC=1 sanitize=address,undefined -C ~/git/mesh_processing -j12 demos
# make -C progs/SphereParam SphereParam.s
# make CONFIG=clang -C ~/git/mesh_processing/demos -j12 create check
# make CONFIG=clang DEMOS_HIDDEN=1 -C ~/git/mesh_processing/demos -j12 view
# LSAN_OPTIONS=print_suppressions=1:symbolize=1:detect_leaks=0:log_path=PATH:log_exe_name=1:abort_on_error=1
# ASAN_OPTIONS=abort_on_error=1 UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1:exitcode=1
# Cleaning, in three tiers (for the current CONFIG; prefix CONFIG=all for all of them, as "make cleanall" does):
# make mostlyclean # Objects, libHh.{a,lib}, test outputs, and crumbs; the executables and their .pdb stay usable.
# make clean # Also the executables and their .pdb files (like "hmake clean" for the MSBuild build).
# make deepclean # Also the Makefile.dep header-dependency files (regenerating them takes several seconds).
MeshRoot ?= .# This current file is located in the root directory of the package.
include $(MeshRoot)/make/Makefile_defs
ifneq ($(CONFIG),all) # For the rest of this file.
lib_dirs = \
libHh \
lib$(Hw)# Either libHwWindows (Windows program) or libHwX (X11 program).
prog_dirs = \
Recon Meshfit Subdivfit Polyfit MeshDistance \
MeshSimplify Filterprog FilterPM StitchPM \
MinCycles MeshReorder \
SphereParam SphereSample \
Filtermesh Filtera3d Filterframe Filterimage Filtervideo \
G3dOGL G3dVec VideoViewer \
dir_of = $(if $(filter $1,$(prog_dirs)),progs/)$1# The directory of a library, program, test, or demos.
dirs = $(lib_dirs) $(prog_dirs)
dirs+test = $(dirs) test demos
dirs+test+all = $(sort $(dirs+test) libHwWindows libHwX)# Sort to remove duplicates.
all: progs test
demos: progs # Run all demos (after building programs).
progs: $(dirs) # Build all programs.
libs: $(lib_dirs) # Build all libraries.
test: $(lib_dirs) # Run all unit tests (after building libraries).
$(dirs+test): # Build any subproject by running make in its subdirectory.
$(MAKE) -C $(call dir_of,$@)
$(prog_dirs): $(lib_dirs) # Building a program first requires building the libraries.
ifeq ($(use_pch),1) # If using precompiler headers, build libHh before other libraries.
$(filter-out libHh,$(lib_dirs)): libHh
endif
G3dVec: G3dOGL # Compile the shared files in G3dOGL first.
# (To make G3dVec without HH_OGLX, run "make -C ./progs/G3dVec".)
Filtervideo: VideoViewer # Compile shared files in VideoViewer first.
mostlyclean_dirs = $(foreach n,$(dirs+test),mostlyclean_$(n)) # Pseudo-dep. for "make -j mostlyclean" parallelism.
mostlyclean: $(mostlyclean_dirs)
$(mostlyclean_dirs):
$(MAKE) -C $(call dir_of,$(@:mostlyclean_%=%)) -s mostlyclean
clean_dirs = $(foreach n,$(dirs+test),clean_$(n)) # Pseudo-dependency to enable "make -j clean" parallelism.
clean: $(clean_dirs)
$(clean_dirs):
$(MAKE) -C $(call dir_of,$(@:clean_%=%)) -s clean
deepclean_dirs = $(foreach n,$(dirs+test),deepclean_$(n)) # Pseudo-dep. to enable "make -j deepclean" parallelism.
deepclean: $(deepclean_dirs)
$(deepclean_dirs):
$(MAKE) -C $(call dir_of,$(@:deepclean_%=%)) -s deepclean
depend_dirs = $(foreach n,$(dirs+test+all),depend_$(n)) # Pseudo-dep. to enable "make -j depend" parallelism.
depend: $(depend_dirs)
$(depend_dirs): # Enables "make -j" parallelism.
rm -f $(call dir_of,$(@:depend_%=%))/$(make_dep)
$(MAKE) -C $(call dir_of,$(@:depend_%=%)) $(make_dep)
debug:
# $(info LDLIBS=$(LDLIBS) value(LDLIBS)=$(value LDLIBS))
@echo 'PATH=$(PATH)'
@which $(CXX)
$(CXX) --version
env | grep -i -E 'gcc|cpath|include_path' || true
# Location of executable used for timing test.
rel_exe_dir = $(if $(CONFIG:win=),bin/$(CONFIG),bin/msbuild)# CONFIG=win instead uses release exe created by msbuild.
timingtest: Filterimage Filtervideo
# hhoppeg win: expect 0.40 sec, 7.5 sec
# hhoppeg mingw: expect 0.42 sec, 7.2 sec
# hhoppeg clang: expect 0.42 sec, 7.1 sec
# hhoppeg unix: expect 0.39 sec, 7.0 sec
@{ for i in {1..5}; do $(rel_exe_dir)/Filterimage -create 8192 8192 -scaletox 3000 -noo; done \
|& grep '(_scale:'; \
for i in {1..2}; do \
VIDEOLOOP_PRECISE=1 $(rel_exe_dir)/Filtervideo -create 215 1920 1080 -framerate 30 \
-end 7sec -start -6sec -trimend -1 \
-loadvlp ~/prevproj/2013/videoloops/data/ReallyFreakinAll/out/HDgiant_loop.downscaled.vlp \
-gdloop 5sec -noo |& grep '(_gdloop:'; \
done; } \
| awk '{ name = $$2; gsub(/[(_:]/, "", name); t = $$NF + 0; \
if (!(name in min)) names[++k] = name; \
if (!(name in min) || t < min[name]) min[name] = t; } \
END { line = "#"; \
for (i = 1; i <= k; i++) { name = names[i]; \
line = line sprintf(" [%s] min=%.2f", name, min[name]); } \
print line; \
if (k < 2) { print "timingtest: a measurement is missing." > "/dev/stderr"; exit 1; } }'
# GDLOOP_USE_VECTOR4=1 $(rel_exe_dir)/Filtervideo -create 215 1920 1080 -framerate 30 -end 7sec -start -5sec -trimend -1 -loadvlp ~/prevproj/2013/videoloops/data/ReallyFreakinAll/out/HDgiant_loop.vlp -gdloop 5sec -noo 2>&1 | grep '(_gdloop:'
phony_targets = all progs libs $(dirs+test) mostlyclean $(mostlyclean_dirs) clean $(clean_dirs) \
deepclean $(deepclean_dirs) depend $(depend_dirs) debug timingtest makeall cleanall debug_path
.PHONY: $(phony_targets)
$(check_goals)
endif # ifneq ($(CONFIG),all)