Question: One makefile for multiple packages - No rule to make target

Hi. I have a problem building two custom packets using single makefile and a single custom source code. I have a cmake file that builds two executables. They are supposed to go into separate packages. The source code is the same. The main package builds fine, but the second package is "No rule to make target":

$ make package/dummy-moonshine2-llc/prepare V=s
Collecting package info: done
make[1]: Entering directory '/home/***/openwrt/v19'
make[1]: *** No rule to make target 'package/dummy-moonshine2-llc/prepare'. Stop.
make[1]: Leaving directory '/home/***/openwrt/v19'
/home/***/openwrt/v19/include/toplevel.mk:216: recipe for target 'package/dummy-moonshine2-llc/prepare' failed
make: *** [package/dummy-moonshine2-llc/prepare] Error 2

The base package (or the package defined with PKG_NAME) :

$ make package/dummy-moonshine2/prepare V=s
Collecting package info: done
make[1]: Entering directory '/home/***/openwrt/v19'
make[2]: Entering directory '/home/***/dummy/dummy_router_openwrt/dummy-moonshine2'
touch /home/***/openwrt/v19/build_dir/target-aarch64_cortex-a53_glibc/dummy-moonshine2-1.0.0/.prepared_6464ff36562fb8919f27538c2f1abf1e_6664517399ebbbc92a37c5bb081b5c53_check
mkdir -p /home/***/openwrt/v19/build_dir/target-aarch64_cortex-a53_glibc/dummy-moonshine2-1.0.0
cp -fpR ./src/* /home/***/openwrt/v19/build_dir/target-aarch64_cortex-a53_glibc/dummy-moonshine2-1.0.0/
#rm -f /home/***/openwrt/v19/build_dir/target-aarch64_cortex-a53_glibc/dummy-moonshine2-1.0.0/src/Makefile.old
#rm -f /home/***/openwrt/v19/build_dir/target-aarch64_cortex-a53_glibc/dummy-moonshine2-1.0.0/src/Makefile.ubuntu
touch /home/***/openwrt/v19/build_dir/target-aarch64_cortex-a53_glibc/dummy-moonshine2-1.0.0/.prepared_6464ff36562fb8919f27538c2f1abf1e_6664517399ebbbc92a37c5bb081b5c53
make[2]: Leaving directory '/home/***/dummy/dummy_router_openwrt/dummy-moonshine2'
time: package/feeds/dummy/dummy-moonshine2/prepare#0.12#0.02#0.15
make[1]: Leaving directory '/home/***/openwrt/v19'

The Makefile

include $(TOPDIR)/rules.mk

PKG_NAME:=dummy-moonshine2
PKG_VERSION:=1.0.0
# PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

define Package/dummy-moonshine/Default
  SECTION:=base
  CATEGORY:=Network
endef

define Package/$(PKG_NAME)
  $(call Package/dummy-moonshine/Default)
  DEPENDS:=+libcurl +zlib +iptables +dummy-libs +libjson-c
  TITLE:=dummy moonshine on-the-fly
endef

define Package/$(PKG_NAME)-llc
  $(call Package/dummy-moonshine/Default)
  DEPENDS:=+libcurl +zlib +iptables +libjson-c
  TITLE:=dummy moonshine on-the-fly - standalone
endef

CMAKE_OPTIONS += -DUSE_DUMMYLIBS:BOOL=TRUE
CMAKE_OPTIONS += -DUSE_UCI:BOOL=TRUE
    
define Package/$(PKG_NAME)/description
 dummy moonshine
endef

define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Package/$(PKG_NAME)/install
	$(INSTALL_DIR) $(1)/usr/bin/
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/dummy-moonshine2 $(1)/usr/bin/
endef

define Package/$(PKG_NAME)-llc/install
	$(INSTALL_DIR) $(1)/usr/bin/
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/dummy-moonshine-llc $(1)/usr/bin/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
$(eval $(call BuildPackage,$(PKG_NAME)-llc))

I believe I've had a similar problem with slider-support and what helped was using the explicit package names instead of the variable in the Makefile.

Thanks Stan ! I managed to get my two packages finally. I was missing Build/Configure, and I replaced with explicit package names.

Another thing that lured me into not finding the solution was that I cannot write make package/dummy-moonshine2-llc/compile, I must build the main package, and then the build system will build the two packages and put the two ipk files under ./bin/.../

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.