This is an automated email from Gerrit.

"Evgeniy Naydanov <evgeniy.nayda...@syntacore.com>" just uploaded a new patch 
set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8753

-- gerrit

commit 0d1769b439dcd2e5d09bc8f37c749e6eea6a949f
Author: Evgeniy Naydanov <evgeniy.nayda...@syntacore.com>
Date:   Wed Feb 12 16:25:30 2025 +0300

    Allow build without submodules
    
    Currently `jimtcl` and `libjaylink` submodules are not used by default.
    
    However, if one removes them altogether, build fails:
    ```
    > ./configure && make -j
    ...
    Makefile.am:32: error: required directory ./jimtcl does not exist
    src/jtag/drivers/Makefile.am:56: error: required directory 
./src/jtag/drivers/libjaylink does not exist
    Makefile.am:180:   'src/Makefile.am' included from here
    src/Makefile.am:92:   'src/jtag/Makefile.am' included from here
    src/jtag/Makefile.am:12:   'src/jtag/drivers/Makefile.am' included from here
    Makefile.am:33: error: required directory ./jimtcl does not exist
    src/jtag/drivers/Makefile.am:57: error: required directory 
./src/jtag/drivers/libjaylink does not exist
    Makefile.am:180:   'src/Makefile.am' included from here
    src/Makefile.am:92:   'src/jtag/Makefile.am' included from here
    src/jtag/Makefile.am:12:   'src/jtag/drivers/Makefile.am' included from here
    make: *** [Makefile:2258: ../Makefile.in] Error 1
    ```
    
    To make submodule directories optional `AC_SUBST` is used.
    Link: 
https://www.gnu.org/software/automake/manual/html_node/Subdirectories-with-AC_005fSUBST.html
    
    Change-Id: I0a9aab31d94b250bca0f69b6ae2e7e540e939c55
    Signed-off-by: Evgeniy Naydanov <evgeniy.nayda...@syntacore.com>

diff --git a/Makefile.am b/Makefile.am
index 155a2b3bb7..460bc35f22 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,12 +29,12 @@ EXTRA_DIST =
 DISTCLEANFILES =
 
 if INTERNAL_JIMTCL
-SUBDIRS += jimtcl
-DIST_SUBDIRS += jimtcl
 EXTRA_DIST += jimtcl/configure.gnu
 # jimtcl from 0.79 to 0.82 miss cleaning jsmn.o
 DISTCLEANFILES += jimtcl/jsmn/jsmn.o
 endif
+SUBDIRS += $(MAYBE_JIMTCL)
+DIST_SUBDIRS += $(MAYBE_JIMTCL)
 
 # common flags used in openocd build
 AM_CFLAGS = $(GCC_WARNINGS)
diff --git a/configure.ac b/configure.ac
index 4b10aabd5d..0954385a05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -808,8 +808,20 @@ AM_CONDITIONAL([DMEM], [test "x$build_dmem" = "xyes"])
 AM_CONDITIONAL([HAVE_CAPSTONE], [test "x$enable_capstone" != "xno"])
 
 AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"])
+if test "x$use_internal_jimtcl" = "xyes"; then
+  MAYBE_JIMTCL=jimtcl
+else
+  MAYBE_JIMTCL=
+fi
+AC_SUBST([MAYBE_JIMTCL])
 AM_CONDITIONAL([HAVE_JIMTCL_PKG_CONFIG], [test "x$have_jimtcl_pkg_config" = 
"xyes"])
 AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = 
"xyes"])
+if test "x$use_internal_libjaylink" = "xyes"; then
+  MAYBE_LIBJAYLINK=src/jtag/drivers/libjaylink
+else
+  MAYBE_LIBJAYLINK=
+fi
+AC_SUBST([MAYBE_LIBJAYLINK])
 
 AM_CONDITIONAL([USE_GCOV], [test "x$enable_gcov" = "xyes"])
 
diff --git a/src/jtag/drivers/Makefile.am b/src/jtag/drivers/Makefile.am
index ec233b2470..d34c6370b4 100644
--- a/src/jtag/drivers/Makefile.am
+++ b/src/jtag/drivers/Makefile.am
@@ -51,12 +51,11 @@ endif
 if JLINK
 DRIVERFILES += %D%/jlink.c
 if INTERNAL_LIBJAYLINK
-SUBDIRS += %D%/libjaylink
-DIST_SUBDIRS += %D%/libjaylink
-
 %C%_libocdjtagdrivers_la_LIBADD += %D%/libjaylink/libjaylink/libjaylink.la
 %C%_libocdjtagdrivers_la_CPPFLAGS += -I$(builddir)/%D%/libjaylink/libjaylink 
-I$(srcdir)/%D%/libjaylink
 endif
+SUBDIRS += $(MAYBE_LIBJAYLINK)
+DIST_SUBDIRS += $(MAYBE_LIBJAYLINK)
 endif
 
 if BITBANG

-- 

Reply via email to