1. Rename the top level /usr/share/ti/exmaples/timl/makefile to Makefile
[ti-machine-learning/ti-machine-learning.git] / src / database / makefile
1 ################################################################################
2 #
3 # makefile
4 #
5 # Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 #
11 #    Redistributions of source code must retain the above copyright
12 #    notice, this list of conditions and the following disclaimer.
13 #
14 #    Redistributions in binary form must reproduce the above copyright
15 #    notice, this list of conditions and the following disclaimer in the
16 #    documentation and/or other materials provided with the
17 #    distribution.
18 #
19 #    Neither the name of Texas Instruments Incorporated nor the names of
20 #    its contributors may be used to endorse or promote products derived
21 #    from this software without specific prior written permission.
22 #
23 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #
35 ################################################################################
37 C_INCLUDE_PATH = ../common/api ../common/cnn ../common/util \
38 /usr/include
39 C_INCLUDE_PATH_FLAG = $(foreach d, $(C_INCLUDE_PATH), -I$d)
40 C_LIB = timl blas jpeg m 
41 C_LIB_FLAG = $(foreach d, $(C_LIB), -l$d)
42 C_LIB_PATH = /usr/lib ../../bin
43 C_LIB_PATH_FLAG = $(foreach d, $(C_LIB_PATH), -L$d)
44 CC = gcc
45 CFLAGS += -g -O3 -fopenmp
47 CPPC = g++
50 AR = @ar
51 ARFLAGS = -rcs
52 RM = @rm
53 RMFLAGS += -fr
56 # APP CNN CLASS
57 APP_CNN_CLASS_BIN_CFILES = $(shell find ./cnn/class -name "*.c")
58 APP_CNN_CLASS_BIN_OBJS =  $(patsubst %.c, %.o, $(APP_CNN_CLASS_BIN_CFILES))
59 APP_CNN_CLASS_BINS =  $(patsubst %.c, %.bin, $(APP_CNN_CLASS_BIN_CFILES))
60 APP_CNN_CLASS_HFILES = $(shell find ./cnn/class -name "*.h")
62 # APP CNN SL
63 APP_CNN_SL_BIN_HFILES = $(shell find ./cnn/scene -name "*.h")
64 APP_CNN_SL_BIN_CFILES = $(shell find ./cnn/scene/sbd -name "*.c")
65 APP_CNN_SL_BIN_OBJS =  $(patsubst %.c, %.o, $(APP_CNN_SL_BIN_CFILES))
66 APP_CNN_SL_BINS =  $(patsubst %.c, %.bin, $(APP_CNN_SL_BIN_CFILES))
67 APP_CNN_SL_CFILES = $(shell find ./cnn/scene -name "*.c")
68 APP_CNN_SL_OBJS = $(patsubst %.c, %.o, $(APP_CNN_SL_CFILES))
69 APP_CNN_SL_AUX_OBJS = $(filter-out $(APP_CNN_SL_BIN_OBJS), $(APP_CNN_SL_OBJS))
71 # APP CNN INTEROP CAFFE
72 APP_CNN_INTEROP_CAFFE_BIN_CFILES = $(shell find ./cnn/interop/caffe -name "*.cpp")
73 APP_CNN_INTEROP_CAFFE_BIN_OBJS =  $(patsubst %.cpp, %.o, $(APP_CNN_INTEROP_CAFFE_BIN_CFILES))
74 APP_CNN_INTEROP_CAFFE_BINS = ./cnn/interop/caffe/appCNNInteropCaffe.bin
75 APP_CNN_INTEROP_CAFFE_HFILES = $(shell find ./cnn/interop/caffe -name "*.hpp")
77 # APP CNN CONVERT IMAGENET
78 APP_CNN_CONVERT_IMAGENET_BIN_CFILES = $(shell find ./cnn/convert/imagenet -name "*.cpp")
79 APP_CNN_CONVERT_IMAGENET_BIN_OBJS =  $(patsubst %.cpp, %.o, $(APP_CNN_CONVERT_IMAGENET_BIN_CFILES))
80 APP_CNN_CONVERT_IMAGENET_BINS = ./cnn/convert/imagenet/appCNNConvertImageNet.bin
81 APP_CNN_CONVERT_IMAGENET_HFILES = $(shell find ./cnn/convert/imagenet -name "*.hpp")
83 # APP CNN CONVERT SBD
84 APP_CNN_CONVERT_SBD_BIN_CFILES = $(shell find ./cnn/convert/sbd -name "*.cpp")
85 APP_CNN_CONVERT_SBD_BIN_OBJS =  $(patsubst %.cpp, %.o, $(APP_CNN_CONVERT_SBD_BIN_CFILES))
86 APP_CNN_CONVERT_SBD_BINS = ./cnn/convert/sbd/appCNNConvertSBD.bin
87 APP_CNN_CONVERT_SBD_HFILES = $(shell find ./cnn/convert/sbd -name "*.hpp")
90 APP_CNN_BINS = \
91 $(APP_CNN_CLASS_BINS) \
92 $(APP_CNN_SL_BINS) \
93 $(APP_CNN_CONVERT_IMAGENET_BINS) \
94 $(APP_CNN_CONVERT_SBD_BINS) \
95 $(APP_CNN_INTEROP_CAFFE_BINS)
97 APP_CNN_OBJS = \
98 $(APP_CNN_CLASS_BIN_OBJS) \
99 $(APP_CNN_SL_OBJS) \
100 $(APP_CNN_INTEROP_CAFFE_BIN_OBJS) \
101 $(APP_CNN_CONVERT_IMAGENET_BIN_OBJS) \
102 $(APP_CNN_CONVERT_SBD_BIN_OBJS)
104 all: $(APP_CNN_BINS)
106 clean:
107         $(RM) $(RMFLAGS) \
108         $(APP_CNN_OBJS) \
109         $(APP_CNN_BINS)
111 # appCNNClass bins
112 $(APP_CNN_CLASS_BINS): %.bin: %.o
113         $(CC) $(CFLAGS) -o $@ $^ \
114         $(C_LIB_FLAG) $(C_LIB_PATH_FLAG)
115         
116 # appCNNClass objs
117 $(APP_CNN_CLASS_BIN_OBJS): %.o: %.c $(APP_CNN_CLASS_HFILES)
118         $(CC) -c $(CFLAGS) -o $@ $< \
119         $(C_INCLUDE_PATH_FLAG)
120         
121 # appCNNScene bins
122 $(APP_CNN_SL_BINS): %.bin: %.o $(APP_CNN_SL_AUX_OBJS)
123         $(CC) $(CFLAGS) -o $@ $^ \
124         $(C_LIB_FLAG) $(C_LIB_PATH_FLAG)
126 # appCNNScene objs
127 $(APP_CNN_SL_OBJS): %.o: %.c $(APP_CNN_SL_HFILES)
128         $(CC) -c $(CFLAGS) -o $@ $< \
129         $(C_INCLUDE_PATH_FLAG)
131 # appCNNConvertImageNet bins 
132 $(APP_CNN_CONVERT_IMAGENET_BINS): $(APP_CNN_CONVERT_IMAGENET_BIN_OBJS)
133         $(CPPC) $(CFLAGS) -o $(APP_CNN_CONVERT_IMAGENET_BINS) $^ \
134         -lopencv_core -lopencv_highgui -lopencv_imgproc \
135         $(C_LIB_PATH_FLAG)
136         
137 # appCNNConvertImageNet objs
138 $(APP_CNN_CONVERT_IMAGENET_BIN_OBJS): %.o: %.cpp $(APP_CNN_CONVERT_IMAGENET_HFILES)
139         $(CPPC) -c $(CFLAGS) -o $@ $< \
140         $(C_INCLUDE_PATH_FLAG)
142 # appCNNConvertSBD bins 
143 $(APP_CNN_CONVERT_SBD_BINS): $(APP_CNN_CONVERT_SBD_BIN_OBJS)
144         $(CPPC) $(CPPFLAGS) -o $(APP_CNN_CONVERT_SBD_BINS) $^ \
145         -lopencv_core -lopencv_highgui -lopencv_imgproc \
146         $(C_LIB_PATH_FLAG)
147         
148 # appCNNConvertSBD objs
149 $(APP_CNN_CONVERT_SBD_BIN_OBJS): %.o: %.cpp $(APP_CNN_CONVERT_SBD_HFILES)
150         $(CPPC) -c $(CFLAGS) -o $@ $< \
151         $(C_INCLUDE_PATH_FLAG)
153 # appCNNInteropCaffe bins
154 $(APP_CNN_INTEROP_CAFFE_BINS): $(APP_CNN_INTEROP_CAFFE_BIN_OBJS)
155         $(CPPC) $(CFLAGS) -o $(APP_CNN_INTEROP_CAFFE_BINS) $^ \
156         -lprotobuf \
157         $(C_LIB_FLAG) $(C_LIB_PATH_FLAG)
159 # appCNNInteropCaffe objs
160 $(APP_CNN_INTEROP_CAFFE_BIN_OBJS): %.o: %.cpp $(APP_CNN_INTEROP_CAFFE_HFILES)
161         $(CPPC) -c $(CFLAGS) -o $@ $< \
162         $(C_INCLUDE_PATH_FLAG)