Shell-script called with argument $(1) from Package/install gives IDIR_pkg unknown error


I wanted to update a conf file of an existing ipkg in build_dir/ conditionally.

define Package/$(PKG_NAME)/install
   $(INSTALL_DIR) $(1)/lib/wifi
   $(INSTALL_DATA) ./files/ap.conf $(1)/lib/wifi
   $(if $(CONFIG_NEW_FEAT), \
      $(shell $(STAGING_DIR)/usr/include/ $(1)/lib/wifi/ap.conf), \
      $(warning "NEW_FEAT might not be enabled"))

The is part of a new update-pkg which is added to DEPENDS list of ap-pkg.

Script's being invoked as expected, but the argument seen by is IDIR_ap-pkg.
Unable to understand 'IDIR_'. I coudn't find any reference to such variable/usage in Wiki. I get that IDIR_ap-pkg is passed to Package/install by caller and is somehow defined properly in OPENWRT Build environment, but external script cannot find the definition and script errors - IDIR_ap-pkg/lib/wifi/ap.conf: no such command.


  1. Don't mind me using staging_dir/usr/include/ to copy my new files. I'll clean it up later.
  2. seems a MUST in my design, I shouldn't directly add any shell script line in existing makefile.
  3. I also tried in update-pkg folder, included mk in ap-pkg makefile, but fails saying no such file or directory. I think it's because include statements are all taken and processed first before my update-pkg installs mk file.

Hope you can help with some solution.
Thanks in advance.

What does it mean $(1)? $1 is just first argument.

I know command substitution: $(command)