- touch $@
-
-$(PKG_BUILD_DIR)/.built:
- $(MAKE) -j1 -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) KERNEL_INCLUDE=$(LINUX_DIR)/include all tc/tc ip/ip
- touch $@
-
-$(IPKG_IPROUTE2_IP):
- mkdir -p $(IDIR_IPROUTE2_IP)/usr/sbin
- cp $(PKG_BUILD_DIR)/ip/ip $(IDIR_IPROUTE2_IP)/usr/sbin/
- $(STRIP) $(IDIR_IPROUTE2_IP)/usr/sbin/*
- $(IPKG_BUILD) $(IDIR_IPROUTE2_IP) $(PACKAGE_DIR)
-
-$(IPKG_IPROUTE2_TC):
- mkdir -p $(IDIR_IPROUTE2_TC)/usr/sbin
- cp $(PKG_BUILD_DIR)/ip/ip $(IDIR_IPROUTE2_TC)/usr/sbin/
- $(STRIP) $(IDIR_IPROUTE2_TC)/usr/sbin/*
- $(IPKG_BUILD) $(IDIR_IPROUTE2_TC) $(PACKAGE_DIR)
+endef
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR)/netem HOSTCC="$(HOSTCC)" CFLAGS="-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -I ../include -DRESOLVE_HOSTNAMES"
+ $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) KERNEL_INCLUDE=$(LINUX_DIR)/include all tc/tc ip/ip
+endef
+
+define Package/ip/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_DIR) $(1)/etc/iproute2
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/iproute2/rt_tables $(1)/etc/iproute2
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
+endef
+
+define Package/tc/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
+endef
+
+define Package/genl/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,ip))
+$(eval $(call BuildPackage,tc))
+$(eval $(call BuildPackage,genl))
+