Build static on Linux.
authorCarl Hetherington <cth@carlh.net>
Fri, 24 Apr 2020 19:12:10 +0000 (21:12 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 24 Apr 2020 19:17:18 +0000 (21:17 +0200)
Makefile
blockdev/CMakeLists.txt
cscript
src/CMakeLists.txt

index 076a0219ca289bbe690e12ce32bb559137ef73b9..8125659259261b17779cd8729b9164075ddd19a1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -19,19 +19,29 @@ COMMON_DEFINITIONS =                                      \
        -DVERSION_MINOR=$(VERSION_MINOR)                      \
        -DVERSION_PATCH=$(VERSION_PATCH)                      \
        -DVERSION=$(VERSION)                                  \
-       -DLWEXT4_BUILD_SHARED_LIB=ON                          \
 
 define generate_common
        rm -R -f build_$(1)
        mkdir build_$(1)
        cd build_$(1) && cmake -G"Unix Makefiles"           \
        $(COMMON_DEFINITIONS)                               \
+       -DLWEXT4_BUILD_SHARED_LIB=ON                        \
+       $(2)                                                \
+       -DCMAKE_TOOLCHAIN_FILE=../toolchain/$(1).cmake ..
+endef
+
+define generate_common_static
+       rm -R -f build_$(1)
+       mkdir build_$(1)
+       cd build_$(1) && cmake -G"Unix Makefiles"           \
+       $(COMMON_DEFINITIONS)                               \
+       -DLWEXT4_BUILD_SHARED_LIB=OFF                       \
        $(2)                                                \
        -DCMAKE_TOOLCHAIN_FILE=../toolchain/$(1).cmake ..
 endef
 
 generic:
-       $(call generate_common,$@)
+       $(call generate_common_static,$@)
 
 osx:
        $(call generate_common,$@)
index e79cbb4cd750e152759433a27741e02232f59a81..e45f134a7788af8db5aa6b3ad85c509053b66c28 100644 (file)
@@ -9,5 +9,11 @@ else()
 endif()
 
 aux_source_directory(. BLOCKDEV_SRC)
-add_library(blockdev SHARED ${BLOCKDEV_SRC})
+
+if(LWEXT4_BUILD_SHARED_LIB)
+  add_library(blockdev SHARED ${BLOCKDEV_SRC})
+else()
+  add_library(blockdev STATIC ${BLOCKDEV_SRC})
+endif()
+
 
diff --git a/cscript b/cscript
index 57e7e885d9bd414b84f6127e90d7d17390519993..e118e158719dd507abb586262f272b17f200be7b 100644 (file)
--- a/cscript
+++ b/cscript
@@ -21,7 +21,7 @@ def build(target, options):
     if target.platform == 'linux':
         type = 'generic'
         blockdev = 'linux'
-        ext = 'so'
+        ext = 'a'
         device = 'dev'
     elif target.platform == 'osx':
         if target.bits == 64:
index 3b82fcf6a7d646ab53de28cb7485dc228ad3dae9..527664a5b3e6d88b72174c8bf3eded006268da2a 100644 (file)
@@ -19,4 +19,4 @@ endif()
 if  (DEFINED INSTALL_LIB)
 INSTALL(TARGETS lwext4 DESTINATION /usr/local/lib)
 INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/include/. DESTINATION /usr/local/include/lwext4)
-endif()
\ No newline at end of file
+endif()