나는 이것을 link에 따라 수행하고 프로젝트에 맞게 단계를 수정했습니다.cpp 프로젝트를 정적 라이브러리로 완전히 컴파일하고 연결할 수 없습니다.
제 목표는 정적 라이브러리로 배포하기 위해 libfile.a
을 생성하는 것입니다. 프로젝트 트리는 다음과 같습니다 :
project
|
+-src
+- <some cpp and hpp files>
|
+ containers
|
+- <other cpp and hpp files>
나는 쉽게 configure.ac
파일과 Makefile.am
의를 만들었습니다. 내가 갈 때, 이제
project
|
+- configure.ac
+- Makefile.am
+-src
+- <some cpp and hpp files>
+ Makefile.am
|
+ containers
|
+- <other cpp and hpp files>
: 트리 구조는이 방식을 변경 (*)
aclocal; autoreconf --install; autoconf; ./configure
make
.o files
가 생성 된 모든 .*pp files
src
에 포함하지만 src/containers
에 그 목표를 생성하는 시작하면 실패합니다 . 따라서 Makefile
이 제대로 생성되지 않습니다. 내가 도대체 뭘 잘못하고있는 겁니까? 누군가 나를 도울 수 있습니까?
autoreconf -fvi
출력 :
(*)
표시된 명령은 다음과 같은 것들에 의해 대체되었습니다
Brett Hale에 의해 제안
# --- configure.ac ---
AC_PREREQ([2.68])
AC_INIT([filea], [1.0], [[email protected]ost.net])
AM_INIT_AUTOMAKE([filea], [1.0])
AC_CONFIG_SRCDIR([src/HashFunctions.cpp])
AC_CONFIG_HEADERS([config.h])
AC_PROG_CXX
AC_PROG_RANLIB
AC_CHECK_HEADERS([stddef.h stdint.h string.h])
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_CHECK_FUNCS([memset])
AC_OUTPUT([Makefile src/Makefile])
# --- Makefile.am ---
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src
# --- src/Makefile.am ---
lib_LIBRARIES = libfile.a
libfile_a_SOURCES = \
ConfigLib.hpp \
ConfigLib.cpp \
HashFunctions.cpp \
HashFunctions.hpp \
Logger.hpp \
Logger.cpp \
Queue.hpp
libfile_a_SOURCES += \
containers/SafeContainer.cpp \
containers/SafeInterger.cpp \
containers/SafeMap.cpp
EDIT 1 :
PS 여기에 포함 된 파일이 있습니다
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
autoreconf: Leaving directory `.'
로가는 : 아직도 아무런 규칙이 하위 디렉토리에 목표를 생성하기 위해 발견되지
./configure
make
.
편집 2 나는 (감사 Karel Zak's blog에) 비 재귀 방식으로 전환하고 마지막으로 내 lib 디렉토리를 make
수 있습니다.
당신은'aclocal; 대신'autoreconf -fvi'를 사용해 볼 수 있습니까? ....;'명령? –
[SCons] (http://scons.org), [CMake] (https://cmake.org) 및 기타 빌드 시스템 - 일반 [make] (https : //www.gnu. org/software/make /) - * 아무것도 *하지만 공포는'autoconf' /'automake' ... –
@JesperJuhl - 예, cmake는 순수한 의도로 시작했습니다 ... 단지 하드 * 문제를 일으키고, bash/m4와는 달리 autotools에서의 20 년의 경험없이 다른 곳에서 사용 된 구문을 사용하여 휠을 효과적으로 재발 명합니다. –