- all install
- touch $@
-
-$(IPKG_FDISK):
- install -d -m0755 $(IDIR_FDISK)/usr/sbin
- cp -fpR $(PKG_INSTALL_DIR)/sbin/fdisk $(IDIR_FDISK)/usr/sbin/
- $(RSTRIP) $(IDIR_FDISK)
- $(IPKG_BUILD) $(IDIR_FDISK) $(PACKAGE_DIR)
-
-$(IPKG_SWAP_UTILS):
- install -d -m0755 $(IDIR_SWAP_UTILS)/usr/sbin
- cp -fpR $(PKG_INSTALL_DIR)/sbin/mkswap $(IDIR_SWAP_UTILS)/usr/sbin/
- cp -fpR $(PKG_INSTALL_DIR)/sbin/swap{on,off} $(IDIR_SWAP_UTILS)/usr/sbin/
- $(RSTRIP) $(IDIR_SWAP_UTILS)
- $(IPKG_BUILD) $(IDIR_SWAP_UTILS) $(PACKAGE_DIR)
-
-mostlyclean:
- -$(MAKE) -C $(PKG_BUILD_DIR) clean
- rm -f $(PKG_BUILD_DIR)/.built
+ DESTDIR="$(PKG_INSTALL_DIR)" \
+ all install \
+ )
+endef
+
+define Package/Template
+ @if [ \! -f "$(PKG_INSTALL_DIR)/$(1)" ]; then \
+ rm -f $(PKG_BUILD_DIR)/.built; \
+ $(MAKE) $(PKG_BUILD_DIR)/.built; \
+ fi
+ $(INSTALL_DIR) $(2)
+ $(CP) $(PKG_INSTALL_DIR)/$(1) $(2)/
+endef
+
+define Package/fdisk/install
+ $(call Package/Template,sbin/fdisk,$(1)/usr/sbin)
+endef
+
+define Package/losetup/install
+ $(call Package/Template,sbin/losetup,$(1)/usr/sbin)
+endef
+
+define Package/swap-utils/install
+ $(call Package/Template,sbin/mkswap,$(1)/usr/sbin)
+ $(call Package/Template,sbin/swapon,$(1)/usr/sbin)
+ $(call Package/Template,sbin/swapoff,$(1)/usr/sbin)
+endef
+
+$(eval $(call BuildPackage,fdisk))
+$(eval $(call BuildPackage,losetup))
+$(eval $(call BuildPackage,swap-utils))