[source] swconfig: replace the shared library with a static one

LEDE Commits lede-commits at lists.infradead.org
Wed Dec 14 03:13:58 PST 2016


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/e82c8d6e20ab34f61621ec9ab7d16959d268124d

commit e82c8d6e20ab34f61621ec9ab7d16959d268124d
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Tue Dec 13 13:15:05 2016 +0100

    swconfig: replace the shared library with a static one
    
    Reduces binary size
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/network/config/swconfig/Makefile     | 3 +--
 package/network/config/swconfig/src/Makefile | 7 ++++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/package/network/config/swconfig/Makefile b/package/network/config/swconfig/Makefile
index d1c8fd7..e4a00d6 100644
--- a/package/network/config/swconfig/Makefile
+++ b/package/network/config/swconfig/Makefile
@@ -42,13 +42,12 @@ define Build/InstallDev
 	$(CP) $(PKG_BUILD_DIR)/swlib.h $(1)/usr/include/
 
 	$(INSTALL_DIR) $(1)/usr/lib
-	$(CP) $(PKG_BUILD_DIR)/libsw.so $(1)/usr/lib/
+	$(CP) $(PKG_BUILD_DIR)/libsw.a $(1)/usr/lib/
 endef
 
 define Package/swconfig/install
 	$(INSTALL_DIR) $(1)/sbin $(1)/lib/network
 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/swconfig $(1)/sbin/swconfig
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/libsw.so $(1)/lib
 	$(INSTALL_DATA) ./files/switch.sh $(1)/lib/network/
 endef
 
diff --git a/package/network/config/swconfig/src/Makefile b/package/network/config/swconfig/src/Makefile
index 1176bf0..e972a44 100644
--- a/package/network/config/swconfig/src/Makefile
+++ b/package/network/config/swconfig/src/Makefile
@@ -8,8 +8,9 @@ all: swconfig
 %.o: %.c
 	$(CC) $(CFLAGS) -fPIC -c -o $@ $^
 
-libsw.so: swlib.o
-	$(CC) $(CFLAGS) -fPIC -shared -o $@ swlib.o
+libsw.a: swlib.o
+	$(AR) rcu $@ swlib.o
+	$(RANLIB) $@
 
-swconfig: libsw.so cli.o uci.o
+swconfig: libsw.a cli.o uci.o
 	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -L./ -lsw



More information about the lede-commits mailing list