Commit 8bf9faea authored by alex@thinkpad's avatar alex@thinkpad
Browse files

Merged in makefile-updates (pull request #873)

Makefile updates to use any valid ARM toolchain

--HG--
branch : unified
......@@ -5,58 +5,67 @@
#http://www.gnu.org/software/make/manual/make.html#Automatic-Variables
#http://www.gnu.org/software/make/manual/make.html#Variables_002fRecursion
TOP_DIR=$(PWD)
TOP_DIR=.
include Makefile.setup
all: $(SUPPORTED_MODELS)
############################################################################################################
#
# include platform data to build "top level" rules for every model
#
# this allows e.g.
# make 5D3
# make 5D3.113
# make 5D3.123
# make 5D3_install
# make 5D3.113_install
# on this top level Makefile
#
include $(PLATFORM_PATH)/Makefile.platform.map
$(foreach _,$(PLATFORM_MAP),$(eval $(call makerule,$(word 1, $(subst ., ,$_)),$_,$(PLATFORM_PATH)/)))
############################################################################################################
# This rule is able to run make for specific model (defined in ALL_SUPPORTED_MODELS)
#60D 550D 600D 1100D 50D 500D 5D2 5DC 40D 5D3 EOSM 650D 6D 7D_MASTER::
$(ALL_SUPPORTED_MODELS)::
$(call call_make_platform)
7D:: 7D_MASTER
$(MAKE) -C $(PLATFORM_PATH)/7D.203
5D3.113:
$(MAKE) -C $(PLATFORM_PATH)/5D3.113
5D3.123:
$(MAKE) -C $(PLATFORM_PATH)/5D3.123
5D3: 5D3.113 5D3.123
all: modules_all platform_all
7DFIR: 7D_MASTER 7D
dd if=$(PLATFORM_PATH)/7D.203/autoexec.bin of=$(PLATFORM_PATH)/7D.203/autoexec.fir bs=288 skip=1 >/dev/null 2>&1
dd if=$(PLATFORM_PATH)/7D_MASTER.203/autoexec.bin of=$(PLATFORM_PATH)/7D_MASTER.203/autoexec.fir bs=288 skip=1 >/dev/null 2>&1
python ../dumper/build_fir7.py -r -s $(PLATFORM_PATH)/7D.203/autoexec.fir -m $(PLATFORM_PATH)/7D_MASTER.203/autoexec.fir $(PLATFORM_PATH)/7D.203/7D000203.FIR $(PLATFORM_PATH)/7D.203/MAGIC.FIR >/dev/null
install: platform_install
platform_all_model:
$(MAKE) -C $(PLATFORM_PATH) clean-all-model all-model
install_platform_all_model: platform_all_model
$(MAKE) -C $(PLATFORM_PATH) install-all-model
clean: platform_clean doxygen_clean modules_clean
install: install_platform_all_model
############################
# module rules
############################
modules_all:
$(MAKE) -C modules all
all_modules:
$(MAKE) -C modules
modules_clean:
$(MAKE) -C modules clean
fir:
############################
# fir rules
############################
fir_all:
$(MAKE) -C installer clean_and_fir
install_fir: fir
fir_install: fir
$(MAKE) -C installer install_fir
############################
# platform rules
############################
platform_install:
$(MAKE) -C $(PLATFORM_PATH) install
platform_clean:
$(MAKE) -C platform clean
$(MAKE) -C $(PLATFORM_PATH) clean
modules_clean:
$(MAKE) -C modules clean
platform_all:
$(MAKE) -C $(PLATFORM_PATH) all
clean: platform_clean doxygen_clean modules_clean
############################
# additional clean rules
############################
clean:
$(call rm_files, \
magiclantern.lds \
$(LUA_PATH)/*.o \
......@@ -97,9 +106,9 @@ clean: platform_clean doxygen_clean modules_clean
# during 'make all'. We can't write 'zip: all docs' because
# of possible problem in case of parallel build.
# (see make's '-j' option documentation)
zip: docs
$(MAKE) all
cd $(PLATFORM_PATH)/all; $(MAKE) zip
#zip: docs
# $(MAKE) all
# cd $(PLATFORM_PATH)/all; $(MAKE) zip
docs:
cd $(PLATFORM_PATH)/all; $(MAKE) docs
......@@ -113,11 +122,12 @@ doxygen:
doxygen_clean:
$(call rm_dir, doxygen-doc)
dropbox: all
cp $(PLATFORM_PATH)/all/autoexec.bin ~/Dropbox/Public/bleeding-edge/
features.html: FORCE
cd features; python features-html.py > ../features.html
FORCE:
# we want ML platforms to be built sequentially, to avoid conflicts
# => use .NOTPARALLEL in the upper-level Makefiles only
# parallel build is still used within each platform
.NOTPARALLEL:
......@@ -26,7 +26,12 @@ CONFIG_%$(_CONFIGS_clean_name):
CONFIG_%$(_CONFIGS_install_name): CONFIG_%$(_CONFIGS_compile_name)
+$(MAKE) -C $($*_DIR) install
install:: prepare_install_dir install_extra_data $(_CONFIGS_install)
# some installation media may fail when copying files in parallel
# broken drivers or controller? forcing sequential installation solves the issue...
# fixme: $(_CONFIGS_install) (currently just CONFIG_MODULES_install) does not run $(INSTALL_FINISH)
# it must be executed only once at the end (to unmount the installation media)
install:: prepare_install_dir install_extra_data
for target in $(_CONFIGS_install); do $(MAKE) $$target; done
$(INSTALL_FINISH)
install_extra_data: prepare_install_dir
......@@ -62,7 +67,7 @@ installdoc:
-$(CP) $(SRC_DIR)/logo.bmp $(INSTALL_ML_DIR)/docs || echo "warning Unable to copy logo.bmp"
prepare_zip: FORCE
$(eval INSTALL_DIR = $(PWD)/zip)
$(eval INSTALL_DIR = $(PWD_DIR)/zip)
$(eval INSTALL_PREPARE = )
$(eval INSTALL_FINISH = )
$(eval WIFI_SD = )
......@@ -72,11 +77,13 @@ prepare_zip: FORCE
$(eval export INSTALL_FINISH)
$(eval export WIFI_SD)
$(call rm_dir, $(INSTALL_DIR)/)
$(warning remove $(INSTALL_DIR))
$(warning removing $(INSTALL_DIR))
$(call rm_files, $(PLATFORM_PATH)/*/magiclantern.sym) # only check module dependencies on current camera model
$(warning removing $(PLATFORM_PATH)/*/magiclantern.sym)
mkdir -p $(INSTALL_DIR)
# zip.txt must be the first item on the list!
magiclantern-$(VERSION).zip: install installdoc install_fir
magiclantern-$(VERSION).zip: install installer_check installdoc
-$(call rm_files, $@)
chmod -x $(INSTALL_DIR)/autoexec.bin
cd $(INSTALL_DIR); zip -z ../$@ < \
......@@ -84,7 +91,11 @@ magiclantern-$(VERSION).zip: install installdoc install_fir
$(call rm_dir, $(INSTALL_DIR)/)
zip:: | prepare_zip
zip:: magiclantern-$(VERSION).zip
zip:: magiclantern-$(VERSION).zip print_build_info
install_qemu:: | prepare_zip
install_qemu:: install
$(call build,MTOOLS,cd $(TOP_DIR)/../qemu/; ./mtools_copy_ml.sh $(INSTALL_DIR))
clean::
$(call rm_dir, zip)
......
......@@ -8,10 +8,11 @@ include $(TOP_DIR)/Makefile.top
-include $(TOP_DIR)/Makefile.user
-include $(TOP_DIR)/Makefile.setup.toolchain
ifeq ($(CONFIG_CCACHE), y)
CC := $(CCACHE) $(CC)
HOST_CC := $(CCACHE) $(CC)
HOST_CC := $(CCACHE) $(HOST_CC)
endif
# Quiet the build process
......@@ -93,6 +94,10 @@ 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))))
......
# toolchain setup, based on preferences from Makefile.user.default and Makefile.user
ifneq ("$(wildcard $(PREFERRED_ARM_PATH)/bin/arm-$(ARM_ABI)-gcc$(GCC_VERSION))","")
# use this one if installed
ARM_BINPATH=$(PREFERRED_ARM_PATH)/bin
CROSS_COMPILE=$(ARM_BINPATH)/arm-$(ARM_ABI)-
CC=$(CROSS_COMPILE)gcc$(GCC_VERSION)
ifeq ("$(MAKELEVEL)","0")
$(info Using $(CC) (preferred).)
endif
else ifneq ("$(shell which arm-$(ARM_ABI)-gcc 2>/dev/null)","")
# otherwise, try whatever is installed on the system
CC=$(shell which arm-$(ARM_ABI)-gcc)
CROSS_COMPILE=$(shell basename '$(CC)' gcc)
ifeq ("$(MAKELEVEL)","0")
$(info Using $(CC) (from PATH).)
endif
else ifneq ("$(wildcard ~/gcc*arm*eabi*/bin/arm-$(ARM_ABI)-gcc$(GCC_VERSION))","")
# nothing found? look for any gcc*arm*eabi* in the home directory,
# matching ARM_ABI and GCC_VERSION from Makefile.user if specified
# if more than one match is found, pick the one with highest version number
ARM_BINPATH=$(shell dirname `ls -v ~/gcc*arm*eabi*/bin/arm-$(ARM_ABI)-gcc$(GCC_VERSION) | tail -1`)
CROSS_COMPILE=$(ARM_BINPATH)/arm-$(ARM_ABI)-
CC=$(CROSS_COMPILE)gcc$(GCC_VERSION)
ifeq ("$(MAKELEVEL)","0")
$(info Using $(CC) (found in home directory).)
endif
else
# still nothing?
$(info )
$(info Please configure a valid ARM cross-compiler.)
$(info If arm-$(ARM_ABI)-gcc is in your executable path, it will be used.)
$(info )
$(info Preferred: gcc 5_4-2016q3 32-bit from https://launchpad.net/gcc-arm-embedded)
$(info Also fine: gcc-arm-embedded 6.x, Linaro arm-eabi 7.x, gcc-arm-none-eabi from Ubuntu,)
$(info gcc-arm-embedded from team-gcc-arm-embedded PPA on Ubuntu, others may work as well.)
$(info )
$(info For GDB+QEMU, you *must* use a 32-bit version, e.g. gdb-arm-none-eabi:i386,)
$(info gcc-arm-embedded:i386 from PPA, 32-bit arm-none-eabi-gdb from gcc-arm-embedded.)
$(info Unfortunately, Linaro's arm-eabi-gdb does not work, whether 32 or 64 bit.)
$(info )
$(error )
endif
# used for NEWLIB_PATH and DIETLIBC_PATH in Makefile.user.default
ARM_ABI_LIB=$(ARM_ABI)
ifeq ($(ARM_ABI),eabi)
# Linaro's "eabi" appears to be compatible with none-eabi; is it the same thing?
ARM_ABI_LIB=none-eabi
endif
MAKE=make
RM=rm
MV=mv
MKDIR=mkdir
......@@ -10,7 +9,7 @@ DATE=date -u
BINARIES_PATH=binaries
LUA_PATH=$(TOP_DIR)/lua
PWD=$(shell pwd)
PWD_DIR=$(shell pwd)
SRC_DIR=$(TOP_DIR)/src
PLATFORM_PATH=$(TOP_DIR)/platform
BUILDER_DIR=$(TOP_DIR)/../dumper
......@@ -20,6 +19,7 @@ CROP_DIR=$(TOP_DIR)/data/cropmks
VRAM_DIR=$(TOP_DIR)/data/vram
SCRIPT_DIR=$(TOP_DIR)/scripts
MODULES_DIR=$(TOP_DIR)/modules
INSTALLER_DIR=$(TOP_DIR)/installer
BIN_FILES=magiclantern magiclantern.bin autoexec.bin autoexec
CF_CARD_ML_DIR = $(CF_CARD)/ML
......@@ -70,3 +70,11 @@ endef
define targets_rules
$(foreach model, $1, $(model)_rule_$(strip $(2)))
endef
# evaluate once and only when used
# https://stackoverflow.com/a/28542922
# example: FOO = $(call eval_once,FOO,$(shell command))
define eval_once
$(eval $1 := $2)$(value $1)
endef
......@@ -11,15 +11,17 @@ ifeq ($(UNAME), Darwin)
else
# Default settings for remaining operating systems
UMOUNT=umount
# some distros may require:
# UMOUNT=sudo umount
# CF_CARD=/media/EOS_DIGITAL
CF_CARD:=$(shell mount | grep -oE "[^ ]+/EOS_DIGITAL[^ ]*")
CF_CARD = $(call eval_once,CF_CARD,$(shell mount | grep -oE "[^ ]+/EOS_DIGITAL[^ ]*"))
STAT_CMD=stat -c "%n: %s bytes"
endif
# change this if you have to mount the card every time you run "make install"
# examples:
# MOUNT_CARD=gvfs-mount -d /dev/mmcblk0p1
# MOUNT_CARD=gvfs-mount dav://192.168.0.1/
# MOUNT_CARD=gio mount -d /dev/mmcblk0p1
# MOUNT_CARD=gio mount dav://192.168.0.1/
MOUNT_CARD=
# Experimental setup for Wi-Fi SD cards
......@@ -43,9 +45,10 @@ ifeq ($(WIFI_SD),y)
# executed before installation
# connect to WIFI_CARD_NETWORK if not already,
# and mount card directory via WebDAV
# also monitor the connection in background while the card is mounted (signal tends to be weak)
INSTALL_PREPARE=$(call build,WIFI_SET,\
if !(nmcli conn show --active | grep $(WIFI_CARD_NETWORK) > /dev/null); then \
while !(nmcli device wifi list | grep $(WIFI_CARD_NETWORK)); do \
if ! nmcli conn show --active | grep $(WIFI_CARD_NETWORK) > /dev/null; then \
while ! nmcli device wifi list | grep $(WIFI_CARD_NETWORK); do \
if [ `nmcli radio wifi` = disabled ]; \
then nmcli radio wifi on; sleep 5; \
else nmcli dev wifi rescan 2>/dev/null || true; sleep 2; \
......@@ -54,14 +57,26 @@ ifeq ($(WIFI_SD),y)
done; \
nmcli conn up $(WIFI_CARD_NETWORK); \
fi; \
if (ping -c 3 -l 3 $(WIFI_CARD_IP) > /dev/null) ; then \
if !(gvfs-mount -l | grep "dav://$(WIFI_CARD_IP)/"); then \
gvfs-mount dav://$(WIFI_CARD_IP)/ ; \
for i in `seq 1 20`; do \
if ping -c 3 -l 3 -W 1 $(WIFI_CARD_IP) > /dev/null; then break; fi; \
echo -n "."; \
done; \
if ping -c 3 -l 3 -W 1 $(WIFI_CARD_IP) > /dev/null; then \
if ! gio mount -l | grep "dav://$(WIFI_CARD_IP)/"; then \
gio mount dav://$(WIFI_CARD_IP)/ ; \
fi; \
else \
echo "$(WIFI_CARD_IP) appears to be offline." ; \
exit 1; \
fi; )
fi; \
( while gio mount -l | grep -q "dav://$(WIFI_CARD_IP)/"; do \
if ! ping -c 3 -l 3 -W 1 $(WIFI_CARD_IP) > /dev/null; then \
echo -n "!"; \
fi; \
sleep 1; \
done \
) & \
)
# restore connection to your main wifi network
# or just turn it off if you are using a wired network
......@@ -69,18 +84,22 @@ ifeq ($(WIFI_SD),y)
if [ "$(WIFI_MAIN_NETWORK)" = "" ]; then \
echo "Turning off Wi-Fi..."; \
nmcli radio wifi off; \
elif !(nmcli conn show --active | grep $(WIFI_MAIN_NETWORK) > /dev/null); then \
elif ! nmcli conn show --active | grep $(WIFI_MAIN_NETWORK) > /dev/null; then \
echo "Connecting to $(WIFI_MAIN_NETWORK)..."; \
nmcli conn up $(WIFI_MAIN_NETWORK); \
fi; )
UMOUNT_CARD=$(call build,UNMOUNT,while !(gvfs-mount -u dav://$(WIFI_CARD_IP)/); do sleep 2; done)
UMOUNT_CARD=$(call build,UNMOUNT,\
while ! gio mount -u dav://$(WIFI_CARD_IP)/; do \
sleep 2; \
done \
)
# executed after installation
define INSTALL_FINISH =
$(UMOUNT_CARD)
$(WIFI_RESTORE)
@echo "\nFinished.\nMake sure the camera will not write anything to the card until restart."
@printf "\nFinished.\nMake sure the camera will not write anything to the card until restart.\n"
endef
endif
......@@ -92,35 +111,33 @@ SUPPORTED_UNIFIED_MODELS:=50D 60D 550D 600D 500D 5D2 1100D
# GCC-related stuff
# for yagarto or the official ARM toolchain use ARM_ABI=none-eabi otherwise use ARM_ABI=elf
# for linaro bare-metal toolchain, use ARM_ABI=eabi
ARM_ABI=none-eabi
GCC_VERSION=-4.8.3
DIETLIB_VERSION=0.33
NEWLIB_OPT_LEVEL=O3
# example: GCC_VERSION=-5.4.1
# use default if unspecified
GCC_VERSION=
# use this one if installed on the system
# otherwise, use the one from executable PATH
PREFERRED_ARM_PATH=~/gcc-arm-none-eabi-5_4-2016q3
#PREFERRED_ARM_PATH=~/gcc-linaro-7.1.1-2017.08-i686_arm-eabi
DIETLIB_VERSION=0.33
DIETLIBC_OPT_LEVEL=Os
NEWLIB_OPT_LEVEL=O3
ARM_PATH=~/gcc-arm-none-eabi-4_8-2013q4
ARM_BINPATH=$(ARM_PATH)/bin
ARM_LIBGCC_PATH=$(ARM_PATH)/lib/gcc/arm-$(ARM_ABI)/$(subst -,,$(GCC_VERSION))
NEWLIB_PATH=$(SRC_DIR)/libs/arm-$(ARM_ABI)-$(NEWLIB_OPT_LEVEL)
DIETLIBC_PATH=$(SRC_DIR)/libs/dietlib-$(DIETLIB_VERSION)-$(ARM_ABI)-$(DIETLIBC_OPT_LEVEL)
NEWLIB_PATH=$(SRC_DIR)/libs/arm-$(ARM_ABI_LIB)-$(NEWLIB_OPT_LEVEL)
DIETLIBC_PATH=$(SRC_DIR)/libs/dietlib-$(DIETLIB_VERSION)-$(ARM_ABI_LIB)-$(DIETLIBC_OPT_LEVEL)
# Static libraries used
ARM_LIBGCC_A=$(ARM_LIBGCC_PATH)/libgcc.a
ARM_LIBGCC_A=$(shell $(CC) -print-libgcc-file-name)
NEWLIB_LIBM_A=$(NEWLIB_PATH)/libm.a
NEWLIB_LIBC_A=$(NEWLIB_PATH)/libc.a
DIETLIBC_A=$(DIETLIBC_PATH)/dietlibc.a
ML_LIBC = dietlibc.a newlib-libc.a newlib-libm.a gcc-libgcc.a
CROSS_COMPILE=$(ARM_BINPATH)/arm-$(ARM_ABI)-
ifeq ($(OS),Windows_NT)
CC=$(CROSS_COMPILE)gcc$(GCC_VERSION).exe
else
CC=$(CROSS_COMPILE)gcc$(GCC_VERSION)
endif
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
AR=$(CROSS_COMPILE)ar
......@@ -184,19 +201,21 @@ RST2LATEX=rst2latex.py
# magiclantern-0.2.0.rc1.550d.fw109.zip
#~ VERSION=0.2.0.rc1.550d.fw109
BUILDVER=$(shell whoami).$(shell hg id -i -r .)
VERSION:=Nightly.$(shell LC_TIME=EN date +'%Y%b%d').$(MODEL)$(FW_VERSION)
VERSION = $(call eval_once,VERSION,Nightly.$(shell LC_TIME=EN date +'%Y%b%d').$(MODEL)$(FW_VERSION))
# Build configuration - untested and debug stuff handy for devs
# these can be specified either in Makefile.user, or in the command line:
#
# make clean; make CONFIG_QEMU=y
# FIXME: you will need to use "make clean" before recompiling with different options.
CONFIG_PTP = n
CONFIG_PTP_CHDK = n
CONFIG_PTP_ML = n
ifndef CONFIG_GDB
CONFIG_GDB = n
endif
CONFIG_GDBSTUB = n
ifndef CONFIG_CONSOLE
CONFIG_CONSOLE = y
endif
CONFIG_DEBUGMSG = 0
CONFIG_CCACHE = n
CONFIG_TCC = y
......
......@@ -4,6 +4,7 @@ ifndef TOP_DIR
# if this is used as a standalone makefile, we need to include some additional stuff
TOP_DIR=..
include $(TOP_DIR)/Makefile.setup
XOR_CHK:=$(notdir $(XOR_CHK))
endif
$(XOR_CHK): $(XOR_CHK).c
......
......@@ -25,3 +25,8 @@ $(INSTALLER_INSTALL_TARGETS) $(INSTALLER_INSTALLER_TARGETS) $(INSTALLER_CLEAN_AL
$(call call_make_rule, $(TOP_DIR)/installer)
.PHONY: $(INSTALLER_INSTALLER_TARGETS) $(INSTALLER_INSTALL_TARGETS) $(INSTALLER_CLEAN_ALL_TARGETS) $(SUPPORTED_INSTALLERS)
# we want ML installers to be built sequentially, to avoid conflicts
# => use .NOTPARALLEL in the upper-level Makefiles only
# parallel build is still used within each platform
.NOTPARALLEL:
......@@ -4,26 +4,39 @@ ML_SETUP_EXTENSION=modules
include $(TOP_DIR)/Makefile.setup
MODULES_ALL_TARGETS = $(ML_MODULES_DYNAMIC) $(ML_MODULES_STATIC)
ifdef ML_MODULES_DYNAMIC
$(error ML_MODULES_DYNAMIC was renamed to ML_MODULES)
endif
MODULES_CLEAN_ALL_TARGETS = $(call targets_rules, $(shell ls -d */), clean)
MODULES_ALL_TARGETS = $(ML_MODULES)
MODULES_INSTALL_DYNAMIC_TARGETS = $(call targets_rules, $(ML_MODULES_DYNAMIC), install)
MODULES_CLEAN_ALL_TARGETS = $(call targets_rules, $(ML_MODULES), clean)
MODULES_ALL_TARGETS_DELETE_IF_FAILED = $(call targets_rules, $(MODULES_ALL_TARGETS), delete_if_failed)
MODULES_INSTALL_ALL_TARGETS = $(call targets_rules, $(ML_MODULES), install)
MODULES_ALL_TARGETS_DELETE_IF_FAILED = $(call targets_rules, $(ML_MODULES), delete_if_failed)
all:
@make --silent all_silent
@+$(MAKE) --silent all_silent
all_silent: $(MODULES_ALL_TARGETS_DELETE_IF_FAILED)
# run module-specific clean rules
# also run a generic clean, just in case there are any modules left over
clean: $(MODULES_CLEAN_ALL_TARGETS)
$(call rm_files, $(addprefix $(MODULES_DIR)/, *.o *.d *.dep *.sym hgstamp))
install: | prepare_install_dir
install: all
$(CP) $(MODULES_DIR)/*/*.mo $(INSTALL_MODULES_DIR)/ || echo "no problem"
$(CP) $(MODULES_DIR)/*/*.mo $(INSTALL_MODULES_DIR)/
$(MODULES_INSTALL_DYNAMIC_TARGETS) $(MODULES_CLEAN_ALL_TARGETS) $(ML_MODULES_DYNAMIC) $(MODULES_ALL_TARGETS_DELETE_IF_FAILED):
$(MODULES_INSTALL_ALL_TARGETS) $(MODULES_CLEAN_ALL_TARGETS) $(MODULES_ALL_TARGETS) $(MODULES_ALL_TARGETS_DELETE_IF_FAILED):
$(call call_make_rule, $(MODULES_DIR))
.PHONY: $(MODULES_ALL_TARGETS)
# force sequential execution at top level
# fixme: modules cannot be safely built in parallel, as dependency checks may fail
# e.g. mlv_snd depends on mlv_rec, but the former usually gets compiled quicker
# however, parallel build will still be used within each module
.NOTPARALLEL:
......@@ -23,13 +23,13 @@ nodep:: $(MODULE_OUTPUT) $(MODULE_SYM)
delete_if_failed:
@echo ""
@echo "Building module $(MODULE_NAME)..."
@make all --no-print-directory || { \
@$(MAKE) all --no-print-directory || { \
echo ""; \
echo "********************************************************"; \
echo "WARNING: module $(MODULE_NAME) failed to build, deleting"; \
echo "********************************************************"; \
echo ""; \
make clean; \
$(MAKE) clean; \
}
-include $(MODULE_DEPS)
......@@ -38,12 +38,14 @@ clean::
$(call rm_files, $(MODULE_OBJS) $(MODULE_OUTPUT) $(MODULE_SYM) $(MODULE_DEP) $(MODULE_STRINGS) $(HGDIFF_OBJS) *.o *.d *.dep *.sym hgstamp)
module_strings.h: README.rst hgstamp
$(call build,README, $(PYTHON) ../readme2modulestrings.py > $@)
$(call build,README, $(PYTHON) ../readme2modulestrings.py > $@ || rm -f $@)
README.rst:
$(call build,README,echo -e "$(MODULE_NAME)\n========\n\nPlease write a one-page description for your module here.\n\nYou may also add some metadata:\n\n:Author: <your name here>\n:License: <your license here>\n:Website: <your website here>\n\n" > $@)
$(call build,README,printf "$(MODULE_NAME)\n========\n\nPlease write a one-page description for your module here.\n\nYou may also add some metadata:\n\n:Author: <your name here>\n:License: <your license here>\n:Website: <your website here>\n\n" > $@)
$(MODULE_OUTPUT): $(MODULE_STRINGS) $(MODULE_OBJS) $(HGDIFF_OBJS)
$(MODULE_OBJS): $(MODULE_STRINGS)
$(MODULE_OUTPUT): $(MODULE_OBJS) $(HGDIFF_OBJS)
$(call build,MODULE,$(LD) -r -o $@ $(MODULE_OBJS))
$(call build,STRIP,$(STRIP) --strip-debug --strip-unneeded --discard-all --discard-locals $@)
$(call build,OBJCOPY,$(OBJCOPY) --add-section .module_hgdiff=hgdiff.tmp $@)
......@@ -78,14 +80,14 @@ hgdiff.tmp: FORCE
%.dep: %.mo
$(call build,DEPENDS,$(READELF) -sW $< | $(GREP) GLOBAL | $(GREP) 00000000 | $(GREP) UND | $(AWK) "{print \$$8;}" | sort > $@ && cd $(MODULES_DIR) && $(PYTHON) checkdep.py $(MODULE_NAME))
# redefine this in module makefile to install additional data along with your module
install_user_data::
modules_install_dir: install_prepare
$(call build,MKDIR,$(MKDIR) -p $(INSTALL_MODULES_DIR))
# redefine this in module makefile to install additional data along with your module
install_user_data:: | modules_install_dir
install:: modules_install_dir all install_user_data
$(call build,$(MODULE_OUTPUT),$(CP) $(PWD)/$(MODULE_OUTPUT) $(INSTALL_MODULES_DIR)/)
$(call build,$(MODULE_OUTPUT),$(CP) $(PWD_DIR)/$(MODULE_OUTPUT) $(INSTALL_MODULES_DIR)/)
$(INSTALL_FINISH)
FORCE:
......@@ -94,7 +96,7 @@ include $(TOP_DIR)/Makefile.filerules
# force recompiling whenever hg history changes (for autogenerated strings)
# http://mercurial.selenic.com/wiki/VersioningWithMake
HGVERSION:= $(shell hg log . -r 'reverse(ancestors(.))' -l 1 --template 'hgid: {node|short}')
HGVERSION = $(shell hg log . -r 'reverse(ancestors(.))' -l 1 --template 'hgid: {node|short}')
hgstamp: FORCE
@[ -f $@ ] || touch $@
@echo $(HGVERSION) | cmp -s $@ - || ( echo $(HGVERSION) > $@ ; echo "Updated HGVERSION" )
......
MODULE_CFLAGS += -I../../src/
ML_MODULES_STATIC ?=
ML_MODULES_DYNAMIC ?= \
ML_MODULES ?= \
mlv_lite \
mlv_play \
mlv_rec \
......
......@@ -62,6 +62,11 @@ def get_command_of(commands):
for command in commands:
if is_command_available(command) == True:
return command
print >> sys.stderr, "\nCould not find " + "/".join(commands) + "."
if "rst2html" in commands:
print >> sys.stderr, "Please install python-docutils (pip install docutils)."
print >> sys.stderr, ""
exit(1)
inp = open("README.rst").read().replace("\r\n", "\n")
lines = inp.strip("\n").split("\n")
......
......@@ -7,6 +7,3 @@ ML_SRC_EXTRA_OBJS = \
video_hacks.o \
afma.o \
asm.o
CFLAG_USER += -DCONFIG_5D3_113=1
......@@ -6,6 +6,3 @@ ML_SRC_EXTRA_OBJS = \
video_hacks.o \
afma.o \
asm.o
CFLAG_USER += -DCONFIG_5D3_123=1
......@@ -21,3 +21,15 @@ FIR-SLAVE: autoexec-fir-slave
# $(call build,OBJCOPY,$(OBJCOPY) -O binary autoexec-fir $@.bin)
# $(STAT_CMD) $@.bin;
# $(READELF) -l autoexec-fir | grep -C 2 MemSiz
all::
$(MAKE) -C $(PLATFORM_PATH)/7D_MASTER.203