- touch $(PKG_BUILD_DIR)/.configured
-
-$(PKG_IPK_DIR)/zebra: $(PKG_BUILD_DIR)/.configured
- $(MAKE) -C $(PKG_BUILD_DIR)
- $(MAKE) DESTDIR=$(PKG_IPK_DIR) -C $(PKG_BUILD_DIR) install
-
-$(PKG_IPK): $(PKG_IPK_DIR)/zebra
- cp -a ./ipkg/* $(PKG_IPK_DIR)/
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) control/$(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- mkdir -p $(PKG_IPK_DIR)/usr/sbin
- mkdir -p $(PKG_IPK_DIR)/usr/lib
- mkdir -p $(PKG_IPK_DIR)/etc/quagga
- rm $(PKG_IPK_DIR)/usr/lib/*.la
- rm -rf $(PKG_IPK_DIR)/usr/include
- rm -rf $(PKG_IPK_DIR)/usr/info
- rm -rf $(PKG_IPK_DIR)/usr/man
- $(STRIP) $(PKG_IPK_DIR)/usr/lib/*
- $(STRIP) $(PKG_IPK_DIR)/usr/sbin/*
- mkdir -p $(PACKAGE_DIR)
- $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/quagga.list: $(PKG_IPK)
- $(IPKG) install $(PKG_IPK)
-
-$(PKG_ZEBRA): $(PKG_IPK_DIR)/zebra
- mkdir -p $(PKG_ZEBRA_DIR)/etc/quagga
- mkdir -p $(PKG_ZEBRA_DIR)/usr/sbin
- mkdir -p $(PKG_ZEBRA_DIR)/usr/lib
- cp -a ./ipkg/* $(PKG_ZEBRA_DIR)/
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_ZEBRA_DIR) control/$(PKG_NAME)-zebra.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- cp $(PKG_IPK_DIR)/usr/sbin/zebra $(PKG_ZEBRA_DIR)/usr/sbin
- cp $(PKG_IPK_DIR)/usr/lib/libzebra* $(PKG_ZEBRA_DIR)/usr/lib
- $(IPKG_BUILD) $(PKG_ZEBRA_DIR) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/quagga-zebra.list: $(PKG_ZEBRA)
- $(IPKG) install $(PKG_ZEBRA)
-
-$(PKG_BGPD): $(PKG_IPK_DIR)/zebra
- mkdir -p $(PKG_BGPD_DIR)/etc/quagga
- mkdir -p $(PKG_BGPD_DIR)/usr/sbin
- cp -a ./ipkg/* $(PKG_BGPD_DIR)/
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_BGPD_DIR) control/$(PKG_NAME)-bgpd.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- cp $(PKG_IPK_DIR)/usr/sbin/bgpd $(PKG_BGPD_DIR)/usr/sbin
- $(IPKG_BUILD) $(PKG_BGPD_DIR) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/quagga-bgpd.list: $(PKG_BGPD)
- $(IPKG) install $(PKG_BGPD)
-
-$(PKG_RIPD): $(PKG_IPK_DIR)/zebra
- mkdir -p $(PKG_RIPD_DIR)/etc/quagga
- mkdir -p $(PKG_RIPD_DIR)/usr/sbin
- cp -a ./ipkg/* $(PKG_RIPD_DIR)/
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_RIPD_DIR) control/$(PKG_NAME)-ripd.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- cp $(PKG_IPK_DIR)/usr/sbin/ripd $(PKG_RIPD_DIR)/usr/sbin
- $(IPKG_BUILD) $(PKG_RIPD_DIR) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/quagga-ripd.list: $(PKG_RIPD)
- $(IPKG) install $(PKG_RIPD)
-
-$(PKG_OSPFD): $(PKG_IPK_DIR)/zebra
- mkdir -p $(PKG_OSPFD_DIR)/etc/quagga
- mkdir -p $(PKG_OSPFD_DIR)/usr/sbin
- mkdir -p $(PKG_OSPFD_DIR)/usr/lib
- cp -a ./ipkg/* $(PKG_OSPFD_DIR)/
- $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_OSPFD_DIR) control/$(PKG_NAME)-ospfd.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
- cp $(PKG_IPK_DIR)/usr/sbin/ospfd $(PKG_OSPFD_DIR)/usr/sbin
- cp $(PKG_IPK_DIR)/usr/lib/libospf* $(PKG_OSPFD_DIR)/usr/lib
- $(IPKG_BUILD) $(PKG_OSPFD_DIR) $(PACKAGE_DIR)
-
-$(IPKG_STATE_DIR)/info/quagga-ospfd.list: $(PKG_OSPFD)
- $(IPKG) install $(PKG_OSPFD)
-
-source: $(DL_DIR)/$(PKG_SOURCE)
-prepare: $(PKG_BUILD_DIR)/.unpacked
-compile: $(TARGETS)
-install: $(INSTALL_TARGETS)
-
-clean:
- rm -rf $(PKG_BUILD_DIR)
- rm -f $(PKG_IPK) $(PKG_ZEBRA) $(PKG_OSPFD) $(PKG_RIPD) $(PKG_BGPD)
+ touch $@
+
+$(PKG_BUILD_DIR)/.built:
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ DESTDIR=$(PKG_INSTALL_DIR) \
+ all install
+ touch $@
+
+$(IPKG_QUAGGA):
+ install -d -m0755 $(IDIR_QUAGGA)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(IDIR_QUAGGA)/usr/lib/
+ install -d -m0755 $(IDIR_QUAGGA)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(IDIR_QUAGGA)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(IDIR_QUAGGA)/usr/sbin/
+ # avoid /etc being set to 0750
+ install -d -m0755 $(IDIR_QUAGGA)/etc/quagga/
+ chmod 0750 $(IDIR_QUAGGA)/etc/quagga/
+ install -d -m0755 $(IDIR_QUAGGA)/etc/init.d/
+ install -m0755 ./files/quagga.init $(IDIR_QUAGGA)/etc/init.d/quagga
+ ln -sf quagga $(IDIR_QUAGGA)/etc/init.d/S49quagga
+ install -d -m0755 $(IDIR_QUAGGA)/var/run/quagga
+ $(RSTRIP) $(IDIR_QUAGGA)
+ $(IPKG_BUILD) $(IDIR_QUAGGA) $(PACKAGE_DIR)
+
+$(IPKG_QUAGGA_BGPD):
+ install -d -m0755 $(IDIR_QUAGGA_BGPD)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(IDIR_QUAGGA_BGPD)/usr/sbin/
+ $(RSTRIP) $(IDIR_QUAGGA_BGPD)
+ $(IPKG_BUILD) $(IDIR_QUAGGA_BGPD) $(PACKAGE_DIR)
+
+$(IPKG_QUAGGA_OSPFD):
+ install -d -m0755 $(IDIR_QUAGGA_OSPFD)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(IDIR_QUAGGA_OSPFD)/usr/lib/
+ install -d -m0755 $(IDIR_QUAGGA_OSPFD)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(IDIR_QUAGGA_OSPFD)/usr/sbin/
+ $(RSTRIP) $(IDIR_QUAGGA_OSPFD)
+ $(IPKG_BUILD) $(IDIR_QUAGGA_OSPFD) $(PACKAGE_DIR)
+
+$(IPKG_QUAGGA_OSPF6D):
+ install -d -m0755 $(IDIR_QUAGGA_OSPF6D)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(IDIR_QUAGGA_OSPF6D)/usr/sbin/
+ $(RSTRIP) $(IDIR_QUAGGA_OSPF6D)
+ $(IPKG_BUILD) $(IDIR_QUAGGA_OSPF6D) $(PACKAGE_DIR)
+
+$(IPKG_QUAGGA_RIPD):
+ install -d -m0755 $(IDIR_QUAGGA_RIPD)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(IDIR_QUAGGA_RIPD)/usr/sbin/
+ $(RSTRIP) $(IDIR_QUAGGA_RIPD)
+ $(IPKG_BUILD) $(IDIR_QUAGGA_RIPD) $(PACKAGE_DIR)
+
+$(IPKG_QUAGGA_RIPNGD):
+ install -d -m0755 $(IDIR_QUAGGA_RIPNGD)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(IDIR_QUAGGA_RIPNGD)/usr/sbin/
+ $(RSTRIP) $(IDIR_QUAGGA_RIPNGD)
+ $(IPKG_BUILD) $(IDIR_QUAGGA_RIPNGD) $(PACKAGE_DIR)
+
+$(IPKG_QUAGGA_VTYSH):
+ install -d -m0755 $(IDIR_QUAGGA_VTYSH)/usr/bin
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(IDIR_QUAGGA_VTYSH)/usr/bin/
+ $(RSTRIP) $(IDIR_QUAGGA_VTYSH)
+ $(IPKG_BUILD) $(IDIR_QUAGGA_VTYSH) $(PACKAGE_DIR)