[DJI] SBUS Fast protocol
[inav.git] / make / settings.mk
blobc73ff2e690acd946a321944ed2c2f621c0ef6538
1 # Settings generator
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)
22 settings-json:
23 $(V0) CPP_PATH="$(ARM_SDK_DIR)/bin" CFLAGS="$(CFLAGS)" TARGET=$(TARGET) ruby $(SETTINGS_GENERATOR) . $(SETTINGS_FILE) --json settings.json
25 clean-settings:
26 $(V1) $(RM) $(GENERATED_SETTINGS)