-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
91 lines (80 loc) · 3.5 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
87
88
89
90
91
#------------------------------------------------------------------------------#
#
# VARIABLES
#
#------------------------------------------------------------------------------#
CXXFLAGS = -O2 -Wall -fmessage-length=0
MXX = mex
MEXEXT = $(shell mexext)
MXXFLAGS = -I/Applications/matlab/extern/include
ARCHIVENAME = kdtree
EXEEXT = exe
#------------------------------------------------------------------------------#
#
# WHICH COMPONENTS WILL BE BUILT?
# Could also use: #TARGETS = $(wildcard cpp/*.cpp)
#------------------------------------------------------------------------------#
TARGET += kdtree_build
TARGET += kdtree_delete
TARGET += kdtree_nearest_neighbor
TARGET += kdtree_k_nearest_neighbors
TARGET += kdtree_ball_query
TARGET += kdtree_range_query
TARGET += kdtree_print
TARGET += kdtree_load
TARGET += kdtree_save
#EXETARGET = $(TARGET:%=%.$(EXEEXT))
MEXTARGET = $(TARGET:%=%.$(MEXEXT))
#------------------------------------------------------------------------------#
#
# DEPENDENCY RULES
#
# Makefiles rules
# anything (%) that terminates in .bin for which an explicit rule is not
# available is made dependable on the file which has same name but .cpp
# extension. The compiler (CXX) with options (CXXFLAGS) is called on each of
# the elements that trigger the rule ($@, which is left side of ":") and
# produces an output with filename expressed by the "first" of elements from
# which it depends ($< or right side of ":")
#------------------------------------------------------------------------------#
HDRS = KDTree.h MyHeaps.h
#--- Default rule (called when you just "make")
mex: $(MEXTARGET)
all: $(EXETARGET) $(MEXTARGET)
#--- Compiles in debug mode
debug: CXXFLAGS += -g -D DEBUG
debug: all
#--- Compile CPP examples
%.$(EXEEXT) : cpp/%.cpp $(HDRS)
$(CXX) $(CXXFLAGS) -I./ -o ../build/$@ $<
##--- Compile MEX toolbox
%.$(MEXEXT) : %.cpp $(HDRS)
$(MXX) $(MXXFLAGS) -I./ -o $@ $<
##--- Clean steps
clean:
@rm -vf ../toolbox/*.$(MEXEXT)
@rm -vf ../build/*.$(EXEEXT)
@rm -vrf *.dSYM
@echo "---------- CLEAN COMPLETED ---------"
#------------------------------------------------------------------------------#
#
# CREATE A DISTRIBUTION IN A ZIP FILE
#
# move resources to a kdtree folder, tar them, then remove the temp directory
# and its content completely
#------------------------------------------------------------------------------#
dist:
rm -rf $(ARCHIVENAME)
mkdir $(ARCHIVENAME)
cp *.mexmaci $(ARCHIVENAME)
cp *.m $(ARCHIVENAME)
cp -L *.h $(ARCHIVENAME)
cp *.cpp $(ARCHIVENAME)
cp CHANGES $(ARCHIVENAME)
cp TODO $(ARCHIVENAME)
cp README $(ARCHIVENAME)
cp Makefile $(ARCHIVENAME)
#tar -cvf $(ARCHIVENAME).tar.gz $(ARCHIVENAME)
zip -r -v ${ARCHIVENAME}.zip ${ARCHIVENAME}
rm -rf $(ARCHIVENAME)
echo $(VAR)