Makefile.inc 14.2 KB
Newer Older
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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210

INCLUDES += \
 -I$(MAKEFILE_DIR)/downloads/kissfft

GENERATED_PROJECT_INCLUDES += \
-I./third_party/kissfft

PROJECT_INCLUDES += \
third_party/kissfft

KISSFFT_LIB_SRCS := \
$(MAKEFILE_DIR)/downloads/kissfft/kiss_fft.c \
$(MAKEFILE_DIR)/downloads/kissfft/tools/kiss_fftr.c

KISSFFT_LIB_HDRS := \
$(MAKEFILE_DIR)/downloads/kissfft/COPYING \
$(MAKEFILE_DIR)/downloads/kissfft/kiss_fft.h \
$(MAKEFILE_DIR)/downloads/kissfft/_kiss_fft_guts.h \
$(MAKEFILE_DIR)/downloads/kissfft/tools/kiss_fftr.h

$(eval $(call add_third_party_download,$(KISSFFT_URL),$(KISSFFT_MD5),kissfft,patch_kissfft))

THIRD_PARTY_CC_HDRS += \
third_party/kissfft/COPYING \
third_party/kissfft/kiss_fft.h \
third_party/kissfft/_kiss_fft_guts.h \
third_party/kissfft/tools/kiss_fftr.h

MICRO_SPEECH_TEST_SRCS := \
tensorflow/lite/micro/examples/micro_speech/micro_speech_test.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.cc

MICRO_SPEECH_TEST_HDRS := \
tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.h \
tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.h \

SIMPLE_FEATURES_GENERATOR_TEST_SRCS := \
tensorflow/lite/micro/examples/micro_speech/simple_features/simple_features_generator.cc \
tensorflow/lite/micro/examples/micro_speech/simple_features/simple_features_generator_test.cc \
tensorflow/lite/micro/examples/micro_speech/simple_features/no_power_spectrum_data.cc \
tensorflow/lite/micro/examples/micro_speech/simple_features/yes_power_spectrum_data.cc

SIMPLE_FEATURES_GENERATOR_TEST_HDRS := \
tensorflow/lite/micro/examples/micro_speech/simple_features/simple_model_settings.h \
tensorflow/lite/micro/examples/micro_speech/simple_features/simple_features_generator.h \
tensorflow/lite/micro/examples/micro_speech/simple_features/no_power_spectrum_data.h \
tensorflow/lite/micro/examples/micro_speech/simple_features/yes_power_spectrum_data.h

MICRO_FEATURES_LIB_SRCS := \
tensorflow/lite/experimental/microfrontend/lib/fft.cc \
tensorflow/lite/experimental/microfrontend/lib/fft_util.cc \
tensorflow/lite/experimental/microfrontend/lib/filterbank.c \
tensorflow/lite/experimental/microfrontend/lib/filterbank_util.c \
tensorflow/lite/experimental/microfrontend/lib/frontend.c \
tensorflow/lite/experimental/microfrontend/lib/frontend_util.c \
tensorflow/lite/experimental/microfrontend/lib/log_lut.c \
tensorflow/lite/experimental/microfrontend/lib/log_scale.c \
tensorflow/lite/experimental/microfrontend/lib/log_scale_util.c \
tensorflow/lite/experimental/microfrontend/lib/noise_reduction.c \
tensorflow/lite/experimental/microfrontend/lib/noise_reduction_util.c \
tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control.c \
tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_util.c \
tensorflow/lite/experimental/microfrontend/lib/window.c \
tensorflow/lite/experimental/microfrontend/lib/window_util.c \
$(KISSFFT_LIB_SRCS)

