私は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:[email protected]_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)が定義されている場所が見つかりましたが、他の場所は定義されていませんでした。
ありがとう