mardi 14 octobre 2014

Makefile for shared libraries in all subdirectories


Vote count:

0




I am currently working on a project, that looks like this:



root folder

|---plugin manager
| |---plugin_manager.cpp
| |---plugin_interface.hpp
|
|---libraries
|
|---Plugins
| |
| |---Plugin1
| | |---Plugin1.cpp
| | |---Plugin1.hpp
| |---Plugin2
| | |---Plugin2.cpp
| | |---Plugin2.hpp


I am compiling a .so for each plug-in and then I "load" it with the plugin_manager. This works fine. I even created a simple makefile, which is able to compile a .so. Here are my make and config files:


configure.ac



AC_INIT(My Project, 0.1, my@email, myproject)
AC_PREREQ(2.68)
AC_COPYRIGHT(GNU General Public License)
AM_CONFIG_HEADER([config.h])

AC_CONFIG_MACRO_DIR([m4])
AM_PROG_LIBTOOL
AC_PROG_INSTALL

AC_PROG_CXX
AM_INIT_AUTOMAKE([1.9 foreign])
AC_CONFIG_FILES(Makefile)
AC_ENABLE_SHARED
AC_DISABLE_STATIC
LT_INIT
AC_OUTPUT


Makefile.am



ACLOCAL_AMFLAGS = -I m4
#Generating libtest.so
lib_LTLIBRARIES = libtest.la
#here you can list your source files
libtest_la_SOURCES = Plugin1.cpp
libtest_la_LDFLAGS = -module -avoid-version -export-dynamic


However, this make file is not that user-friendly, since I have to put it manually in each plug-in folder and also change its source files. That is why I want to create another one, which basically by typing make creates an executable in the plugin manager folder, as well as a .so in each plug-in folder. I have been reading for the last couple of days about autotools and tried implementing something similar to what the guys here suggested, but it didn't work. So I hope that there is someone here, who has experience with such makefiles and can give me a tip on how to solve my problem.



asked 35 secs ago







Makefile for shared libraries in all subdirectories

Aucun commentaire:

Enregistrer un commentaire