ud3tn/mk/build.mk
Felix Walter e16ec4c579 Enable building a BPv7 decoder binary
This adds a target `data-decoder` which builds a binary to decode a
specified binary file using uD3TN's parsing logic (based on the CLA RX
subsystem) and print details about it. In this first version only the
decoding of BPv7 bundles is implemented.

This binary can be used, e.g., for fuzz testing.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-16 11:34:14 +02:00

92 lines
3 KiB
Makefile

include mk/toolchain.mk
# COMPONENTS
EXTERNAL_INCLUDES += -Iexternal/tinycbor/src \
-Iexternal/util/include
$(eval $(call addComponentWithRules,components/aap))
$(eval $(call addComponentWithRules,components/agents))
$(eval $(call addComponentWithRules,components/agents/$(PLATFORM)))
$(eval $(call addComponentWithRules,components/bundle6))
$(eval $(call addComponentWithRules,components/bundle7))
$(eval $(call addComponentWithRules,components/cla))
$(eval $(call addComponentWithRules,components/cla/$(PLATFORM)))
$(eval $(call addComponentWithRules,components/platform/$(PLATFORM)))
$(eval $(call addComponentWithRules,components/spp))
$(eval $(call addComponentWithRules,components/ud3tn))
TINYCBOR_SOURCES := \
cborerrorstrings.c \
cborencoder.c \
cborencoder_close_container_checked.c \
cborparser.c \
cborparser_dup_string.c \
cborpretty.c \
cborpretty_stdio.c \
cbortojson.c
$(eval $(call addComponentWithRules,external/tinycbor/src,$(TINYCBOR_SOURCES)))
$(eval $(call addComponentWithRules,external/util/src))
# LIB
$(eval $(call generateComponentRules,components/daemon))
$(eval $(call generateComponentRules,test/unit))
$(eval $(call generateComponentRules,test/decoder))
build/$(PLATFORM)/libud3tn.so: LIBS = $(LIBS_libud3tn.so)
build/$(PLATFORM)/libud3tn.so: $(LIBS_libud3tn.so) | build/$(PLATFORM)
$(call cmd,linklib)
# STATIC LIB
build/$(PLATFORM)/libud3tn.a: LIBS = $(LIBS_libud3tn.so)
build/$(PLATFORM)/libud3tn.a: $(LIBS_libud3tn.so) | build/$(PLATFORM)
$(call cmd,arcat)
# EXECUTABLE
$(eval $(call addComponent,ud3tn,components/daemon))
build/$(PLATFORM)/ud3tn: LIBS = $(LIBS_ud3tn)
build/$(PLATFORM)/ud3tn: $(LIBS_ud3tn) | build/$(PLATFORM)
$(call cmd,link)
# TEST EXECUTABLE
$(eval $(call generateComponentRules,external/unity/src))
$(eval $(call generateComponentRules,external/unity/extras/fixture/src))
$(eval $(call addComponent,testud3tn,external/unity/src))
$(eval $(call addComponent,testud3tn,external/unity/extras/fixture/src))
$(eval $(call addComponent,testud3tn,test/unit))
build/$(PLATFORM)/testud3tn: LDFLAGS += $(LDFLAGS_EXECUTABLE)
# 64 bit support has to be enabled first.
build/$(PLATFORM)/testud3tn: CPPFLAGS += -DUNITY_SUPPORT_64
build/$(PLATFORM)/testud3tn: EXTERNAL_INCLUDES += -Itest/unit
build/$(PLATFORM)/testud3tn: EXTERNAL_INCLUDES += -Iexternal/unity/src
build/$(PLATFORM)/testud3tn: EXTERNAL_INCLUDES += -Iexternal/unity/extras/fixture/src
build/$(PLATFORM)/testud3tn: LIBS = $(LIBS_testud3tn)
build/$(PLATFORM)/testud3tn: $(LIBS_testud3tn) | build/$(PLATFORM)
$(call cmd,link)
# DECODER EXECUTABLE
$(eval $(call addComponent,ud3tndecode,test/decoder))
build/$(PLATFORM)/ud3tndecode: build/$(PLATFORM)/libud3tn.a
build/$(PLATFORM)/ud3tndecode: LDFLAGS += $(LDFLAGS_EXECUTABLE)
build/$(PLATFORM)/ud3tndecode: LIBS = $(LIBS_ud3tndecode) build/$(PLATFORM)/libud3tn.a
build/$(PLATFORM)/ud3tndecode: $(LIBS_ud3tndecode) | build/$(PLATFORM)
$(call cmd,link)
# GENERAL RULES
build/$(PLATFORM): | build
$(call cmd,mkdir)
build:
$(call cmd,mkdir)