2016-01-25 94 views
0

我正在使用OpenWRT SDK編譯用戶包。 src文件位於OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686/package/adapter/src中。Openwrt SDK:拒絕Makefile權限

在/適配器/ src目錄下,我也有在Makefile:

adapter: adapter.o 
    $(CC) $(LDFLAGS) adapter.o -o adapter 
adapter.o: adapter.c 
    $(CC) $(CFLAGS) -c adapter.c 
clean: 
    rm *.o adapter 

運行本地做出/適配器/ src目錄下正常工作。

然後我說下面的Makefile到/適配器目錄:

include $(TOPDIR)/rules.mk 
PKG_NAME:=adapter 
PKG_RELEASE=1 

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

include $(INCLUDE_DIR)/package.mk 

define Package/adapter 
    SECTION:=utils 
    CATEGORY:=Utilities 
    TITLE:=adapter --prints a dummy message 
endef 

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

define Build/Compile 
    $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) 
endef 

define Package/adapter/install 
    $(INSTALL_DIR) $(1)/bin 
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/adapter $(1)/bin 
endef 

$(eval $(call BuildPackage,adapter)) 

當我運行make在頂級目錄,我得到了以下錯誤:

[email protected]:~/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686$ make V=99 
Collecting package info: done 
# 
# configuration written to .config 
# 
make[1]: Entering directory `/home/zy/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686' 
make[2]: Entering directory `/home/zy/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686' 
make[3]: Entering directory `/home/zy/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686/package/adapter' 
mkdir -p /home/zy/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686/build_dir/target-mips_34kc_musl-1.1.11/adapter 
./src/* /home/zy/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686/build_dir/target-mips_34kc_musl-1.1.11/adapter 
bash: ./src/Makefile: Permission denied 
make[3]: *** [/home/zy/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686/build_dir/target-mips_34kc_musl-1.1.11/adapter/.prepared_e0632caf1f416a667d5957a7f385ceb6] Error 126 
make[3]: Leaving directory `/home/zy/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686/package/adapter' 
make[2]: *** [package/adapter/compile] Error 2 
make[2]: Leaving directory `/home/zy/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686' 
make[1]: *** [/home/zy/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686/staging_dir/target-mips_34kc_musl-1.1.11/stamp/.package_compile] Error 2 
make[1]: Leaving directory `/home/zy/openwrt/OpenWrt-SDK-ar71xx-generic_gcc-5.2.0_musl-1.1.11.Linux-i686' 
make: *** [world] Error 2 

運行作出詞根同樣的錯誤。有人可以提醒嗎?謝謝!

回答

0

根據您的信息,我認爲這個錯誤可能是由Makefile在/ adapter目錄中導致的。

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

要修改這樣的:

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

$(CP)是一個變量,在rules.mk CP:=cp -fpR 定義,所以你可以用它來複制的東西。

+0

它工作。謝謝! –