https://bitbucket.org/hudson/magic-lantern
Raw File
Tip revision: 7f812755c8947c3de2700b224a9cfc700d1c37cf authored by a1ex on 30 September 2015, 18:09:25 UTC
Close branch cr2hdr-20bit
Tip revision: 7f81275
Makefile.setup
# Generic makefile
# Include default and user-customized options where needed
# If you want to customize them copy Makefile.user.default to Makefile.user keeping only the options that you want to customize

include $(TOP_DIR)/Makefile.top

-include $(TOP_DIR)/Makefile.user.default

-include $(TOP_DIR)/Makefile.user


ifeq ($(CONFIG_CCACHE), y)
    CC := $(CCACHE) $(CC)
    HOST_CC := $(CCACHE) $(CC)
endif	

# Quiet the build process
build = \
	@if [ X"$V" = X"1" ]; then \
		echo '$2'; \
	else \
		printf "[ %-8s ]   %s\n"  $1 $@; \
	fi; \
	$2

define rm_files
	@printf "[ RM ] %s\n" "$1";
	@$(RM) -f $1
endef

define rm_dir
	@printf "[ RM dir ] %s\n" "$1";
	@-$(RM) -rf $1
endef


FLAGS=\
	-Wp,-MMD,$(patsubst %.o,%.d,$(dir $@)$(notdir $@)) \
	-Wp,-MT,$@ \
	-nostdlib \
	-fomit-frame-pointer \
	-fno-strict-aliasing \
	-I$(TOP_DIR)/include

TARGET_COMPILER ?= arm-gcc

CFLAGS =

ifeq ($(TARGET_COMPILER), arm-gcc)
	CFLAGS += -Os -mthumb-interwork -march=armv5te \
				-D__ARM__
endif

CFLAGS +=\
	$(FLAGS) \
	-Wall \
	-Wextra \
	-Wno-unused-parameter \
	-Wno-unused-function \
	-Werror-implicit-function-declaration \
	-Wno-missing-field-initializers \
	-Wno-format \
	-Wdouble-promotion \
	-ffast-math \
	-fsingle-precision-constant \
	-fshort-double \
	-fno-builtin-printf \
	-std=gnu99 \
	-Winline \
	-I$(PLATFORM_INC) \
	-I$(PLATFORM_INC)/include \
	-I$(SRC_DIR) \
	-I$(PICOC_PATH) \


NOT_USED_FLAGS=\
	-march=armv5te \
	-msoft-float

AFLAGS=\
	$(FLAGS)
    
-LFLAGS=

ifdef CONFIG_SMALL_FONTS
$(error CONFIG_SMALL_FONTS must be renamed to ML_SRC_SMALL_FONTS)
endif

ensureCorrectValue = $(if $(filter $($(1)),y n 1 0), ,$(1)=n $(warning BAD VALUE FOR $(1)=$($(1)) DEFAULTING TO n))
_defined_configs = $(filter CONFIG_%, $(.VARIABLES))
$(foreach config, $(_defined_configs), $(eval $(call ensureCorrectValue,$(config))))
# Functionality that disables all CONFIG_* entries
ifeq ($(ML_SETUP_DISABLE_USER_CONFIGS),y)
#show_config_values=$(foreach c, $(defined_configs), $(c)=$($(c)))
#$(warning before setting to NO $(show_config_values))
$(foreach config, $(_defined_configs), $(eval $(config)=n))
#$(warning after setting to NO $(show_config_values))
endif

-include Makefile.setup.default

-include Makefile.setup.user

ifdef ML_SETUP_EXTENSION
-include Makefile.$(ML_SETUP_EXTENSION).default

-include Makefile.$(ML_SETUP_EXTENSION).user
endif

$(foreach entry, $(_defined_configs), $(eval _CONFIGS-with-$($(entry))+= $(entry)))
# List of defined configs
ML_SETUP_ENABLED_CONFIGS = $(_CONFIGS-with-y)

# List of configs (CONFIG_%) which also have (%_DIR) variable defined
$(foreach entry, $(ML_SETUP_ENABLED_CONFIGS), $(eval _CONFIGS-with-dir-$(origin $(patsubst CONFIG_%,%,$(entry))_DIR)+= $(entry)))
ML_SETUP_CONFIGS_WITH_DIR = $(_CONFIGS-with-dir-file)

CFLAGS += $(CFLAG_USER)
FLAGS += $(LFLAG_USER)
AFLAGS += $(AFLAG_USER)
back to top