# makefile to set-up the environment for building... # Make everything more verbose by V=1. Taken from kbuild ifeq ("$(origin V)", "command line") Q = else Q = @ endif # Variables SYSMOCOM_RELEASE=201705 POKY_RELEASE=pyro REPOS=poky meta-telephony meta-sysmocom-bsp meta-qt5 meta-sysmocom-bsp TARGETS=sysmobts sysmocom-apu2 sysmocom-alix # usage: @echo "Pick a target like help, update or sysmocom-alix-setup" help: @echo "Set-up build environment and execute builds. This is intended" @echo "for customers and employees." @echo "" @echo "Available targets:" @echo " usage - Default target and print usage" @echo " help - This output" @echo " update - git pull --rebase and initial git clone" @echo " setup-all - Set-up all build directories" @echo " build-all - Build all targets" @echo " clean-all - Clean all targets after build" @echo " upload-all - Upload all targets" @echo ' install-ssh-config - Install Host to $$HOME/.ssh/config' @echo "Board specific targets:" @$(foreach target, $(TARGETS), \ printf " %-16s - Configure build directory\\n" $(target)-setup;) @$(foreach target, $(TARGETS), \ printf " %-16s - Configure build directory\\n" $(target)-build;) @$(foreach target, $(TARGETS), \ printf " %-16s - Configure build directory\\n" $(target)-upload;) @echo "Available variables:" @echo " V=1 - Enable verbose command output" @echo " SYSMOCOM_RELEASE=name - Pick branch during clone" @echo " POKY_RELEASE=name - Pick branch during clone" # Fetch/update all repos... Expand REPOS and append -update to the rule # e.g. poky-update meta-telephony-update update: $(foreach repo, $(REPOS), $(repo)-update) # helper rules ## Create a new directory git: mkdir $@ ## Clone repositories. The other option is by variable something like BRNACH_poky, REPO_poky git/poky: | git cd git && git clone --branch=$(POKY_RELEASE) --depth=1 git://git.yoctoproject.org/poky git/meta-sysmocom-bsp: | git cd git && git clone --branch=$(SYSMOCOM_RELEASE) git://git.sysmocom.de/poky/meta-sysmocom-bsp git/meta-telephony: | git cd git && git clone --branch=$(SYSMOCOM_RELEASE) git://github.com/sysmocom/meta-telephony git/meta-smalltalk: | git cd git && git clone --branch=$(SYSMOCOM_RELEASE) git://github.com/sysmocom/meta-smalltalk git/meta-qt5: | git cd git && git clone --branch=$(SYSMOCOM_RELEASE) git://github.com/sysmocom/meta-qt5 ## Create a build directory, e.g. build.sysmobts ## Use Poky to set-up the directory and then customize it. Copy files ## around and append to the local.conf and layers.conf CFG_FILES = $(sort $(notdir $(wildcard cfg/common/*))) $(sort $(notdir $(wildcard cfg/$(subst build.,,$@)/*))) build.%: | git/poky @echo "Creating build directory for $(subst build.,,$@) ..." @. git/poky/oe-init-build-env $@ # Append entries to conf/local.conf. Common first, machine second... filter $(Q)$(foreach file,$(CFG_FILES), $(call cat $(file) | sed s,BASE_DIR,$(PWD), >> $@/conf/local.conf)) @echo "require conf/distro/include/sysmocom-defaults.conf" >> $@/conf/local.conf # layers now.. mkdir -p $@/conf $(Q)cat cfg/bblayers.conf | sed s,BASE_DIR,$(PWD), > $@/conf/bblayers.conf # generic git pull --rebase rule. Let's assume this is matching poky-update # then the dependency will be "git/poky" and a clone rule will be built. %-update: | git/$(subst -update,,%) @echo "Updating $(subst -update,,$@) ..." $(Q)cd git/$(subst -update,,$@) && git pull --rebase # Setup a build directory %-setup: | build.$(subst -setup,,%) git/poky @echo "Please place proprietary firmware into the downloads directory." # Create all build directories setup-all: | $(foreach target, $(TARGETS), $(target)-setup) install-ssh-config: | $(HOME)/.ssh ifndef SSH_HOST $(error "Please call with make $@ SSH_HOST=xyz...") endif ifndef SSH_PORT $(error "Please call with make $@ SSH_PORT=abc...") endif ifndef SSH_USER $(error "Please call with make $@ SSH_USER=def...") endif @echo "Host = sysmocom-downloads" >> $(HOME)/.ssh/config @echo " HostName = $(SSH_HOST)" >> $(HOME)/.ssh/config @echo " Port = $(SSH_PORT)" >> $(HOME)/.ssh/config @echo " AddressFamily = inet" >> $(HOME)/.ssh/config @echo " User = $(SSH_USER)" >> $(HOME)/.ssh/config # Target classification .PHONY: update .SECONDARY: $(foreach repo, $(REPOS), git/$(repo)) $(foreach target, $(TARGETS), build.$(target))