具有自定义编译定义的Openwrt Makefile无法执行

时间:2015-10-03 10:10:32

标签: makefile openwrt

我正在尝试使用自定义编译定义来从“make install”中分离“make compile”,但自定义定义Build/compile永远不会被执行。

define Build/compile
  echo -e "\e[1;34m \nBuild/compile $(PKG_NAME)\n $<\e[0m" \
  $(MAKE) $(MAKE_FLAGS) -C $(PKG_BUILD_DIR) \
  DESTDIR="$(PKG_INSTALL_DIR)"
endef

这在执行时不起作用:make -j1 V=s package/network/nodejs/node/compile

但准备步骤有效:

define Build/Prepare
  echo -e "\e[1;34m \nBuild/Prepare $(PKG_NAME)\n $<\e[0m"
endef

执行时使用:make -j1 V=s package/network/nodejs/node/prepare

那么请您帮忙找出以下脚本出了什么问题:

        #
        # Copyright (C) 2007-2011 OpenWrt.org
        #
        # This is free software, licensed under the GNU General Public License v2.
        # See /LICENSE for more information.
        #

        include $(TOPDIR)/rules.mk

        PKG_NAME:=nodejs
        PKG_VERSION:=0.12.7
        PKG_RELEASE:=0

        PKG_SOURCE:=node-v$(PKG_VERSION).tar.gz
        PKG_SOURCE_URL:=https://nodejs.org/dist/v$(PKG_VERSION)/
        PKG_MD5SUM:=5523ec4347d7fe6b0f6dda1d1c7799d5

        PKG_BUILD_DEPENDS:=nodejs/host

        HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/node-v$(PKG_VERSION)
        PKG_BUILD_DIR:=$(BUILD_DIR)/node-v$(PKG_VERSION)
        #PKG_INSTALL:=1
        PKG_BUILD_PARALLEL:=1

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

        define Package/nodejs
        SUBMENU:=Node.js
        SECTION:=net
        CATEGORY:=Network
        TITLE:=Node.js Evented I/O for V8 JavaScript
        URL:=http://nodejs.org
        MAINTAINER:=Xin Ouyang <xinpascal@gmail.com>
        DEPENDS:=@armeb||@arm||@i386 +libstdcpp +libpthread +librt +libopenssl +uclibcxx
        endef

        define Package/nodejs/description
        Node.js is a platform built on Chrome's JavaScript runtime for easily
        building fast, scalable network applications. Node.js uses an event-driven,
        non-blocking I/O model that makes it lightweight and efficient, perfect
        for data-intensive real-time applications that run across distributed
        devices.
        endef

        define Package/nodejs-npm
        SUBMENU:=Node.js
        SECTION:=net
        CATEGORY:=Network
        TITLE:=Node Package Manager
        URL:=https://npmjs.org
        MAINTAINER:=Xin Ouyang <xinpascal@gmail.com>
        DEPENDS:=@armeb||@arm||@i386 +libstdcpp +libpthread +librt +libopenssl +uclibcxx
        endef

        define Package/nodejs-npm/description
        npm is the package manager for the Node JavaScript platform. It puts
        modules in place so that node can find them, and manages dependency
        conflicts intelligently.
        endef

        #We need to override all args becouse they are not compatible with the build script
        CONFIGURE_ARGS:=
        HOST_CONFIGURE_ARGS:=
        HOST_CONFIGURE_CMD:=$(HOST_CONFIGURE_VARS) ./configure  --without-snapshot ;
        CONFIGURE_ARGS:= --without-snapshot
        #HOST_CONFIGURE_ARGS:=
        HOST_MAKE_FLAGS += 
            BUILDTYPE=Release i18nsupport=off

        define Build/Prepare
        echo -e "\e[1;34m \nBuild/Prepare $(PKG_NAME)\n $<\e[0m"
        endef

        define Build/nodejs/Compile
        echo -e "\e[1;34m \n  Build/Compile $(PKG_NAME)    \n $<\e[0m"
        endef


        define Build/compile
        echo -e "\e[1;34m \nBuild/compile $(PKG_NAME)\n $<\e[0m" \
            $(MAKE) $(MAKE_FLAGS) -C $(PKG_BUILD_DIR) \
        DESTDIR="$(PKG_INSTALL_DIR)"
        endef

        define Package/nodejs/install
        echo -e "\e[1;34m \nBuild/install $(PKG_NAME)\n $<\e[0m" \
            $(MAKE) $(MAKE_FLAGS) -C $(PKG_BUILD_DIR) install DESTDIR=$(PKG_INSTALL_DIR)
            $(INSTALL_DIR) $(1)/usr/bin
            $(CP) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/node
        endef

        define Package/nodejs-npm/install
            $(INSTALL_DIR) $(1)/usr/bin
            $(CP) $(PKG_INSTALL_DIR)/usr/bin/npm $(1)/usr/bin/npm
            $(INSTALL_DIR) $(1)/usr/lib/node_modules
            $(CP) -r $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/ \
                $(1)/usr/lib/node_modules
        endef

        #define Build/InstallDev
        #   $(INSTALL_DIR) $(1)/usr/share/nodejs-src
        #   $(CP) $(PKG_BUILD_DIR)/* $(1)/usr/share/nodejs-src
        #endef

        $(eval $(call HostBuild))
        $(eval $(call BuildPackage,nodejs))
        $(eval $(call BuildPackage,nodejs-npm))

1 个答案:

答案 0 :(得分:1)

应该是Build/Compile,而不是compile(大写C)。