c++ - Cannot totally compile and link cpp project as a static library -
i have followed link , adapted steps make work project.
my goal create libfile.a
distribute static library. project tree following:
project | +-src +- <some cpp , hpp files> | + containers | +- <other cpp , hpp files>
i created configure.ac
file , makefile.am
s. tree structure changed way:
project | +- configure.ac +- makefile.am +-src +- <some cpp , hpp files> + makefile.am | + containers | +- <other cpp , hpp files>
now, when go: (*)
aclocal; autoreconf --install; autoconf; ./configure make
.o files
generated .*pp files
contained in src
, fails when starts generating targets in src/containers
. makefile
not generated properly. doing wrong? can me?
ps here there files involved:
# --- configure.ac --- ac_prereq([2.68]) ac_init([filea], [1.0], [dev@host.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 suggested brett hale commands marked (*)
have been replaced following ones:
autoreconf -fvi
output:
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 `.'
when going with:
./configure make
still no rules found generate targets in subdirectory.
edit 2 switched non-recursive approach (thanks karel zak's blog) , can make
my lib.
still don't know doing wrong following typical recursive approach
; but, made work, switching non-recursive approach
(as wrote in edit 2). this article on karel zak's blog helped me lot!
# -- new configure.ac file -- ac_prereq([2.68]) ac_init([filea], [1.0], [dev@host.net]) am_init_automake([filea], [1.0]) ac_config_headers([config.h]) ac_config_srcdir([src/hashfunctions.cpp]) am_init_automake([filea], [1.0]) lt_init ac_canonical_host ac_prog_libtool ac_prog_grep ac_prog_egrep ac_prog_cxx ... ac_header_stdbool ac_c_inline ac_type_pid_t ac_type_size_t ac_type_ssize_t ac_type_uint8_t ac_type_uint16_t ac_type_uint32_t ac_func_error_at_line ac_func_fork ac_func_malloc ac_func_mktime ac_check_funcs([memset socket]) ac_output([makefile]) # makefile one! # in subdirectory have created few # makemodule.am included in "main makefile.am" # --- makefile.am --- automake_options = foreign lib_libraries = filea.a libfilea_a_sources = include src/makemodule.am include src/containers/makemodule.am # filea_a_sources # "global variable" # -- src/makemodule.am libfilea_a_sources += \ src/configlib.hpp \ src/configlib.cpp \ src/hashfunctions.cpp \ src/hashfunctions.hpp \ src/logger.hpp \ src/logger.cpp \ src/queue.hpp # -- src/containers/makemodule.am libfile_a_sources += \ src/containers/safecontainer.cpp \ src/containers/safeinterger.cpp \ src/containers/safemap.cpp
notice now, if makemodule.am
files placed @ different levels in dir tree, whenever filename typed in 1 modules, has preceded relative path. path relative makefile
location.
Comments
Post a Comment