MICRO_FEATURES_LIB_HDRS := \
tensorflow/lite/experimental/microfrontend/lib/bits.h \
tensorflow/lite/experimental/microfrontend/lib/fft.h \
tensorflow/lite/experimental/microfrontend/lib/fft_util.h \
tensorflow/lite/experimental/microfrontend/lib/filterbank.h \
tensorflow/lite/experimental/microfrontend/lib/filterbank_util.h \
tensorflow/lite/experimental/microfrontend/lib/frontend.h \
tensorflow/lite/experimental/microfrontend/lib/frontend_util.h \
tensorflow/lite/experimental/microfrontend/lib/log_lut.h \
tensorflow/lite/experimental/microfrontend/lib/log_scale.h \
tensorflow/lite/experimental/microfrontend/lib/log_scale_util.h \
tensorflow/lite/experimental/microfrontend/lib/noise_reduction.h \
tensorflow/lite/experimental/microfrontend/lib/noise_reduction_util.h \
tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control.h \
tensorflow/lite/experimental/microfrontend/lib/pcan_gain_control_util.h \
tensorflow/lite/experimental/microfrontend/lib/window.h \
tensorflow/lite/experimental/microfrontend/lib/window_util.h \
$(KISSFFT_LIB_HDRS)

MICRO_FEATURES_GENERATOR_SRCS := \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_features_generator.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.cc \
$(MICRO_FEATURES_LIB_SRCS)

MICRO_FEATURES_GENERATOR_HDRS := \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_features_generator.h \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h \
$(MICRO_FEATURES_LIB_HDRS)

MICRO_FEATURES_GENERATOR_TEST_SRCS := \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_features_generator_test.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/no_feature_data_slice.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/yes_feature_data_slice.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)

MICRO_FEATURES_GENERATOR_TEST_HDRS := \
tensorflow/lite/micro/examples/micro_speech/micro_features/no_feature_data_slice.h \
tensorflow/lite/micro/examples/micro_speech/micro_features/yes_feature_data_slice.h \
$(MICRO_FEATURES_GENERATOR_HDRS)

AUDIO_PROVIDER_TEST_SRCS := \
tensorflow/lite/micro/examples/micro_speech/audio_provider_test.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.cc \
tensorflow/lite/micro/examples/micro_speech/audio_provider.cc

AUDIO_PROVIDER_TEST_HDRS := \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h \
tensorflow/lite/micro/examples/micro_speech/audio_provider.h \

AUDIO_PROVIDER_MOCK_TEST_SRCS := \
tensorflow/lite/micro/examples/micro_speech/audio_provider_mock_test.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.cc \
tensorflow/lite/micro/examples/micro_speech/audio_provider_mock.cc

AUDIO_PROVIDER_MOCK_TEST_HDRS := \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h \
tensorflow/lite/micro/examples/micro_speech/audio_provider.h \

FEATURE_PROVIDER_TEST_SRCS := \
tensorflow/lite/micro/examples/micro_speech/feature_provider_test.cc \
tensorflow/lite/micro/examples/micro_speech/audio_provider.cc \
tensorflow/lite/micro/examples/micro_speech/feature_provider.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)

FEATURE_PROVIDER_TEST_HDRS := \
tensorflow/lite/micro/examples/micro_speech/audio_provider.h \
tensorflow/lite/micro/examples/micro_speech/feature_provider.h \
$(MICRO_FEATURES_GENERATOR_HDRS)

FEATURE_PROVIDER_MOCK_TEST_SRCS := \
tensorflow/lite/micro/examples/micro_speech/feature_provider_test.cc \
tensorflow/lite/micro/examples/micro_speech/audio_provider_mock.cc \
tensorflow/lite/micro/examples/micro_speech/feature_provider.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)

FEATURE_PROVIDER_MOCK_TEST_HDRS := \
tensorflow/lite/micro/examples/micro_speech/audio_provider.h \
tensorflow/lite/micro/examples/micro_speech/feature_provider.h \
tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.h \
tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.h \
$(MICRO_FEATURES_GENERATOR_HDRS)

RECOGNIZE_COMMANDS_TEST_SRCS := \
tensorflow/lite/micro/examples/micro_speech/recognize_commands_test.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.cc \
tensorflow/lite/micro/examples/micro_speech/recognize_commands.cc

RECOGNIZE_COMMANDS_TEST_HDRS := \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h \
tensorflow/lite/micro/examples/micro_speech/recognize_commands.h

COMMAND_RESPONDER_TEST_SRCS := \
tensorflow/lite/micro/examples/micro_speech/command_responder_test.cc \
tensorflow/lite/micro/examples/micro_speech/command_responder.cc

COMMAND_RESPONDER_TEST_HDRS := \
tensorflow/lite/micro/examples/micro_speech/command_responder.h

