From 5b350e42d1fdf62908bfc099dd942ea8e21c64a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0tetiar?= Date: Fri, 4 Oct 2019 15:47:25 +0200 Subject: [PATCH] refactor into separate Git project MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit For improved reusability, testing etc. Signed-off-by: Petr Å tetiar --- Makefile | 57 ++++--------------- src/attr.c => attr.c | 0 src/cache.c => cache.c | 0 src/cache_mngt.c => cache_mngt.c | 0 src/error.c => error.c | 0 src/genl.c => genl.c | 0 src/genl_ctrl.c => genl_ctrl.c | 0 src/genl_family.c => genl_family.c | 0 src/genl_mngt.c => genl_mngt.c | 0 src/handlers.c => handlers.c | 0 {src/include => include}/netlink-generic.h | 0 {src/include => include}/netlink-local.h | 0 {src/include => include}/netlink-types.h | 0 {src/include => include}/netlink/addr.h | 0 {src/include => include}/netlink/attr.h | 0 {src/include => include}/netlink/cache-api.h | 0 {src/include => include}/netlink/cache.h | 0 {src/include => include}/netlink/data.h | 0 {src/include => include}/netlink/errno.h | 0 {src/include => include}/netlink/genl/ctrl.h | 0 .../include => include}/netlink/genl/family.h | 0 {src/include => include}/netlink/genl/genl.h | 0 {src/include => include}/netlink/genl/mngt.h | 0 {src/include => include}/netlink/handlers.h | 0 {src/include => include}/netlink/list.h | 0 {src/include => include}/netlink/msg.h | 0 .../netlink/netlink-compat.h | 0 .../netlink/netlink-kernel.h | 0 {src/include => include}/netlink/netlink.h | 0 {src/include => include}/netlink/object-api.h | 0 {src/include => include}/netlink/object.h | 0 {src/include => include}/netlink/socket.h | 0 {src/include => include}/netlink/types.h | 0 {src/include => include}/netlink/utils.h | 0 {src/include => include}/netlink/version.h | 0 {src/include => include}/unl.h | 0 files/libnl-tiny.pc => libnl-tiny.pc | 0 src/msg.c => msg.c | 0 src/nl.c => nl.c | 0 src/object.c => object.c | 0 src/socket.c => socket.c | 0 src/Makefile | 17 ------ src/unl.c => unl.c | 0 43 files changed, 12 insertions(+), 62 deletions(-) rename src/attr.c => attr.c (100%) rename src/cache.c => cache.c (100%) rename src/cache_mngt.c => cache_mngt.c (100%) rename src/error.c => error.c (100%) rename src/genl.c => genl.c (100%) rename src/genl_ctrl.c => genl_ctrl.c (100%) rename src/genl_family.c => genl_family.c (100%) rename src/genl_mngt.c => genl_mngt.c (100%) rename src/handlers.c => handlers.c (100%) rename {src/include => include}/netlink-generic.h (100%) rename {src/include => include}/netlink-local.h (100%) rename {src/include => include}/netlink-types.h (100%) rename {src/include => include}/netlink/addr.h (100%) rename {src/include => include}/netlink/attr.h (100%) rename {src/include => include}/netlink/cache-api.h (100%) rename {src/include => include}/netlink/cache.h (100%) rename {src/include => include}/netlink/data.h (100%) rename {src/include => include}/netlink/errno.h (100%) rename {src/include => include}/netlink/genl/ctrl.h (100%) rename {src/include => include}/netlink/genl/family.h (100%) rename {src/include => include}/netlink/genl/genl.h (100%) rename {src/include => include}/netlink/genl/mngt.h (100%) rename {src/include => include}/netlink/handlers.h (100%) rename {src/include => include}/netlink/list.h (100%) rename {src/include => include}/netlink/msg.h (100%) rename {src/include => include}/netlink/netlink-compat.h (100%) rename {src/include => include}/netlink/netlink-kernel.h (100%) rename {src/include => include}/netlink/netlink.h (100%) rename {src/include => include}/netlink/object-api.h (100%) rename {src/include => include}/netlink/object.h (100%) rename {src/include => include}/netlink/socket.h (100%) rename {src/include => include}/netlink/types.h (100%) rename {src/include => include}/netlink/utils.h (100%) rename {src/include => include}/netlink/version.h (100%) rename {src/include => include}/unl.h (100%) rename files/libnl-tiny.pc => libnl-tiny.pc (100%) rename src/msg.c => msg.c (100%) rename src/nl.c => nl.c (100%) rename src/object.c => object.c (100%) rename src/socket.c => socket.c (100%) delete mode 100644 src/Makefile rename src/unl.c => unl.c (100%) diff --git a/Makefile b/Makefile index cabbb08..6f37160 100644 --- a/Makefile +++ b/Makefile @@ -1,50 +1,17 @@ -# -# Copyright (C) 2006-2012 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +CC=gcc +WFLAGS=-Wall +CFLAGS=-O2 +INCLUDES=-Iinclude -include $(TOPDIR)/rules.mk +LIBNAME=libnl-tiny.so -PKG_NAME:=libnl-tiny -PKG_VERSION:=0.1 -PKG_RELEASE:=5 +all: $(LIBNAME) -PKG_LICENSE:=LGPL-2.1 -PKG_MAINTAINER:=Felix Fietkau +%.o: %.c + $(CC) $(WFLAGS) -c -o $@ $(INCLUDES) $(CFLAGS) $< -include $(INCLUDE_DIR)/package.mk +LIBNL_OBJ=nl.o handlers.o msg.o attr.o cache.o cache_mngt.o object.o socket.o error.o +GENL_OBJ=genl.o genl_family.o genl_ctrl.o genl_mngt.o unl.o -define Package/libnl-tiny - SECTION:=libs - CATEGORY:=Libraries - TITLE:=netlink socket library -endef - -define Package/libnl-tiny/description - This package contains a stripped down version of libnl -endef - -TARGET_CFLAGS += $(FPIC) - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) \ - $(TARGET_CONFIGURE_OPTS) \ - CFLAGS="$(TARGET_CFLAGS)" \ - all -endef - -define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/lib/pkgconfig $(1)/usr/include/libnl-tiny - $(CP) $(PKG_BUILD_DIR)/include/* $(1)/usr/include/libnl-tiny - $(CP) $(PKG_BUILD_DIR)/libnl-tiny.so $(1)/usr/lib/ - $(CP) ./files/libnl-tiny.pc $(1)/usr/lib/pkgconfig -endef - -define Package/libnl-tiny/install - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_BUILD_DIR)/libnl-tiny.so $(1)/usr/lib/ -endef - -$(eval $(call BuildPackage,libnl-tiny)) +$(LIBNAME): $(LIBNL_OBJ) $(GENL_OBJ) + $(CC) $(CFLAGS) -Wl,-Bsymbolic-functions -shared -o $@ $^ diff --git a/src/attr.c b/attr.c similarity index 100% rename from src/attr.c rename to attr.c diff --git a/src/cache.c b/cache.c similarity index 100% rename from src/cache.c rename to cache.c diff --git a/src/cache_mngt.c b/cache_mngt.c similarity index 100% rename from src/cache_mngt.c rename to cache_mngt.c diff --git a/src/error.c b/error.c similarity index 100% rename from src/error.c rename to error.c diff --git a/src/genl.c b/genl.c similarity index 100% rename from src/genl.c rename to genl.c diff --git a/src/genl_ctrl.c b/genl_ctrl.c similarity index 100% rename from src/genl_ctrl.c rename to genl_ctrl.c diff --git a/src/genl_family.c b/genl_family.c similarity index 100% rename from src/genl_family.c rename to genl_family.c diff --git a/src/genl_mngt.c b/genl_mngt.c similarity index 100% rename from src/genl_mngt.c rename to genl_mngt.c diff --git a/src/handlers.c b/handlers.c similarity index 100% rename from src/handlers.c rename to handlers.c diff --git a/src/include/netlink-generic.h b/include/netlink-generic.h similarity index 100% rename from src/include/netlink-generic.h rename to include/netlink-generic.h diff --git a/src/include/netlink-local.h b/include/netlink-local.h similarity index 100% rename from src/include/netlink-local.h rename to include/netlink-local.h diff --git a/src/include/netlink-types.h b/include/netlink-types.h similarity index 100% rename from src/include/netlink-types.h rename to include/netlink-types.h diff --git a/src/include/netlink/addr.h b/include/netlink/addr.h similarity index 100% rename from src/include/netlink/addr.h rename to include/netlink/addr.h diff --git a/src/include/netlink/attr.h b/include/netlink/attr.h similarity index 100% rename from src/include/netlink/attr.h rename to include/netlink/attr.h diff --git a/src/include/netlink/cache-api.h b/include/netlink/cache-api.h similarity index 100% rename from src/include/netlink/cache-api.h rename to include/netlink/cache-api.h diff --git a/src/include/netlink/cache.h b/include/netlink/cache.h similarity index 100% rename from src/include/netlink/cache.h rename to include/netlink/cache.h diff --git a/src/include/netlink/data.h b/include/netlink/data.h similarity index 100% rename from src/include/netlink/data.h rename to include/netlink/data.h diff --git a/src/include/netlink/errno.h b/include/netlink/errno.h similarity index 100% rename from src/include/netlink/errno.h rename to include/netlink/errno.h diff --git a/src/include/netlink/genl/ctrl.h b/include/netlink/genl/ctrl.h similarity index 100% rename from src/include/netlink/genl/ctrl.h rename to include/netlink/genl/ctrl.h diff --git a/src/include/netlink/genl/family.h b/include/netlink/genl/family.h similarity index 100% rename from src/include/netlink/genl/family.h rename to include/netlink/genl/family.h diff --git a/src/include/netlink/genl/genl.h b/include/netlink/genl/genl.h similarity index 100% rename from src/include/netlink/genl/genl.h rename to include/netlink/genl/genl.h diff --git a/src/include/netlink/genl/mngt.h b/include/netlink/genl/mngt.h similarity index 100% rename from src/include/netlink/genl/mngt.h rename to include/netlink/genl/mngt.h diff --git a/src/include/netlink/handlers.h b/include/netlink/handlers.h similarity index 100% rename from src/include/netlink/handlers.h rename to include/netlink/handlers.h diff --git a/src/include/netlink/list.h b/include/netlink/list.h similarity index 100% rename from src/include/netlink/list.h rename to include/netlink/list.h diff --git a/src/include/netlink/msg.h b/include/netlink/msg.h similarity index 100% rename from src/include/netlink/msg.h rename to include/netlink/msg.h diff --git a/src/include/netlink/netlink-compat.h b/include/netlink/netlink-compat.h similarity index 100% rename from src/include/netlink/netlink-compat.h rename to include/netlink/netlink-compat.h diff --git a/src/include/netlink/netlink-kernel.h b/include/netlink/netlink-kernel.h similarity index 100% rename from src/include/netlink/netlink-kernel.h rename to include/netlink/netlink-kernel.h diff --git a/src/include/netlink/netlink.h b/include/netlink/netlink.h similarity index 100% rename from src/include/netlink/netlink.h rename to include/netlink/netlink.h diff --git a/src/include/netlink/object-api.h b/include/netlink/object-api.h similarity index 100% rename from src/include/netlink/object-api.h rename to include/netlink/object-api.h diff --git a/src/include/netlink/object.h b/include/netlink/object.h similarity index 100% rename from src/include/netlink/object.h rename to include/netlink/object.h diff --git a/src/include/netlink/socket.h b/include/netlink/socket.h similarity index 100% rename from src/include/netlink/socket.h rename to include/netlink/socket.h diff --git a/src/include/netlink/types.h b/include/netlink/types.h similarity index 100% rename from src/include/netlink/types.h rename to include/netlink/types.h diff --git a/src/include/netlink/utils.h b/include/netlink/utils.h similarity index 100% rename from src/include/netlink/utils.h rename to include/netlink/utils.h diff --git a/src/include/netlink/version.h b/include/netlink/version.h similarity index 100% rename from src/include/netlink/version.h rename to include/netlink/version.h diff --git a/src/include/unl.h b/include/unl.h similarity index 100% rename from src/include/unl.h rename to include/unl.h diff --git a/files/libnl-tiny.pc b/libnl-tiny.pc similarity index 100% rename from files/libnl-tiny.pc rename to libnl-tiny.pc diff --git a/src/msg.c b/msg.c similarity index 100% rename from src/msg.c rename to msg.c diff --git a/src/nl.c b/nl.c similarity index 100% rename from src/nl.c rename to nl.c diff --git a/src/object.c b/object.c similarity index 100% rename from src/object.c rename to object.c diff --git a/src/socket.c b/socket.c similarity index 100% rename from src/socket.c rename to socket.c diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 6f37160..0000000 --- a/src/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CC=gcc -WFLAGS=-Wall -CFLAGS=-O2 -INCLUDES=-Iinclude - -LIBNAME=libnl-tiny.so - -all: $(LIBNAME) - -%.o: %.c - $(CC) $(WFLAGS) -c -o $@ $(INCLUDES) $(CFLAGS) $< - -LIBNL_OBJ=nl.o handlers.o msg.o attr.o cache.o cache_mngt.o object.o socket.o error.o -GENL_OBJ=genl.o genl_family.o genl_ctrl.o genl_mngt.o unl.o - -$(LIBNAME): $(LIBNL_OBJ) $(GENL_OBJ) - $(CC) $(CFLAGS) -Wl,-Bsymbolic-functions -shared -o $@ $^ diff --git a/src/unl.c b/unl.c similarity index 100% rename from src/unl.c rename to unl.c -- 2.30.2