# Check that Makefile.config defined values of all defined
# TARGET_HAS_* variables and no more.
-target_has_list = DMM
+target_has_list = DMM SPI
$(foreach name,$(target_has_list),$(if $(filter TARGET_HAS_$(name),$(.VARIABLES)),,\
$(error TARGET_HAS_$(name) not defined in Makefile.config)))
target_has_extra = $(filter-out $(target_has_list:%=TARGET_HAS_%),$(filter TARGET_HAS_%,$(.VARIABLES)))
include $(makefile_lib_inc_dir)/../common.mk
include $(makefile_lib_inc_dir)/Makefile.rules
+ifeq ($(rpp_lib_DEBUG),1)
+RPP_CFLAGS += -g -O0
+else
+RPP_CFLAGS += -O2 -DNDEBUG
+endif
+
rpp_lib_c_OBJS = $(addsuffix .obj,$(basename $(filter %.c, $(rpp_lib_SOURCES))))
rpp_lib_asm_OBJS = $(addsuffix .obj,$(basename $(filter %.asm, $(rpp_lib_SOURCES))))
rpp_lib_OBJS = $(rpp_lib_c_OBJS) $(rpp_lib_asm_OBJS)
-rpp_lib_DEPS = $(rpp_lib_OBJS:%=%.dep)
+rpp_lib_DEPS = $(rpp_lib_OBJS:%=%.dep) rpp/src/gio_names.txt.dep
rpp-lib.lib: $(rpp_lib_OBJS) #../rpp/TMS570LS313xFlashLnk.cmd
$(AR) r $@ $^
-$(makefile_lib_inc_dir)/../rpp-lib.lib: rpp-lib.lib
+$(makefile_lib_inc_dir)/../rpp-lib.lib: rpp-lib.lib rpp/src/gio_names.txt
$(call cp,$<,$@)
$(call cp,$(call pathconv,../Makefile.config),$(dir $@))
+ $(call cp,$(call pathconv,rpp/src/gio_names.txt),$(makefile_lib_inc_dir))
-include $(rpp_lib_DEPS)
$(call mkdir,$(dir $@))
$(RPP_COMPILE_CMD)
+rpp/src/gio_names.txt: %: $(makefile_lib_inc_dir)/../%.tmpl
+ $(call mkdir,$(dir $@))
+ $(RPP_PREPROC_CMD)
+
+# Work around TI compiler bug in dependency generation - it always
+# adds .obj even if the output file lacks this extension.
+rpp/src/gio_names.txt: rpp/src/gio_names.txt.obj
+rpp/src/gio_names.txt.obj:
+ $(call mkdir,$(dir $@))
+ echo xxx > $(call pathconv,$@)
+
.PHONY: all clean $(makefile_lib_inc_dir)/../rpp-lib.lib
clean::