I've to build my software with OpenWrt to be deployed on a customer's target device. For this to succeed, I need a special tool on the host system. Can anyone give me a few tips and hints on how to write a package which builds a tool for the host rather than for the target?

After searching the Internet for OpenWrt host tools and host packages for the past few hours, the best I've come up with is the following package Makefile for my tool. But these commands do not get invoked by OpenWrt.

What am I missing? Or am I on the wrong track overall?

include $(TOPDIR)/rules.mk

PKG_NAME := project-traits
PKG_VERSION := 6.0.0

PKG_SOURCE_URL := <internal git repository>

HOST_BUILD_PARALLEL := 1
HOST_CONFIGURE_PARALLEL := 1
HOST_BUILD_DIR := $(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk

MAKE_PATH := llvm-build

CMAKE_OPTIONS += -B$(HOST_BUILD_DIR)/$(MAKE_PATH) -H$(HOST_BUILD_DIR)/llvm && echo

define Host/Prepare
    echo 'This is the generator build!'
    # stripped: fetch the LLVM source code
    # stripped: fetch the traits generator source code
endef

# Use Host/Compile from cmake.mk

define Host/Install
    # stripped: install the build generator into the staging dir
endef

$(eval $(call HostBuild))

And in the requiring target package, I've included

PKG_BUILD_DEPENDS += project-traits/host

For confidentiality and for the sake of keeping the pasted code reduced to the essentials, I blanked out a few things or left them out. But you should get the intention. I don't see any of the build's output on the command line or in the build log. OpenWrt seems to just ignore my generator tool and hence fails to build the target package.

In case it makes any differences: I'm not building on direct OpenWrt source files. Instead I get a pre-built OpenWrt SDK from the customer. But I haven't been able to figure out what the difference is, besides a pre-populated device configuration file.

Any help on this "lightly" documented topic is appreciated.

This is a cross-post with Stack Overflow. (I'm not allowed to post the link to the SO thread)