Openwrtda makefiles, CP va $ (CP) o'rtasidagi farq

Openwrtda o'z to'plamimni tuzish bo'yicha qo'llanmaga amal qilaman.

/ Package/helloworld katalogida:

.../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 haqida ikkita savolim bor:

  1. Mkdir, $ (Cp), $ (MAKE) kabi buyruqlar mavjudligini topdim. Men $ (CP) ni CP ga o'zgartirdim va kompilyatsiya yaxshi ketmoqda. Shunday qilib, men bu ikki turdagi formatni nima uchun tark etishini tushunmayman.

  2. $ (PKG_BUILD_DIR), $ (INSTALL_DIR) kabi parametrlarni openwrt da aniqlanadimi? Faqatgina $ (TOPDIR) belgilanadigan joyni topdim, ammo boshqalar emas.

Rahmat

0

1 javoblar

  1. These are not different kinds of formats, cp is a Linux command, $(CP) is a makefile construction for "getting the value of make variable CP". Thus, under Linux it should expand to cp (i.e. should be initialized with this value somewhere), and , most probably, to copy under Windows (this is all particular setup-dependent since cp is not fully the same as copy). The same with $(MKDIR) and other system tools.

    1.1. $(MAKE) is actually another thing - this is a special make variable which expands to make tool name with arguments/flags passed from command line. Read this.

  2. These are all variables controlling where to build and where to install. See description here.

2
qo'shib qo'ydi