build: convert lib/ to non-recursive build

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2017-05-24 17:48:12 +02:00
parent 84d5286a9f
commit 4a121f99f7
10 changed files with 306 additions and 171 deletions

View File

@ -1,18 +1,38 @@
## Process this file with automake to produce Makefile.in.
SUBDIRS = lib qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@ \
AUTOMAKE_OPTIONS = subdir-objects 1.12
include common.am
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
AM_CFLAGS = $(WERROR)
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
EXTRA_DIST =
BUILT_SOURCES =
bin_PROGRAMS =
sbin_PROGRAMS =
noinst_PROGRAMS =
noinst_HEADERS =
noinst_LIBRARIES =
lib_LTLIBRARIES =
pkginclude_HEADERS =
include lib/subdir.am
SUBDIRS = . qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@ \
@BGPD@ @RIPD@ @RIPNGD@ @OSPFD@ @OSPF6D@ @LDPD@ \
@ISISD@ @PIMD@ @NHRPD@ @EIGRPD@ @BABELD@ \
@WATCHFRR@ @VTYSH@ @OSPFCLIENT@ @DOC@ m4 @pkgsrcdir@ \
redhat @SOLARIS@ tests tools snapcraft
DIST_SUBDIRS = lib qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd \
DIST_SUBDIRS = . qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd \
isisd watchfrr vtysh ospfclient doc m4 pkgsrc redhat tests \
solaris pimd nhrpd eigrpd bgpd/rfp-example/librfp \
bgpd/rfp-example/rfptest tools snapcraft babeld python \
# end
EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS \
EXTRA_DIST += aclocal.m4 SERVICES REPORTING-BUGS \
update-autotools \
vtysh/Makefile.in vtysh/Makefile.am \
tools/rrcheck.pl tools/rrlookup.pl tools/zc.pl \
@ -20,4 +40,4 @@ EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS \
ACLOCAL_AMFLAGS = -I m4
noinst_HEADERS = defaults.h
noinst_HEADERS += defaults.h

View File

@ -10,10 +10,17 @@ am__v_CLIPPY_1 =
SUFFIXES = _clippy.c
.c_clippy.c:
$(AM_V_at)$(MAKE) -C $(top_builddir)/$(CLIPPYDIR) clippy
$(AM_V_CLIPPY)$(top_builddir)/$(CLIPPYDIR)/clippy $(top_srcdir)/python/clidef.py $< > $@.tmp
$(AM_V_at)$(MAKE) -C $(top_builddir)/$(HOSTTOOLS) lib/clippy
$(AM_V_CLIPPY)$(top_builddir)/$(HOSTTOOLS)lib/clippy $(top_srcdir)/python/clidef.py $< > $@.tmp
@{ test -f $@ && diff $@.tmp $@ >/dev/null 2>/dev/null; } && rm $@.tmp || mv $@.tmp $@
## automake's "ylwrap" is a great piece of GNU software... not.
.l.c:
$(AM_V_LEX)$(am__skiplex) $(LEXCOMPILE) $<
.y.c:
$(AM_V_YACC)$(am__skipyacc) $(YACCCOMPILE) $<
if HAVE_PROTOBUF
# Uncomment to use an non-system version of libprotobuf-c.

View File

