assets.mk 1.9 KB

1234567891011121314151617181920212223242526272829303132
  1. ASSETS_DIR := $(PROJECT_ROOT)/assets
  2. ASSETS_COMPILER := $(PROJECT_ROOT)/scripts/assets.py
  3. ASSETS_COMPILED_DIR := $(ASSETS_DIR)/compiled
  4. ASSETS_SOURCE_DIR := $(ASSETS_DIR)/icons
  5. ASSETS_SOURCES += $(shell find $(ASSETS_SOURCE_DIR) -type f -iname '*.png' -or -iname 'frame_rate')
  6. ASSETS += $(ASSETS_COMPILED_DIR)/assets_icons.c
  7. RESOURCES_DIR := $(ASSETS_DIR)/resources
  8. RESOURCES_MANIFEST := $(RESOURCES_DIR)/Manifest
  9. RESOURCES_FILES := $(shell find $(RESOURCES_DIR) ! -name Manifest -type f)
  10. DOLPHIN_SOURCE_DIR := $(ASSETS_DIR)/dolphin
  11. DOLPHIN_INTERNAL_OUTPUT_DIR := $(ASSETS_COMPILED_DIR)
  12. DOLPHIN_EXTERNAL_OUTPUT_DIR := $(ASSETS_DIR)/resources/dolphin
  13. PROTOBUF_SOURCE_DIR := $(ASSETS_DIR)/protobuf
  14. PROTOBUF_COMPILER := $(PROJECT_ROOT)/lib/nanopb/generator/nanopb_generator.py
  15. PROTOBUF_COMPILED_DIR := $(ASSETS_COMPILED_DIR)
  16. PROTOBUF_SOURCES := $(shell find $(PROTOBUF_SOURCE_DIR) -type f -iname '*.proto')
  17. PROTOBUF_FILENAMES := $(notdir $(addsuffix .pb.c,$(basename $(PROTOBUF_SOURCES))))
  18. PROTOBUF := $(addprefix $(PROTOBUF_COMPILED_DIR)/,$(PROTOBUF_FILENAMES)) $(PROTOBUF_COMPILED_DIR)/protobuf_version.h
  19. PROTOBUF_VERSION := $(shell git -C $(PROTOBUF_SOURCE_DIR) fetch --tags 2>/dev/null ; git -C $(PROTOBUF_SOURCE_DIR) describe --tags --abbrev=0 2>/dev/null || echo 'unknown')
  20. PROTOBUF_MAJOR_VERSION := $(word 1,$(subst ., ,$(PROTOBUF_VERSION)))
  21. PROTOBUF_MINOR_VERSION := $(word 2,$(subst ., ,$(PROTOBUF_VERSION)))
  22. $(if $(PROTOBUF_MAJOR_VERSION),,$(error "Protobuf major version is not specified, $$PROTOBUF_VERSION=$(PROTOBUF_VERSION), please perform git fetch in assets/protobuf directory"))
  23. $(if $(PROTOBUF_MINOR_VERSION),,$(error "Protobuf minor version is not specified, $$PROTOBUF_VERSION=$(PROTOBUF_VERSION), please perform git fetch in assets/protobuf directory"))
  24. PROTOBUF_CFLAGS += -DPB_ENABLE_MALLOC
  25. CFLAGS += -I$(ASSETS_COMPILED_DIR) $(PROTOBUF_CFLAGS)
  26. C_SOURCES += $(wildcard $(ASSETS_COMPILED_DIR)/*.c)