-$(PKG_IPK): $(PKG_BUILD_DIR)/src/chilli
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- mkdir -p $(PKG_IPK_DIR)/usr/sbin
- cp $(PKG_BUILD_DIR)/src/chilli $(PKG_IPK_DIR)/usr/sbin/
- $(STRIP) $(PKG_IPK_DIR)/usr/sbin/*
- mkdir -p $(PKG_IPK_DIR)/etc
- cp $(PKG_BUILD_DIR)/doc/chilli.conf $(PKG_IPK_DIR)/etc
- cp -a ./ipkg/* $(PKG_IPK_DIR)/
- find $(PKG_IPK_DIR) -name CVS | xargs rm -rf
- mkdir -p $(PACKAGE_DIR)
- $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
+$(PKG_INSTALL_DIR)/usr/sbin/chilli: $(PKG_BUILD_DIR)/.built
+ mkdir -p $(PKG_INSTALL_DIR)
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ DESTDIR="$(PKG_INSTALL_DIR)" \
+ install
+
+$(IPKG_CHILLISPOT): $(PKG_INSTALL_DIR)/usr/sbin/chilli
+ $(SCRIPT_DIR)/make-ipkg-dir.sh $(IDIR_CHILLISPOT) ./ipkg/$(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
+ install -m0644 ./ipkg/$(PKG_NAME).conffiles $(IDIR_CHILLISPOT)/CONTROL/conffiles
+ install -m0755 -d $(IDIR_CHILLISPOT)/etc/init.d
+ install -m0755 ./ipkg/$(PKG_NAME).init $(IDIR_CHILLISPOT)/etc/init.d/chilli
+ install -m0755 -d $(IDIR_CHILLISPOT)/etc
+ install -m0644 $(PKG_BUILD_DIR)/doc/chilli.conf $(IDIR_CHILLISPOT)/etc/
+ install -m0755 -d $(IDIR_CHILLISPOT)/usr/sbin
+ cp -fpR $(PKG_INSTALL_DIR)/usr/sbin/chilli $(IDIR_CHILLISPOT)/usr/sbin/
+ $(RSTRIP) $(IDIR_CHILLISPOT)
+ $(IPKG_BUILD) $(IDIR_CHILLISPOT) $(PACKAGE_DIR)