There is no makefile magic that turns shared libraries into static libraries.
You need to install the static versions of the libraries on your system and
then, in your makefile, specify that the static versions of the libraries are to
be linked.
It appears that the static libraries you would need to install are:
libevent_core.a
libevent_extra.a
libevent.a
libevent_pthreads.a
libsystemd.a
Having installed those libraries, you would modify your makefile to link them
statically by changing:
LIBS = -levent_core -levent_extra -levent -levent_pthreads -lsystemd
to:
LIBS = -Wl,-Bstatic -levent_core -levent_extra -levent -levent_pthreads -lsystemd -Wl,-Bdynamic
However, you cannot do exactly that, because there is no static version of libsystemd
. Here's why.
There are static versions of the other libraries in your list. You can install them
by installing the libevent
development package (probably package libevent-dev
or libevent-devel
,
depending on your linux distro). Then you can link those ones statically with:
LIBS = -Wl,-Bstatic -levent_core -levent_extra -levent -levent_pthreads -Wl,-Bdynamic -lsystemd
Note that there are no spaces within -Wl,-Bstatic
or -Wl,-Bdynamic
. GCC options of the form -Wl,...
mean that GCC should pass the options ...
through to its invocation of the linker.
Here is the documentation of the linker options