openwrt で自分のパッケージをコンパイルするためのチュートリアルに従っています。
/package/helloworld ディレクトリで:
.../packege/helloworld$ ls
src Makefile
.../packege/helloworld$ ls src
hello.c main.c Makefile
.../packege/helloworld$vi Makefile
#helloworld makefile
include $(TOPDIR)/rules.mk
PKG_NAME:=helloworld
PKG_RELEASE:=1
PKG_VERSION:=0.1
PKG_BUILD_DEPENDS:=
include $(INCLUDE_DIR)/package.mk
define Package/helloworld
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=@TARGET_etrax
TITLE:=Yet Another Helloworld Application
endef
define Package/helloworld/description
This is helloworld :p
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) \
CFLAGS="$(TARGET_CFLAGS)"
endef
define Package/helloworld/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/usr/bin/
endef
$(eval $(call BuildPackage,helloworld))
この Makefile について 2 つの質問があります。
mkdir、$(CP)、$(MAKE) などのコマンドがあることがわかりました。$(CP) を cp に変更したところ、コンパイルがうまくいきました。したがって、これら 2 種類の形式が存在する理由がわかりません。
$(PKG_BUILD_DIR)、$(INSTALL_DIR) などのパラメータは openwrt で定義されていますか? $(TOPDIR) が定義されている場所を見つけましたが、他の場所は見つかりませんでした。
ありがとう