2 .PHONY
: settings clean-settings
3 UTILS_DIR
= $(ROOT
)/src
/utils
4 SETTINGS_GENERATOR
= $(UTILS_DIR
)/settings.rb
6 GENERATED_SETTINGS
= $(TARGET_OBJ_DIR
)/settings_generated.h
$(TARGET_OBJ_DIR
)/settings_generated.c
7 SETTINGS_FILE
= $(SRC_DIR
)/fc/settings.yaml
8 GENERATED_FILES
= $(GENERATED_SETTINGS
)
9 $(GENERATED_SETTINGS
): $(SETTINGS_GENERATOR
) $(SETTINGS_FILE
) $(STAMP
)
11 CLEAN_ARTIFACTS
+= $(GENERATED_SETTINGS
)
13 # Make sure the generated files are in the include path
14 CFLAGS
+= -I
$(TARGET_OBJ_DIR
)
16 # Use a pattern rule, since they're different than normal rules.
17 # See https://www.gnu.org/software/make/manual/make.html#Pattern-Examples
18 %generated.h
%generated.c
:
19 $(V1
) echo
"settings.yaml -> settings_generated.h, settings_generated.c" "$(STDOUT)"
20 $(V1
) CPP_PATH
="$(ARM_SDK_DIR)/bin" CFLAGS
="$(CFLAGS)" TARGET
=$(TARGET
) ruby
$(SETTINGS_GENERATOR
) .
$(SETTINGS_FILE
) -o
$(TARGET_OBJ_DIR
)
23 $(V0
) CPP_PATH
="$(ARM_SDK_DIR)/bin" CFLAGS
="$(CFLAGS)" TARGET
=$(TARGET
) ruby
$(SETTINGS_GENERATOR
) .
$(SETTINGS_FILE
) --json settings.json
26 $(V1
) $(RM
) $(GENERATED_SETTINGS
)