admin管理员组

文章数量:1122826

I have two projects - SprocketEngine and TestHarness_DLL- within the /src/SprocketEngine and /src/TestHarness_DLL directories, respectively. I want to be able to select which one to build using automake, but I get the following error, even though the src/library directory exists. Any help would be deeply appreciated as I am totally stuck.

Making all in src/SprocketEngine
Making all in src/SprocketEngine
/bin/sh: line 0: cd: src/SprocketEngine: No such file or directory
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

The configuration files are:

/configure.ac

# Read package version from version.txt
m4_define([sprocketengine_version], m4_esyscmd([cat version.txt | tr -d '\n']))

AC_INIT([SproketEngine], [sprocketengine_version], [sprocketengineinvalid.invalid])

# Verify the source directory
AC_CONFIG_SRCDIR([src/SprocketEngine/SprocketContext.cpp])

AC_CONFIG_MACRO_DIRS([m4])

# Enable Automake
AM_INIT_AUTOMAKE([foreign subdir-objects])

# Initialize Libtool
LT_INIT

# Check for C++ compiler
AC_PROG_CXX

# Read libtool versioning from lib_version.txt and
# set libtool versioning
LT_VERSION=$(cat lib_version.txt | tr -d '\n')
AC_MSG_NOTICE([--- Libtool version: $LT_VERSION])
AC_SUBST(LT_VERSION)

# Set include and library paths (use proper variable names)
# AC_SUBST(AM_CPPFLAGS, "-I. -I\$(SPROCKET_GLEW_LIB_PATH) -I(SPROCKET_GLFW_INC_PATH)")
# AC_SUBST(LDADD, "-L\$(WEBLOOM_LIBMAGIC_LIB) -lmagic")

# Define custom include directory for SprocketEngine headers
sprocketengine_headers_dir='$(includedir)/SprocketEngine'
AC_SUBST([sprocketengine_headers_dir])

# Define build options
AC_ARG_ENABLE([library],
    [AS_HELP_STRING([--build-library], [build the SprocketEngine library])],
    [build_library=$enableval], [build_library=no])

AC_ARG_ENABLE([test-harness],
    [AS_HELP_STRING([--build-test-harness], [build the test harness])],
    [enable_test_harness=$enableval], [enable_test_harness=no])

# Conditionally process subdirectories
AM_CONDITIONAL([BUILD_LIBRARY], [test "x$enable_library" = "xyes"])
AM_CONDITIONAL([BUILD_TEST_HARNESS], [test "x$enable_test_harness" = "xyes"])

# Configure subdirectories based on options
SUBDIRS=""
if test "x$enable_library" = "xyes"; then
    SUBDIRS="$SUBDIRS src/SprocketEngine"
fi

if test "x$enable_test_harness" = "xyes"; then
    SUBDIRS="$SUBDIRS src/TestHarness_DLL"
fi

AC_SUBST(SUBDIRS)

# Checks for header files
AC_CHECK_HEADERS([stdio.h stdlib.h])

# Output Makefile in root and subdirectories
AC_CONFIG_FILES([
    Makefile
    src/SprocketEngine/Makefile
    src/TestHarness_DLL/Makefile
])

# Generate the configuration script
AC_OUTPUT

/Makefile.am

# Root Makefile.am
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = src/SprocketEngine src/TestHarness_DLL

src/Makefile.am

# Specify subdirectories to build
SUBDIRS = SprocketEngine TestHarness_DLL%

I can add the /src/SprocketEngine/Makefile.am if it's needed, an abbreviated version is :

if BUILD_LIBRARY

# Compiler and linker flags
AM_CPPFLAGS = -g -std=c++17 -Wall -Wextra -fPIC \
              -I.

# Install header files
nobase_include_HEADERS = IKeyboardHandler.h \
                  IMouseHandler.h \
                  IWindow.h

lib_LTLIBRARIES = libSprocketEngine.la
libSprocketEngine_la_SOURCES = KeyboardHandler.cpp \
                               MouseHandler.cpp

CLEANFILES = $(lib_LTLIBRARIES)

endif

本文标签: cAutoMake Conditional build Multple ProjectsStack Overflow