Generate USB Strings from apps/*/usb_strings.txt files at compile time

This way we can skip the manually-crafted USB string definitions in the
dfu_desc.c and usb.c files.
This commit is contained in:
Harald Welte
2017-03-05 10:16:25 +01:00
parent 1405100dff
commit 2363fa0327
6 changed files with 27 additions and 301 deletions

View File

@@ -139,6 +139,7 @@ INCLUDES += -Ilibboard/common/include -Ilibboard/$(BOARD)/include
INCLUDES += -Ilibcommon/include
INCLUDES += -Ilibosmocore/include
INCLUDES += -Isrc_simtrace -Iinclude
INCLUDES += -Iapps/$(APP)
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wimplicit-int #-Wformat=2
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
@@ -179,11 +180,17 @@ OUTPUT := $(BIN)/$(OUTPUT)
# Rules
#-------------------------------------------------------------------------------
all: $(BIN) $(OBJ) $(MEMORIES)
all: apps/$(APP)/usb_strings_generated.h $(BIN) $(OBJ) $(MEMORIES)
$(BIN) $(OBJ):
mkdir $@
usbstring/usbstring: usbstring/usbstring.c
gcc $^ -o $@
apps/$(APP)/usb_strings_generated.h: apps/$(APP)/usb_strings.txt usbstring/usbstring
cat $< | usbstring/usbstring > $@
define RULES
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))