MICRO_SPEECH_SRCS := \
tensorflow/lite/micro/examples/micro_speech/main.cc \
tensorflow/lite/micro/examples/micro_speech/main_functions.cc \
tensorflow/lite/micro/examples/micro_speech/audio_provider.cc \
tensorflow/lite/micro/examples/micro_speech/feature_provider.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.cc \
tensorflow/lite/micro/examples/micro_speech/recognize_commands.cc \
tensorflow/lite/micro/examples/micro_speech/command_responder.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)

MICRO_SPEECH_HDRS := \
tensorflow/lite/micro/examples/micro_speech/audio_provider.h \
tensorflow/lite/micro/examples/micro_speech/feature_provider.h \
tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.h \
tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.h \
tensorflow/lite/micro/examples/micro_speech/recognize_commands.h \
tensorflow/lite/micro/examples/micro_speech/command_responder.h \
tensorflow/lite/micro/examples/micro_speech/main_functions.h \
$(MICRO_FEATURES_GENERATOR_HDRS)

MICRO_SPEECH_MOCK_SRCS := \
tensorflow/lite/micro/examples/micro_speech/main.cc \
tensorflow/lite/micro/examples/micro_speech/main_functions.cc \
tensorflow/lite/micro/examples/micro_speech/audio_provider_mock.cc \
tensorflow/lite/micro/examples/micro_speech/feature_provider.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.cc \
tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.cc \
tensorflow/lite/micro/examples/micro_speech/recognize_commands.cc \
tensorflow/lite/micro/examples/micro_speech/command_responder.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)

MICRO_SPEECH_MOCK_HDRS := \
tensorflow/lite/micro/examples/micro_speech/audio_provider.h \
tensorflow/lite/micro/examples/micro_speech/feature_provider.h \
tensorflow/lite/micro/examples/micro_speech/micro_features/micro_features_generator.h \
tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.h \
tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.h \
tensorflow/lite/micro/examples/micro_speech/recognize_commands.h \
tensorflow/lite/micro/examples/micro_speech/command_responder.h \
tensorflow/lite/micro/examples/micro_speech/main_functions.h \
$(MICRO_FEATURES_GENERATOR_HDRS)

211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
MICRO_SPEECH_GENERATOR_INPUTS := \
tensorflow/lite/micro/examples/micro_speech/micro_speech.tflite \
tensorflow/lite/micro/examples/micro_speech/testdata/no_1000ms.wav \
tensorflow/lite/micro/examples/micro_speech/testdata/no_30ms.wav \
tensorflow/lite/micro/examples/micro_speech/testdata/yes_1000ms.wav \
tensorflow/lite/micro/examples/micro_speech/testdata/yes_30ms.wav

MICRO_SPEECH_GENERATED_SRCS := \
$(GENERATED_SRCS_DIR)tensorflow/lite/micro/examples/micro_speech/micro_speech_model_data.cc \
$(GENERATED_SRCS_DIR)tensorflow/lite/micro/examples/micro_speech/testdata/no_1000ms_audio_data.cc \
$(GENERATED_SRCS_DIR)tensorflow/lite/micro/examples/micro_speech/testdata/no_30ms_audio_data.cc \
$(GENERATED_SRCS_DIR)tensorflow/lite/micro/examples/micro_speech/testdata/yes_1000ms_audio_data.cc \
$(GENERATED_SRCS_DIR)tensorflow/lite/micro/examples/micro_speech/testdata/yes_30ms_audio_data.cc

MICRO_SPEECH_GENERATED_HDRS := \
$(GENERATED_SRCS_DIR)tensorflow/lite/micro/examples/micro_speech/micro_speech_model_data.h \
$(GENERATED_SRCS_DIR)tensorflow/lite/micro/examples/micro_speech/testdata/no_1000ms_audio_data.h \
$(GENERATED_SRCS_DIR)tensorflow/lite/micro/examples/micro_speech/testdata/no_30ms_audio_data.h \
$(GENERATED_SRCS_DIR)tensorflow/lite/micro/examples/micro_speech/testdata/yes_1000ms_audio_data.h \
$(GENERATED_SRCS_DIR)tensorflow/lite/micro/examples/micro_speech/testdata/yes_30ms_audio_data.h

