sysklogd/src/Makefile.am
Joachim Nilsson 58da3b6bd2 Mark strlcat() and strlcpy() as weak functions, for libsyslog
The strlcat() and strlcpy() functions are only intended to be used
by syslog.c internally (and syslogd), when building libsyslog.

A user linking with libsyslog may have another library that provides
strlcat() or strlcpy() replacements.  We must therefore mark ours as
weak functions so they can be overridden.

This patch also add a convenience library for libsyslog, to control
the build deps. for libsyslog.  This is where external dependencies
should be addded (explicitly) when syslog.c is updated from NetBSD.
If you add new deps you likely want to mark them too as weak refs.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 11:04:13 +01:00

55 lines
2.3 KiB
Makefile

# Copyright (c) 2018-2019 Joachim Nilsson <troglobit@gmail.com>
#
# This file is part of the sysklogd package, a kernel and system log daemon.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bin_PROGRAMS = logger
sbin_PROGRAMS = syslogd klogd
lib_LTLIBRARIES = libsyslog.la
noinst_LTLIBRARIES = libcompat.la
AM_CFLAGS = -W -Wall -Wextra
AM_CFLAGS += -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing
AM_CPPFLAGS = -DSYSCONFDIR=\"@sysconfdir@\" -DLOCALSTATEDIR=\"@localstatedir@\"
AM_CPPFLAGS += -D_BSD_SOURCE -D_DEFAULT_SOURCE
syslogd_SOURCES = syslogd.c syslog.h queue.h
syslogd_CPPFLAGS = $(AM_CPPFLAGS) -D_XOPEN_SOURCE=600
syslogd_LDADD = $(LIBS) $(LIBOBJS)
klogd_SOURCES = klogd.c klogd.h syslog.h ksym.c ksyms.h ksym_mod.c module.h
klogd_CPPFLAGS = $(AM_CPPFLAGS) -DALLOW_KERNEL_LOGGING
klogd_LDADD = $(LIBS) $(LIBOBJS)
klogd_LDADD += libsyslog.la
logger_SOURCES = logger.c syslog.h
logger_CPPFLAGS = $(AM_CPPFLAGS) -D_XOPEN_SOURCE=600
logger_LDADD = $(LIBS) $(LIBOBJS)
logger_LDADD += libsyslog.la
# Convenience library for libsyslog instead of linking with $(LTLIBOBJS),
# which would pull in pidfile() and other (strong) symbols as well.
libcompat_la_SOURCES = ../lib/strlcpy.c ../lib/strlcat.c
pkgconfigdir = $(libdir)/pkgconfig
pkgincludedir = $(includedir)/syslog
pkgconfig_DATA = libsyslog.pc
pkginclude_HEADERS = syslog.h
libsyslog_la_SOURCES = syslog.c syslog.h
libsyslog_la_CPPFLAGS = $(AM_CPPFLAGS) -D_XOPEN_SOURCE=600
libsyslog_la_LDFLAGS = $(AM_LDFLAGS) -version-info 0:0:0
libsyslog_la_LIBADD = libcompat.la