TARGET is also GNU make terminology.. use MACHINE as this matches the
terminology of OpenEmbedded..
Holger Hans Peter Freyther 6 years ago
parent de5bcbc362
commit 8d353ae692
  1. 61

@ -1,5 +1,18 @@
# makefile to set-up the environment for building...
# This is probably only working with GNU make. The file is structured
# to have variables in the beginning, some helper functions, then so
# implicit rules and in the end targets that invoke them all.
# If you need to change sysmocom release or poky base branch then the
# two variables need to be changed.
# If you add a machine then MACHINES need to be adjusted and a new config
# in cfg/NAME/10_NAME needs to be created.
# Implicit rules: I used WILDCARD-action for the rules and then get the
# name of the rule from $@ in the rule itself or % when still being in
# the dependency list.
# Make everything more verbose by V=1. Taken from kbuild
ifeq ("$(origin V)", "command line")
@ -12,8 +25,16 @@ endif
REPOS=poky meta-telephony meta-sysmocom-bsp meta-qt5 meta-sysmocom-bsp
TARGETS=sysmobts sysmocom-apu2 sysmocom-alix
MACHINES=sysmobts sysmocom-apu2 sysmocom-alix
# The default targets to pick depending on machine
BUILD_TARGET_sysmobts = "meta-toolchain-osmo task-sysmocom-feed sysmocom-nitb-image sysmocom-nitb-rauc-image image-rauc-rescue-initramfs image-rauc-slot-initramfs image-rauc-ubi"
BUILD_TARGET_sysmocom-apu2 = "core-image-minimal-initramfs meta-toolchain-osmo task-sysmocom-feed sysmocom-nitb-image core-image-minimal-initramfs"
BUILD_TARGET_sysmocom-alix = "core-image-minimal-initramfs meta-toolchain-osmo task-sysmocom-feed sysmocom-nitb-image core-image-minimal-initramfs"
# Pick the one depending on $@
@ -33,12 +54,12 @@ help:
@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;)
@$(foreach machine, $(MACHINES), \
printf " %-16s - Configure build directory\\n" $(machine)-setup;)
@$(foreach machine, $(MACHINES), \
printf " %-16s - Configure build directory\\n" $(machine)-build;)
@$(foreach machine, $(MACHINES), \
printf " %-16s - Configure build directory\\n" $(machine)-upload;)
@echo "Available variables:"
@echo " V=1 - Enable verbose command output"
@echo " SYSMOCOM_RELEASE=name - Pick branch during clone"
@ -49,6 +70,8 @@ help:
update: $(foreach repo, $(REPOS), $(repo)-update)
# helper rules
## Create a new directory
@ -92,10 +115,26 @@ build.%: | git/poky
# Setup a build directory
%-setup: | build.$(subst -setup,,%) git/poky
@echo "Please place proprietary firmware into the downloads directory."
# Start a build..
%-build: | build.$(subst -build,,%) git/poky
(. git/poky/oe-init-build-env build.$(subst -build $@) && bitbake $(BUILD_TARGETS)
%-upload: | build.$(subst -upload,,%) git/poky
#$(exit foo)
#(. git/poky/oe-init-build-env build.$(subst -build $@) && ../scripts/upload-build.sh $(CUR_MACHINE) $(FEED_NAME)
# Create all build directories, build everything, upload everything, clean everything
setup-all: | $(foreach machine, $(MACHINES), $(machine)-setup)
build-all: | $(foreach machine, $(MACHINES), $(machine)-build)
# Create all build directories
setup-all: | $(foreach target, $(TARGETS), $(target)-setup)
upload-all: | $(foreach machine, $(MACHINES), $(machine)-upload)
clean-all: | $(foreach machine, $(MACHINES), $(machine)-clean)
install-ssh-config: | $(HOME)/.ssh
ifndef SSH_HOST
$(error "Please call with make $@ SSH_HOST=xyz...")
@ -112,5 +151,5 @@ endif
@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))
.PHONY: update setup-all install-ssh-config
.SECONDARY: $(foreach repo, $(REPOS), git/$(repo)) $(foreach machine, $(MACHINES), build.$(machine))