OpenWrt: Package Makefile and the error “make[4]: *** No targets specified and no makefile found.”

I have the next Makefile

include $(TOPDIR)/rules.mk

PKG_NAME:=modbus
PKG_VERSION:=1.0
PKG_RELEASE:=0

# This specifies the directory where we're going to build the program.
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
# directory in your OpenWrt SDK directory
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)


include $(INCLUDE_DIR)/package.mk

define Package/modbus
    CATEGORY:=test
    TITLE:=modbus
    DEPENDS:=+libstdcpp
endef

define Package/modbus/description
    modbus interface
endef


define Package/modbus/install
    $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_BIN) ./src/bandwidth-client $(1)/mod
endef

# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.
$(eval $(call BuildPackage,modbus))

The idea of this makefile is creating a ipk that install the file /bandwidth-client in the file /mod of the device. in the package i have the makefile and the folder src/bandwidth-client that is already compiled.
when i do the ./scripts/feeds update -i && ./scripts/feeds install modbus everything is correct and with the make menuconfig i can add the package. but at the "make" moment i have the next error :

make[3] -C feeds/packages/utils/modbus compile

make[4]: Entering directory `openwrt/build_dir/target-mipsel_24kc_musl/modbus'
make[4]: *** No targets specified and no makefile found.  Stop.

after adding a Makefile to the SRC i get the next error :

make[4]: Entering directory `openwrt/build_dir/target-mipsel_24kc_musl/modbus'
make[4]: *** No targets.  Stop.

How can i correct the makefile so it just get the compiled files ?? or how i can add the targets.

full output:

make[3]: Entering directory `/home/luis/Documentos/openwrt/feeds/packages/utils/modbus'
rm -f /home/luis/Documentos/openwrt/build_dir/target-mipsel_24kc_musl/modbus/.built
touch /home/luis/Documentos/openwrt/build_dir/target-mipsel_24kc_musl/modbus/.built_check
CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap/home/luis/Documentos/openwrt/build_dir/target-mipsel_24kc_musl/modbus:modbus -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/luis/Documentos/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include -I/home/luis/Documentos/openwrt/staging_dir/target-mipsel_24kc_musl/include -I/home/luis/Documentos/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/usr/include -I/home/luis/Documentos/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include/fortify -I/home/luis/Documentos/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap/home/luis/Documentos/openwrt/build_dir/target-mipsel_24kc_musl/modbus:modbus -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/luis/Documentos/openwrt/staging_dir/target-mipsel_24kc_musl/usr/include -I/home/luis/Documentos/openwrt/staging_dir/target-mipsel_24kc_musl/include -I/home/luis/Documentos/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/usr/include -I/home/luis/Documentos/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include/fortify -I/home/luis/Documentos/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include " LDFLAGS="-L/home/luis/Documentos/openwrt/staging_dir/target-mipsel_24kc_musl/usr/lib -L/home/luis/Documentos/openwrt/staging_dir/target-mipsel_24kc_musl/lib -L/home/luis/Documentos/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/usr/lib -L/home/luis/Documentos/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/lib -znow -zrelro " make -j1 -C /home/luis/Documentos/openwrt/build_dir/target-mipsel_24kc_musl/modbus/. AR="mipsel-openwrt-linux-musl-gcc-ar" AS="mipsel-openwrt-linux-musl-gcc -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/home/luis/Documentos/openwrt/build_dir/target-mipsel_24kc_musl/modbus:modbus -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=mipsel-openwrt-linux-musl-ld NM="mipsel-openwrt-linux-musl-gcc-nm" CC="mipsel-openwrt-linux-musl-gcc" GCC="mipsel-openwrt-linux-musl-gcc" CXX="mipsel-openwrt-linux-musl-g++" RANLIB="mipsel-openwrt-linux-musl-gcc-ranlib" STRIP=mipsel-openwrt-linux-musl-strip OBJCOPY=mipsel-openwrt-linux-musl-objcopy OBJDUMP=mipsel-openwrt-linux-musl-objdump SIZE=mipsel-openwrt-linux-musl-size CROSS="mipsel-openwrt-linux-musl-" ARCH="mipsel" ;
make[4]: Entering directory `/home/luis/Documentos/openwrt/build_dir/target-mipsel_24kc_musl/modbus'
make[4]: *** No targets.  Stop.

I would try adding an empty build section:

define Build/Compile
endef 

#please note the changes with respect your file  
define Package/modbus/install
    $(INSTALL_DIR) $(1)/mod
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bandwidth-client $(1)/mod
endef
1 Like

Thanks for the answer !! If you can respond to this it will be great, i am trying to add more files to the install, the problem is that when i change the Dir, the files don't install in the dev, but i don't have compilation errors.

    $(INSTALL_BIN) ./src/modbusmodule.lua $(2)/usr/lib/lua/luci/controller/admin
$(INSTALL_DIR) $(3)/usr/lib/lua/luci/view/modbusmodule
$(INSTALL_BIN) ./src/modbus.htm  $(3)/usr/lib/lua/luci/view/modbusmodule
$(INSTALL_BIN) ./src/service.htm  $(3)/usr/lib/lua/luci/view/modbusmodule

Try the following:

define Package/modbus/install
    $(INSTALL_DIR) $(1)/mod $(1)/usr/lib/lua/luci/controller/admin $(1)/usr/lib/lua/luci/view/modbusmodule

    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bandwidth-client $(1)/mod
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/modbusmodule.lua $(1)/usr/lib/lua/luci/controller/admin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/service.htm $(1)/usr/lib/lua/luci/view/modbusmodule
endef

1 Like

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