]> granicus.if.org Git - re2c/commitdiff
Use libtool to build libraries.
authorUlya Trofimovich <skvadrik@gmail.com>
Sat, 19 Jan 2019 11:57:16 +0000 (11:57 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Sat, 19 Jan 2019 11:57:16 +0000 (11:57 +0000)
14 files changed:
.travis.yml
re2c/Makefile.am
re2c/Makefile.libre2c_posix.am
re2c/__build.sh
re2c/__build_asan.sh
re2c/__build_clang.sh
re2c/__build_clang_msan.sh
re2c/__build_lsan.sh
re2c/__build_m32.sh
re2c/__build_mingw.sh
re2c/__build_redundant_exports.sh
re2c/__build_ubsan.sh
re2c/__distcheck.sh
re2c/configure.ac

index 43d486c673b6e2d2913dd73fef43813ad8536a4e..f1a31e8d4f4515747ff785e25da793e98006dc17 100644 (file)
@@ -24,7 +24,8 @@ script:
     $CONFIG_DIR/configure \
         --prefix="$(pwd)"/re2c-install \
         --enable-docs \
-        --enable-debug
+        --enable-debug \
+        --enable-libs
   - make -j$(nproc)
   - make -j$(nproc) check VERBOSE=1
   - make -j$(nproc) install
index 092af731a942d02a6e05edd8dca21db8b53d233e..7dfac23c80eec65b937ee05f52102ee7655563bc 100644 (file)
@@ -2,7 +2,7 @@
 # do *not* add CXXFLAGS here, add them in configure.ac
 AM_CXXFLAGS = $(CXXFLAGSDEFAULT)
 if DEBUG
-    AM_CXXFLAGS += -DRE2C_DEBUG
+AM_CXXFLAGS += -DRE2C_DEBUG
 endif
 RE2CFLAGS = -b -W
 
@@ -176,6 +176,9 @@ re2c_GEN = \
        $(re2c_GEN_HDR)
 nodist_re2c_SOURCES = $(re2c_GEN)
 
+# custom rules create headers and must go before normal rules
+BUILT_SOURCES = $(re2c_GEN_SRC)
+
 # bootstrap sources
 re2c_BOOT_PARSER = bootstrap/src/parse/parser.cc
 re2c_BOOT_PARSER_HDR = bootstrap/src/parse/parser.h
@@ -269,9 +272,6 @@ CLEANFILES = \
 # lexer depends on bison-generated header
 $(re2c_GEN_LEX): $(re2c_GEN_PARSER)
 
-# generate all sources before compiling
-all: $(re2c_GEN_SRC)
-
 # rebuild all re2c sources using newly built re2c
 .PHONY: bootstrap
 bootstrap: all
@@ -340,4 +340,10 @@ TESTS = \
        $(re2c_TESTSUITE) \
        $(check_PROGRAMS)
 
+# libraries go here (in included .am files)
+if WITH_LIBS
+ACLOCAL_AMFLAGS = -I m4
+lib_LTLIBRARIES =
 include $(top_srcdir)/Makefile.libre2c_posix.am
+endif
+
index 435be8e800c06b6c7cf9a08b48e1447814f76dfd..b02ba3514b1e24dda3d4df9f3183b88816b2e182 100644 (file)
@@ -1,10 +1,11 @@
 # this file is incomplete and should be included from the main Makefile.am
 
-noinst_LIBRARIES = libre2c_posix.a
+lib_LTLIBRARIES += libre2c_posix.la
 
-libre2c_posix_a_CXXFLAGS = $(AM_CXXFLAGS) -fPIC
+libre2c_posix_la_CXXFLAGS = $(AM_CXXFLAGS)
+libre2c_posix_la_LDFLAGS = -module
 
-libre2c_posix_a_HDR = \
+libre2c_posix_la_HDR = \
        libre2c_posix/lex.h \
        libre2c_posix/regex.h \
        libre2c_posix/regex-impl.h \
@@ -70,7 +71,7 @@ libre2c_posix_a_HDR = \
        src/util/uniq_vector.h \
        src/util/wrap_iter.h
 
-libre2c_posix_a_SRC = \
+libre2c_posix_la_SRC = \
        libre2c_posix/regcomp.cc \
        libre2c_posix/regexec.cc \
        libre2c_posix/regfree.cc \
@@ -129,46 +130,45 @@ libre2c_posix_a_SRC = \
        src/util/range.cc \
        src/util/s_to_n32_unsafe.cc
 
-libre2c_posix_a_SOURCES = \
-       $(libre2c_posix_a_HDR) \
-       $(libre2c_posix_a_SRC)
+libre2c_posix_la_SOURCES = \
+       $(libre2c_posix_la_HDR) \
+       $(libre2c_posix_la_SRC)
 
-libre2c_posix_a_CUSTOM = \
+libre2c_posix_la_CUSTOM = \
        libre2c_posix/lex.re \
        libre2c_posix/parse.ypp \
        src/options/ver_to_vernum.re
 
-libre2c_posix_a_GEN_SRC = \
+libre2c_posix_la_GEN_SRC = \
        libre2c_posix/lex.cc \
        libre2c_posix/parse.cc \
        src/options/ver_to_vernum.cc
-libre2c_posix_a_GEN_HDR = \
+libre2c_posix_la_GEN_HDR = \
        libre2c_posix/parse.h
-libre2c_posix_a_GEN = \
-       $(libre2c_posix_a_GEN_SRC) \
-       $(libre2c_posix_a_GEN_HDR)
+libre2c_posix_la_GEN = \
+       $(libre2c_posix_la_GEN_SRC) \
+       $(libre2c_posix_la_GEN_HDR)
 
-libre2c_posix_a_BOOTSTRAP = \
+# custom rules create headers and must go before normal rules
+BUILT_SOURCES += $(libre2c_posix_la_GEN_SRC)
+
+libre2c_posix_la_BOOTSTRAP = \
        bootstrap/libre2c_posix/parse.cc \
        bootstrap/libre2c_posix/parse.h \
        bootstrap/libre2c_posix/lex.cc \
        bootstrap/src/options/ver_to_vernum.cc
 
-nodist_libre2c_posix_a_SOURCES = $(libre2c_posix_a_GEN)
+nodist_libre2c_posix_la_SOURCES = $(libre2c_posix_la_GEN)
 
 EXTRA_DIST += \
-       $(libre2c_posix_a_BOOTSTRAP) \
-       $(libre2c_posix_a_CUSTOM)
+       $(libre2c_posix_la_BOOTSTRAP) \
+       $(libre2c_posix_la_CUSTOM)
 
-CLEANFILES += $(libre2c_posix_a_GEN)
+CLEANFILES += $(libre2c_posix_la_GEN)
 
 # lexer depends on bison-generated header
 libre2c_posix/lex.cc: libre2c_posix/parse.cc
 
-# generate all sources before compiling
-all: $(libre2c_posix_a_GEN_SRC)
-
-libre2c_posix_a_test_SOURCES = libre2c_posix/test.cpp
-libre2c_posix_a_test_LDADD = libre2c_posix.a
-libre2c_posix_a_test_CXXFLAGS = $(libre2c_posix_a_CXXFLAGS)
-check_PROGRAMS += libre2c_posix_a_test
+libre2c_posix_la_test_SOURCES = libre2c_posix/test.cpp
+libre2c_posix_la_test_LDADD = libre2c_posix.la
+check_PROGRAMS += libre2c_posix_la_test
index 1bc1018ff893bd5118ab13215cf8cd1428e6e036..ae02cc05e8c43a8ca7758ac57a74ea5b5c9c7a2d 100755 (executable)
@@ -5,6 +5,8 @@ rm -rf $builddir
 mkdir $builddir
 
 cd $builddir
-../configure --enable-debug && \
-make -j5
+../configure \
+    --enable-debug \
+    --enable-libs \
+    && make -j5
 cd ..
index dd3d13074cd6d53c3a4e7bd7c3d8bdcda40f873e..974c1cd208696f5fee2c7cbd3b102c70d7b4b774 100755 (executable)
@@ -5,6 +5,10 @@ rm -rf $builddir
 mkdir $builddir
 
 cd $builddir
-../configure --enable-debug CXXFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address" && \
-make -j5
+../configure \
+    --enable-debug \
+    --enable-libs \
+    CXXFLAGS="-fsanitize=address" \
+    LDFLAGS="-fsanitize=address" \
+    && make -j5
 cd ..
index 2f53ddba3c858dac6bf27b7cfbf5057c21dffeb8..56d2629e932e3964121848d1acd360daf41a75bc 100755 (executable)
@@ -5,6 +5,10 @@ rm -rf $builddir
 mkdir $builddir
 
 cd $builddir
-../configure --enable-debug CC=clang CXX=clang++ && \
-make -j5
+../configure \
+    --enable-debug \
+    --enable-libs \
+    CC=clang \
+    CXX=clang++ \
+    && make -j5
 cd ..
index 93633555a940a1688396341ae58086441a875c4f..29c4af548b6a8093efda8edcabda1c5e4b97d97b 100755 (executable)
@@ -5,6 +5,13 @@ rm -rf $builddir
 mkdir $builddir
 
 cd $builddir
-../configure --enable-debug CC=clang CXX=clang++ CFLAGS="-fsanitize=memory" CXXFLAGS="-fsanitize=memory" LDFLAGS="-fsanitize=memory" && \
-make -j5
+../configure \
+    --enable-debug \
+    --enable-libs \
+    CC=clang \
+    CXX=clang++ \
+    CFLAGS="-fsanitize=memory" \
+    CXXFLAGS="-fsanitize=memory" \
+    LDFLAGS="-fsanitize=memory" \
+    && make -j5
 cd ..
index 2fc0e9904ef71011b31553d62b39bc2f78f53ec8..7a55660d0eac31b6b52c4a3a4c44fc972f6c4d30 100755 (executable)
@@ -5,6 +5,10 @@ rm -rf $builddir
 mkdir $builddir
 
 cd $builddir
-../configure --enable-debug CXXFLAGS="-fsanitize=leak" LDFLAGS="-fsanitize=leak" && \
-make -j5
+../configure \
+    --enable-debug \
+    --enable-libs \
+    CXXFLAGS="-fsanitize=leak" \
+    LDFLAGS="-fsanitize=leak" \
+    && make -j5
 cd ..
index dff24936889ee396d6fc369d6654a6b7ffac75a7..eeb47ed0265b7acf81c40d9343aeaacd32a5d6b0 100755 (executable)
@@ -5,6 +5,10 @@ rm -rf $builddir
 mkdir $builddir
 
 cd $builddir
-../configure --enable-debug CXXFLAGS="-m32" LDFLAGS="-m32" && \
-make -j5
+../configure \
+    --enable-debug \
+    --enable-libs \
+    CXXFLAGS="-m32" \
+    LDFLAGS="-m32" \
+    && make -j5
 cd ..
index 417d0992f159dcfeb1d3723c354bf19bb900b7c3..3fc951ba924f856c9b0c89f50e697f611c6e19f3 100755 (executable)
@@ -5,6 +5,9 @@ rm -rf $builddir
 mkdir $builddir
 
 cd $builddir
-../configure --enable-debug --host i686-w64-mingw32 && \
-make -j5
+../configure \
+    --enable-debug \
+    --enable-libs \
+    --host i686-w64-mingw32 \
+    && make -j5
 cd ..
index 9e0947563e25930e78806b1b6287fc11617eb89a..4f04c5a063efb4f90704847302c414777ae45976 100755 (executable)
@@ -5,6 +5,10 @@ rm -rf $builddir
 mkdir $builddir
 
 cd $builddir
-../configure --enable-debug CFLAGS="-ffunction-sections -fdata-sections" LDFLAGS="-Wl,--gc-sections -Wl,--print-gc-sections" && \
-make -j5
+../configure \
+    --enable-debug \
+    --enable-libs \
+    CFLAGS="-ffunction-sections -fdata-sections" \
+    LDFLAGS="-Wl,--gc-sections -Wl,--print-gc-sections" \
+    && make -j5
 cd ..
index 203122052824d11d31de073f1087780a76475ea7..543ba00113861283a96736fa78619a1ce7595793 100755 (executable)
@@ -5,6 +5,10 @@ rm -rf $builddir
 mkdir $builddir
 
 cd $builddir
-../configure --enable-debug CXXFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined" && \
-make -j5
+../configure \
+    --enable-debug \
+    --enable-libs \
+    CXXFLAGS="-fsanitize=undefined" \
+    LDFLAGS="-fsanitize=undefined" \
+    && make -j5
 cd ..
index 0d4dd6d4f9fee574db8a1a494d3e6d9acf59a7bb..dd1e8529c4a51b922368a1010164961b0396f5bc 100755 (executable)
@@ -19,7 +19,7 @@ do
     cd $builddir
         # 'make' implies 'make docs'; running both in parallel may cause data races
         # configure without --enable-debug, this is the release binary
-        ../configure --enable-docs \
+        ../configure --enable-docs --enable-libs \
         && $make_prog bootstrap -j5 \
         && $make_prog distcheck -j5
     cd ..
index 3466e21a840edc63e7b21b358e29e4069a5c7dc6..582d952e8eccf1224795c9d5027a486529ac9a8d 100644 (file)
@@ -3,6 +3,10 @@ AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz no-dist-gzip])
 AM_SILENT_RULES([yes])
 
 
+LT_INIT([dlopen])
+AC_CONFIG_MACRO_DIRS([m4])
+
+
 AC_CONFIG_SRCDIR([src/main.cc])
 AC_CONFIG_HEADERS([config.h])
 
@@ -31,8 +35,12 @@ AM_COND_IF([REBUILD_DOCS], [
 ])
 
 
+# --enable-libs
+AC_ARG_ENABLE([libs], [AS_HELP_STRING([--enable-libs], [build libraries])])
+AM_CONDITIONAL([WITH_LIBS], [test "x$enable_libs" = "xyes"])
+
+
 # checks for programs
-AC_PROG_RANLIB
 AC_PATH_PROG(BISON, bison, no)
 AC_PROG_CC # used in skeleton tests
 AC_PROG_CXX