@ -46,12 +46,12 @@ AS_IF([test "$host" != "$build"], [
AC_MSG_NOTICE([...])
build_clippy="false"
CLIPPYDIR="hosttools/lib"
HOSTTOOLS="hosttools/"
], [
build_clippy="true"
CLIPPYDIR="lib"
HOSTTOOLS=""
])
AC_SUBST(CLIPPYDIR)
AC_SUBST(HOSTTOOLS)
AM_CONDITIONAL([BUILD_CLIPPY], [$build_clippy])
# Disable portability warnings -- our automake code (in particular
@ -1969,7 +1969,7 @@ AC_CACHE_VAL(ac_cv_htonl_works,
)
AC_MSG_RESULT($ac_cv_htonl_works)
AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
AC_CONFIG_FILES([Makefile qpb/Makefile zebra/Makefile ripd/Makefile
ripngd/Makefile bgpd/Makefile ospfd/Makefile watchfrr/Makefile
ospf6d/Makefile ldpd/Makefile isisd/Makefile vtysh/Makefile
doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile

2
lib/.gitignore vendored
View File

@ -1,4 +1,4 @@
Makefile
!Makefile
Makefile.in
*.o
*.lo

10
lib/Makefile Normal file
View File

@ -0,0 +1,10 @@
all: ALWAYS
@$(MAKE) -s -C .. lib/libfrr.la
%: ALWAYS
@$(MAKE) -s -C .. lib/$@
Makefile:
#nothing
ALWAYS:
.PHONY: ALWAYS makefiles
.SUFFIXES:

View File

@ -1,155 +0,0 @@
## Process this file with automake to produce Makefile.in.
include ../common.am
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
AM_CFLAGS = $(WERROR)
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
AM_YFLAGS = -d -Dapi.prefix=@BISON_OPENBRACE@cmd_yy@BISON_CLOSEBRACE@ @BISON_VERBOSE@
command_lex.h: command_lex.c
@if test ! -f $@; then rm -f command_lex.c; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) command_lex.c; else :; fi
command_parse.lo: command_lex.h
clippy-command_parse.$(OBJEXT): command_lex.h
lib_LTLIBRARIES = libfrr.la
libfrr_la_LDFLAGS = -version-info 0:0:0
libfrr_la_SOURCES = \
network.c pid_output.c getopt.c getopt1.c \
checksum.c vector.c linklist.c vty.c openbsd-tree.c \
graph.c command_parse.y command_lex.l command_match.c \
command_graph.c \
command.c \
sockunion.c prefix.c thread.c if.c buffer.c table.c hash.c \
filter.c routemap.c distribute.c stream.c log.c plist.c \
zclient.c sockopt.c md5.c if_rmap.c keychain.c privs.c \
sigevent.c pqueue.c jhash.c workqueue.c nexthop.c json.c \
ptm_lib.c csv.c bfd.c vrf.c systemd.c ns.c memory.c memory_vty.c \
imsg-buffer.c imsg.c skiplist.c \
qobj.c wheel.c \
event_counter.c \
grammar_sandbox.c \
srcdest_table.c \
spf_backoff.c \
libfrr.c \
strlcpy.c \
strlcat.c \
sha256.c \
module.c \
hook.c \
frr_pthread.c \
termtable.c \
# end
BUILT_SOURCES = route_types.h gitversion.h command_parse.h command_lex.h
libfrr_la_LIBADD = @LIBCAP@
if SNMP
lib_LTLIBRARIES += libfrrsnmp.la
endif
libfrrsnmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS)
libfrrsnmp_la_LDFLAGS = -version-info 0:0:0
libfrrsnmp_la_LIBADD = libfrr.la $(SNMP_LIBS)
libfrrsnmp_la_SOURCES = \
agentx.c \
smux.c \
snmp.c \
#end
pkginclude_HEADERS = \
frratomic.h \
buffer.h checksum.h filter.h getopt.h hash.h \
if.h linklist.h log.h \
graph.h command_match.h \
command_graph.h \
command.h \
memory.h network.h prefix.h routemap.h distribute.h sockunion.h \
stream.h table.h thread.h vector.h version.h vty.h zebra.h \
plist.h zclient.h sockopt.h smux.h md5.h if_rmap.h keychain.h \
privs.h sigevent.h pqueue.h jhash.h zassert.h \
workqueue.h route_types.h libospf.h nexthop.h json.h \
ptm_lib.h csv.h bfd.h vrf.h ns.h systemd.h bitfield.h \
fifo.h memory_vty.h mpls.h imsg.h openbsd-queue.h openbsd-tree.h \
skiplist.h qobj.h wheel.h \
event_counter.h \
monotime.h \
spf_backoff.h \
srcdest_table.h \
module.h \
hook.h \
libfrr.h \
sha256.h \
frr_pthread.h \
vrf_int.h \
termtable.h \
vlan.h \
vxlan.h \
ipaddr.h \
# end
noinst_HEADERS = \
plist_int.h \
log_int.h \
clippy.h \
# end
noinst_PROGRAMS = grammar_sandbox
if BUILD_CLIPPY
noinst_PROGRAMS += clippy
endif
grammar_sandbox_SOURCES = grammar_sandbox_main.c
grammar_sandbox_LDADD = libfrr.la
clippy_SOURCES = \
defun_lex.l \
command_parse.y \
command_lex.l \
command_graph.c \
command_py.c \
memory.c \
graph.c \
vector.c \
clippy.c \
# end
clippy_CPPFLAGS = -D_GNU_SOURCE
clippy_CFLAGS = $(PYTHON_CFLAGS)
clippy_LDADD = $(PYTHON_LIBS)
clippy-command_graph.$(OBJEXT): route_types.h
plist.lo: plist_clippy.c
EXTRA_DIST = \
queue.h \
command_lex.h \
route_types.pl route_types.txt \
gitversion.pl
route_types.h: $(srcdir)/route_types.txt $(srcdir)/route_types.pl
@PERL@ $(srcdir)/route_types.pl < $(srcdir)/route_types.txt > $@
if GIT_VERSION
# bit of a trick here to always have up-to-date git stamps without triggering
# unneccessary rebuilds. .PHONY causes the .tmp file to be rebuilt always,
# but if we use that on gitversion.h it'll ripple through the .c file deps.
# (even if gitversion.h's file timestamp doesn't change, make will think it
# did, because of .PHONY...)
.PHONY: gitversion.h.tmp
.SILENT: gitversion.h gitversion.h.tmp
GITH=gitversion.h
gitversion.h.tmp: $(srcdir)/../.git
@PERL@ $(srcdir)/gitversion.pl $(srcdir) > ${GITH}.tmp
gitversion.h: gitversion.h.tmp
{ test -f ${GITH} && diff -s -q ${GITH}.tmp ${GITH}; } || cp -v ${GITH}.tmp ${GITH}
else
.PHONY: gitversion.h
gitversion.h:
true
endif