232 233 234 235 236 237 238 239 240
#Find any platform - specific rules for this example.
include $(wildcard tensorflow/lite/micro/examples/micro_speech/*/Makefile.inc)

# TODO(b/161489252): Disabling warnings for this example until we have a better
# way to build third_party code with a reduced list of CFLAGS.
CCFLAGS := $(filter-out $(CC_WARNINGS),$(CCFLAGS))

# Test the code for feature generation.
$(eval $(call microlite_test,micro_features_generator_test,\
241
$(MICRO_FEATURES_GENERATOR_TEST_SRCS),$(MICRO_FEATURES_GENERATOR_TEST_HDRS),$(MICRO_SPEECH_GENERATOR_INPUTS)))
242 243 244

# Tests loading and running a speech model.
$(eval $(call microlite_test,micro_speech_test,\
245
$(MICRO_SPEECH_TEST_SRCS),$(MICRO_SPEECH_TEST_HDRS),$(MICRO_SPEECH_GENERATOR_INPUTS)))
246 247 248

# Test the code for feature generation.
$(eval $(call microlite_test,simple_features_generator_test,\
249
$(SIMPLE_FEATURES_GENERATOR_TEST_SRCS),$(SIMPLE_FEATURES_GENERATOR_TEST_HDRS),$(MICRO_SPEECH_GENERATOR_INPUTS)))
250 251 252 253 254 255 256

# Tests the audio provider module.
$(eval $(call microlite_test,audio_provider_test,\
$(AUDIO_PROVIDER_TEST_SRCS),$(AUDIO_PROVIDER_TEST_HDRS)))

# Tests the audio provider mock module.
$(eval $(call microlite_test,audio_provider_mock_test,\
257
$(AUDIO_PROVIDER_MOCK_TEST_SRCS),$(AUDIO_PROVIDER_MOCK_TEST_HDRS),$(MICRO_SPEECH_GENERATOR_INPUTS)))
258

259 260 261 262 263 264
# Tests the feature provider module.
$(eval $(call microlite_test,feature_provider_test,\
$(FEATURE_PROVIDER_TEST_SRCS),$(FEATURE_PROVIDER_TEST_HDRS)))

# Tests the feature provider module using the mock audio provider.
$(eval $(call microlite_test,feature_provider_mock_test,\
265
$(FEATURE_PROVIDER_MOCK_TEST_SRCS),$(FEATURE_PROVIDER_MOCK_TEST_HDRS),$(MICRO_SPEECH_GENERATOR_INPUTS)))
266

267 268 269 270 271 272 273 274 275 276
# Tests the command recognizer module.
$(eval $(call microlite_test,recognize_commands_test,\
$(RECOGNIZE_COMMANDS_TEST_SRCS),$(RECOGNIZE_COMMANDS_TEST_HDRS)))

# Tests responding to a command.
$(eval $(call microlite_test,command_responder_test,\
$(COMMAND_RESPONDER_TEST_SRCS),$(COMMAND_RESPONDER_TEST_HDRS)))

# Builds a standalone speech command recognizer binary.
$(eval $(call microlite_test,micro_speech,\
277
$(MICRO_SPEECH_SRCS),$(MICRO_SPEECH_HDRS),$(MICRO_SPEECH_GENERATOR_INPUTS)))
278 279 280

# Builds a standalone speech command recognizer binary using fake audio input.
$(eval $(call microlite_test,micro_speech_mock,\
281 282 283 284 285
$(MICRO_SPEECH_MOCK_SRCS),$(MICRO_SPEECH_MOCK_HDRS),$(MICRO_SPEECH_GENERATOR_INPUTS)))

# Add sources and headers generated from $(MICRO_SPEECH_GENERATOR_INPUTS).
MICRO_SPEECH_SRCS += $(MICRO_SPEECH_GENERATED_SRCS)
MICRO_SPEECH_HDRS += $(MICRO_SPEECH_GENERATED_HDRS)
D
David Davis 已提交
286 287 288 289 290 291

list_micro_speech_example_sources:
	@echo $(MICRO_SPEECH_SRCS)

list_micro_speech_example_headers:
	@echo $(MICRO_SPEECH_HDRS)