简体   繁体   中英

Change default directory src for openwrt compiling package

I'm creating a package for openwrt that contains several modules. The package compiles right if the structure is:

package_name
. Makefile<s>.txt</s>
. files
. src
    + CMakeLists.txt
    + Module1
    + Module2
    + ...
    + Modulen

But if I change the name src by modules it shows me errors. I know the default structure search for src directory, but, what should I add to my Makefile.txt to change default value src to any other one?

Thank you.

The OpenWRt package structure can be found here . The interresting part for you is Bundle source code with OpenWrt Makefile .

(I am afraid the Makefile should be just Makefile without txt extension. It would be helpful if you could post your complete Makefile - but I will try without it. Also please indicate the OpenWRT version you are using, the answer can be version-dependent)

I have found in include/package-defaults.mk the following [OpenWRT 19.07.1]:

Build/Patch:=$(Build/Patch/Default)
ifneq ($(strip $(PKG_UNPACK)),)
  define Build/Prepare/Default
        $(PKG_UNPACK)
        [ ! -d ./src/ ] || $(CP) ./src/. $(PKG_BUILD_DIR)
        $(Build/Patch)
  endef
endif

This means to me, that either you:

  • define PKG_UNPACK in your Makefile as follows: PKG_UNPACK=$(CP) ./modules/. $(PKG_BUILD_DIR) PKG_UNPACK=$(CP) ./modules/. $(PKG_BUILD_DIR)
  • override default Prepare section as follows (or copy recursive, depending on your structure):

.

define Build/Prepare
        $(call Build/Prepare/Default)
        $(CP) ./modules/* $(PKG_BUILD_DIR)/
endef

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM