https://bitbucket.org/hudson/magic-lantern
Revision 2b3958881186ead2c50055cd610f98b1bcc1dce9 authored by alex@thinkpad on 02 July 2018, 21:33:48 UTC, committed by alex@thinkpad on 02 July 2018, 21:33:48 UTC
1 parent 06e223e
Raw File
Tip revision: 2b3958881186ead2c50055cd610f98b1bcc1dce9 authored by alex@thinkpad on 02 July 2018, 21:33:48 UTC
Ghost image: further cleanups and fixes
Tip revision: 2b39588
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

-include $(TOP_DIR)/Makefile.setup.toolchain

ifeq ($(CONFIG_CCACHE), y)
    CC := $(CCACHE) $(CC)
    HOST_CC := $(CCACHE) $(HOST_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 -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 \
	-fno-builtin-printf \
	-std=gnu99 \
	-Winline \
	-I$(PLATFORM_INC) \
	-I$(PLATFORM_INC)/include \
	-I$(SRC_DIR) \

# The short-double flag is removed in GCC 6+
GCC_DUMPVERSION := $(shell ${CC} -dumpversion)
ifneq (,$(findstring GCC-4,GCC-$(GCC_DUMPVERSION)))
CFLAGS += -fshort-double
endif
ifneq (,$(findstring GCC-5,GCC-$(GCC_DUMPVERSION)))
CFLAGS += -fshort-double
endif


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

# some recent Linux distros have this defined
# we don't use it, but the checks below will get upset and print a warning
CONFIG_SITE=n

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)

# install preparing targets are called from both platform and modules
# however, placing these rules at the top will select "install_prepare"
# as the default target, which is not what we want
# fixme: better solution?
.DEFAULT_GOAL := all

install_prepare:
	$(INSTALL_PREPARE)

install_finish:
	$(INSTALL_FINISH)

.PHONY: install_prepare install_finish

prepare_install_dir: install_prepare
	@echo "[ MKDIR    ]   ML directory structure..."
	@$(MKDIR) -p $(INSTALL_ML_DIR)
	@$(MKDIR) -p $(INSTALL_MODULES_DIR)
	@$(MKDIR) -p $(INSTALL_FONTS_DIR)
	@$(MKDIR) -p $(INSTALL_DATA_DIR)
	@$(MKDIR) -p $(INSTALL_CROPMARKS_DIR)
	@$(MKDIR) -p $(INSTALL_SCRIPTS_DIR)
	@$(MKDIR) -p $(INSTALL_DOC_DIR)
back to top