View File

@ -49,8 +49,8 @@ RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\)
%option noyywrap
%option nounput
%option noinput
%option outfile="command_lex.c"
%option header-file="command_lex.h"
%option outfile="lib/command_lex.c"
%option header-file="lib/command_lex.h"
%option prefix="cmd_yy"
%option reentrant
%option bison-bridge

View File

@ -33,8 +33,8 @@
/* define api.prefix {cmd_yy} */
/* names for generated header and parser files */
%defines "command_parse.h"
%output "command_parse.c"
%defines "lib/command_parse.h"
%output "lib/command_parse.c"
/* note: code blocks are output in order, to both .c and .h:
* 1. %code requires

View File

@ -85,7 +85,7 @@ SPECIAL [(),]
%option noyywrap
%option noinput
%option nounput
%option outfile="defun_lex.c"
%option outfile="lib/defun_lex.c"
%option prefix="def_yy"
%option 8bit

253
lib/subdir.am Normal file
View File

@ -0,0 +1,253 @@
#
# libfrr
#
lib_LTLIBRARIES += lib/libfrr.la
lib_libfrr_la_LDFLAGS = -version-info 0:0:0
lib_libfrr_la_LIBADD = @LIBCAP@
lib_libfrr_la_SOURCES = \
lib/bfd.c \
lib/buffer.c \
lib/checksum.c \
lib/command.c \
lib/command_graph.c \
lib/command_lex.l \
lib/command_match.c \
lib/command_parse.y \
lib/csv.c \
lib/distribute.c \
lib/event_counter.c \
lib/filter.c \
lib/frr_pthread.c \
lib/getopt.c \
lib/getopt1.c \
lib/grammar_sandbox.c \
lib/graph.c \
lib/hash.c \
lib/hook.c \
lib/if.c \
lib/if_rmap.c \
lib/imsg-buffer.c \
lib/imsg.c \
lib/jhash.c \
lib/json.c \
lib/keychain.c \
lib/libfrr.c \
lib/linklist.c \
lib/log.c \
lib/md5.c \
lib/memory.c \
lib/memory_vty.c \
lib/module.c \
lib/network.c \
lib/nexthop.c \
lib/ns.c \
lib/openbsd-tree.c \
lib/pid_output.c \
lib/plist.c \
lib/pqueue.c \
lib/prefix.c \
lib/privs.c \
lib/ptm_lib.c \
lib/qobj.c \
lib/routemap.c \
lib/sha256.c \
lib/sigevent.c \
lib/skiplist.c \
lib/sockopt.c \
lib/sockunion.c \
lib/spf_backoff.c \
lib/srcdest_table.c \
lib/stream.c \
lib/strlcat.c \
lib/strlcpy.c \
lib/systemd.c \
lib/table.c \
lib/termtable.c \
lib/thread.c \
lib/vector.c \
lib/vrf.c \
lib/vty.c \
lib/wheel.c \
lib/workqueue.c \
lib/zclient.c \
# end
lib/plist.lo: lib/plist_clippy.c
pkginclude_HEADERS += \
lib/bfd.h \
lib/bitfield.h \
lib/buffer.h \
lib/checksum.h \
lib/command.h \
lib/command_graph.h \
lib/command_match.h \
lib/csv.h \
lib/distribute.h \
lib/event_counter.h \
lib/fifo.h \
lib/filter.h \
lib/frr_pthread.h \
lib/frratomic.h \
lib/getopt.h \
lib/graph.h \
lib/hash.h \
lib/hook.h \
lib/if.h \
lib/if_rmap.h \
lib/imsg.h \
lib/ipaddr.h \
lib/jhash.h \
lib/json.h \
lib/keychain.h \
lib/libfrr.h \
lib/libospf.h \
lib/linklist.h \
lib/log.h \
lib/md5.h \
lib/memory.h \
lib/memory_vty.h \
lib/module.h \
lib/monotime.h \
lib/mpls.h \
lib/network.h \
lib/nexthop.h \
lib/ns.h \
lib/openbsd-queue.h \
lib/openbsd-tree.h \
lib/plist.h \
lib/pqueue.h \
lib/prefix.h \
lib/privs.h \
lib/ptm_lib.h \
lib/qobj.h \
lib/route_types.h \
lib/routemap.h \
lib/sha256.h \
lib/sigevent.h \
lib/skiplist.h \
lib/smux.h \
lib/sockopt.h \
lib/sockunion.h \
lib/spf_backoff.h \
lib/srcdest_table.h \
lib/stream.h \
lib/systemd.h \
lib/table.h \
lib/termtable.h \
lib/thread.h \
lib/vector.h \
lib/version.h \
lib/vlan.h \
lib/vrf.h \
lib/vrf_int.h \
lib/vty.h \
lib/vxlan.h \
lib/wheel.h \
lib/workqueue.h \
lib/zassert.h \
lib/zclient.h \
lib/zebra.h \
# end
noinst_HEADERS += \
lib/clippy.h \
lib/log_int.h \
lib/plist_int.h \
#end
#
# SNMP support
#
if SNMP
lib_LTLIBRARIES += lib/libfrrsnmp.la
endif
lib_libfrrsnmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS)
lib_libfrrsnmp_la_LDFLAGS = -version-info 0:0:0
lib_libfrrsnmp_la_LIBADD = lib/libfrr.la $(SNMP_LIBS)
lib_libfrrsnmp_la_SOURCES = \
lib/agentx.c \
lib/smux.c \
lib/snmp.c \
# end
#
# CLI utilities
#
noinst_PROGRAMS += \
lib/clippy \
lib/grammar_sandbox \
# end
lib_grammar_sandbox_SOURCES = \
lib/grammar_sandbox_main.c
lib_grammar_sandbox_LDADD = \
lib/libfrr.la
lib_clippy_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir)/lib
lib_clippy_CFLAGS = $(PYTHON_CFLAGS)
lib_clippy_LDADD = $(PYTHON_LIBS)
lib_clippy_SOURCES = \
lib/clippy.c \
lib/command_graph.c \
lib/command_lex.l \
lib/command_parse.y \
lib/command_py.c \
lib/defun_lex.l \
lib/graph.c \
lib/memory.c \
lib/vector.c \
# end
#
# generated sources & extra foo
#
EXTRA_DIST += \
lib/command_lex.h \
lib/gitversion.pl \
lib/queue.h \
lib/route_types.pl \
lib/route_types.txt \
# end
BUILT_SOURCES += \
lib/command_lex.h \
lib/command_parse.h \
lib/gitversion.h \
lib/route_types.h \
# end
AM_YFLAGS = -d -Dapi.prefix=@BISON_OPENBRACE@cmd_yy@BISON_CLOSEBRACE@ @BISON_VERBOSE@
lib/command_lex.h: lib/command_lex.c
@if test ! -f $@; then rm -f "lib/command_lex.c"; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) "lib/command_lex.c"; else :; fi
lib/command_parse.lo: lib/command_lex.h
lib/lib_clippy-command_parse.$(OBJEXT): lib/command_lex.h
lib/route_types.h: $(top_srcdir)/lib/route_types.txt $(top_srcdir)/lib/route_types.pl
@PERL@ $(top_srcdir)/lib/route_types.pl < $(top_srcdir)/lib/route_types.txt > $@
if GIT_VERSION
# bit of a trick here to always have up-to-date git stamps without triggering
# unneccessary rebuilds. .PHONY causes the .tmp file to be rebuilt always,
# but if we use that on gitversion.h it'll ripple through the .c file deps.
# (even if gitversion.h's file timestamp doesn't change, make will think it
# did, because of .PHONY...)
.PHONY: lib/gitversion.h.tmp
.SILENT: lib/gitversion.h lib/gitversion.h.tmp
GITH=lib/gitversion.h
lib/gitversion.h.tmp: $(top_srcdir)/.git
@PERL@ $(top_srcdir)/lib/gitversion.pl $(top_srcdir) > ${GITH}.tmp
lib/gitversion.h: lib/gitversion.h.tmp
{ test -f ${GITH} && diff -s -q ${GITH}.tmp ${GITH}; } || cp -v ${GITH}.tmp ${GITH}
else
.PHONY: lib/gitversion.h
lib/gitversion.h:
true
endif