# Copyright (C) 2013-2015 Czech Technical University in Prague # # Authors: # - Michal Sojka # # This document contains proprietary information belonging to Czech # Technical University in Prague. Passing on and copying of this # document, and communication of its contents is not permitted # without prior written authorization. # # Rules for compiling rpp-lib.lib. 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) 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 $(call cp,$<,$@) $(call cp,$(call pathconv,../Makefile.config),$(dir $@)) -include $(rpp_lib_DEPS) $(rpp_lib_c_OBJS): %.obj: $(makefile_lib_inc_dir)/../%.c $(call mkdir,$(dir $@)) $(RPP_COMPILE_CMD) $(rpp_lib_asm_OBJS): %.obj: $(makefile_lib_inc_dir)/../%.asm $(call mkdir,$(dir $@)) $(RPP_COMPILE_CMD) .PHONY: all clean $(makefile_lib_inc_dir)/../rpp-lib.lib clean:: $(call rm,$(rpp_lib_OBJS) $(rpp_lib_DEPS) rpp-lib.lib)