]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - build/Makefile.lib.inc
Generate list of GIO pin names
[pes-rpp/rpp-lib.git] / build / Makefile.lib.inc
index 16f265d6dc19dc0e014be200b0959734119ca7bb..c35a511ac2a3c09125ae0e3e99420c852b3e863b 100644 (file)
@@ -15,10 +15,28 @@ makefile_lib_inc_dir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
 all:: $(makefile_lib_inc_dir)/../rpp-lib.lib
 
 include ../Makefile.config
+
+# Check that Makefile.config defined values of all defined
+# TARGET_HAS_* variables and no more.
+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)))
+$(if $(target_has_extra),\
+       $(error Makefile.config contains supefluous variables: $(target_has_extra)))
+$(foreach name,$(target_has_list),$(if $(or $(filter y,$(TARGET_HAS_$(name))),$(filter n,$(TARGET_HAS_$(name)))),,\
+       $(error TARGET_HAS_$(name) must be 'y' or 'n')))
+
 include $(makefile_lib_inc_dir)/../Makefile.var
 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)
@@ -27,11 +45,12 @@ rpp_lib_DEPS = $(rpp_lib_OBJS:%=%.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_OBJS:%.obj=%.dep)
+-include $(rpp_lib_DEPS)
 
 $(rpp_lib_c_OBJS): %.obj: $(makefile_lib_inc_dir)/../%.c
        $(call mkdir,$(dir $@))
@@ -41,6 +60,11 @@ $(rpp_lib_asm_OBJS): %.obj: $(makefile_lib_inc_dir)/../%.asm
        $(call mkdir,$(dir $@))
        $(RPP_COMPILE_CMD)
 
+rpp/src/gio_names.txt: %: $(makefile_lib_inc_dir)/../%.tmpl
+       $(call mkdir,$(dir $@))
+       $(RPP_PREPROC_CMD)
+
+
 .PHONY: all clean $(makefile_lib_inc_dir)/../rpp-lib.lib
 
 clean::