Debugging package Makefile

I'm trying to get what would ordinarily be a straightforward make recipe into a package Makefile. It's "just" some shell scripting that needs access to some make variables. No download, extract, patch, configure, compile, just run the bash commands with access to the make variables.

I am struggling with quoting as well as trying to figure out why make V=s package/my-package/compile is apparently executing Package/my-package/install

make -p isn't showing the rules/recipes for my-package

Is there a straightforward way to get a "dump" of the resultant rules/recipes around a package within the OpenWRT build system?

Also, any better references than Packaging guidelines and https://openwrt.org/docs/guide-developer/packages how the magic works, especially as to how Build/<step> and Package/my-package/<step> interact with each other and the targets package/my-package/<step> ?

I think you have to override each "step" (download, extract, configure, compile, etc).

For example:

....
define Build/my-package/configure
endef

define Build/my-package/compile
endef

define Build/my-package/install
endef
......

Maybe there is a better way.
As you said, the documentation could need some improvements.
I would also like to see better documentation about procd.

I usually replace the $(eval $(call BuildPackage,...)) with $(error $(call BuildPackage,...)) - this will dump the entire dynamically generated ruleset to stderr.

For all practical purposes, there is no distinction between the make package/.../compile and make package/.../install targets. The compile: goal depends on $(STAGING_DIR_ROOT)/stamp/.$(1)_installed which (through another stampfile) depends on $(STAMP_BUILT) and executes the package/.../install target. See include/package-ipkg.mk for reference.

The install: target is a mere alias of compile:, see include/package.mk for reference.

  • package/.../clean => Build/UninstallDev, Build/Clean
  • package/.../prepare => Hooks/Prepare/Pre, Build/Prepare, Hooks/Prepare/Post
  • package/.../configure => package/.../prepare, Hooks/Configure/Pre, Build/Configure, Hooks/Configure/Post
  • package/.../compile => package/.../configure, Hooks/Compile/Pre, Build/Compile, Hooks/Compile/Post, Build/Install, Hooks/Install/Post, Hooks/InstallDev/Pre, Build/InstallDev, Hooks/InstallDev/Post, Package/$(1)/install, Package/$(1)/install_lib
  • package/.../install => package/.../compile
1 Like