Skip to content

Commit

Permalink
build: non-recursive vtysh
Browse files Browse the repository at this point in the history
Signed-off-by: David Lamparter <[email protected]>
  • Loading branch information
eqvinox committed Sep 8, 2018
1 parent 84d837b commit 8b7668e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 30 deletions.
8 changes: 3 additions & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,13 @@ include pbrd/subdir.am
include staticd/subdir.am
include bfdd/subdir.am

include vtysh/subdir.am

SUBDIRS = . \
@VTYSH@ \
tests

DIST_SUBDIRS = . \
vtysh tests \
tests \
# end

if PKGSRC
Expand Down Expand Up @@ -169,9 +170,6 @@ EXTRA_DIST += \
snapcraft/helpers \
snapcraft/snap \
\
vtysh/Makefile.am \
vtysh/Makefile.in \
\
doc/Makefile \
doc/developer/Makefile \
doc/manpages/Makefile \
Expand Down
2 changes: 0 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,6 @@ fi
AM_CONDITIONAL([ENABLE_BGP_VNC], [test x${enable_bgp_vnc} != xno])

AC_SUBST(SOLARIS)
AC_SUBST(VTYSH)
AC_SUBST(CURSES)
AC_CHECK_LIB(crypt, crypt, [],
[AC_CHECK_LIB(crypto, DES_crypt)])
Expand Down Expand Up @@ -2009,7 +2008,6 @@ AC_MSG_RESULT($ac_cv_htonl_works)
AC_CONFIG_FILES([Makefile],[sed -e 's/^#AUTODERP# //' -i Makefile])

AC_CONFIG_FILES([
vtysh/Makefile
tests/Makefile
redhat/frr.spec
solaris/Makefile
Expand Down
2 changes: 1 addition & 1 deletion vtysh/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Makefile
!Makefile
Makefile.in
*.o
vtysh
Expand Down
10 changes: 10 additions & 0 deletions vtysh/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all: ALWAYS
@$(MAKE) -s -C .. vtysh/vtysh
%: ALWAYS
@$(MAKE) -s -C .. vtysh/$@

Makefile:
#nothing
ALWAYS:
.PHONY: ALWAYS makefiles
.SUFFIXES:
4 changes: 2 additions & 2 deletions vtysh/extract.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ print <<EOF;
#include "command.h"
#include "linklist.h"

#include "vtysh.h"
#include "vtysh/vtysh.h"

EOF

Expand All @@ -40,7 +40,7 @@ sub scan_file {

$cppadd = $fabricd ? "-DFABRICD=1" : "";

open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_builddir@/lib -I@top_srcdir@/bgpd -I@top_srcdir@/@LIBRFP@ -I@top_srcdir@/bgpd/rfapi @CPPFLAGS@ $cppadd $file |");
open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -Ivtysh/@top_builddir@ -Ivtysh/@top_srcdir@ -Ivtysh/@top_srcdir@/lib -Ivtysh/@top_builddir@/lib -Ivtysh/@top_srcdir@/bgpd -Ivtysh/@top_srcdir@/bgpd/rfapi @CPPFLAGS@ $cppadd $file |");
local $/; undef $/;
$line = <FH>;
close (FH);
Expand Down
51 changes: 31 additions & 20 deletions vtysh/Makefile.am → vtysh/subdir.am
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
## Process this file with Automake to create Makefile.in
#
# vtysh
#

include ../common.am

AM_CPPFLAGS += -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib \
$(BGP_VNC_RFAPI_INCDIR) $(BGP_VNC_RFP_INCDIR)
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"

LIBS = @LIBS@ @CURSES@ @LIBPAM@
if VTYSH
bin_PROGRAMS += vtysh/vtysh
dist_examples_DATA += vtysh/vtysh.conf.sample
endif

bin_PROGRAMS = vtysh
vtysh_vtysh_SOURCES = \
vtysh/vtysh_main.c \
vtysh/vtysh.c \
vtysh/vtysh_user.c \
vtysh/vtysh_config.c \
# end
nodist_vtysh_vtysh_SOURCES = \
vtysh/vtysh_cmd.c \
# end
CLEANFILES += vtysh/vtysh_cmd.c

vtysh_SOURCES = vtysh_main.c vtysh.c vtysh_user.c vtysh_config.c
nodist_vtysh_SOURCES = vtysh_cmd.c
CLEANFILES = vtysh_cmd.c
noinst_HEADERS = vtysh.h vtysh_user.h
vtysh_LDADD = ../lib/libfrr.la @LIBCAP@ @LIBREADLINE@
noinst_HEADERS += \
vtysh/vtysh.h \
vtysh/vtysh_user.h \
# end

examplesdir = $(exampledir)
dist_examples_DATA = vtysh.conf.sample
vtysh_vtysh_LDADD = lib/libfrr.la @LIBCAP@ @LIBREADLINE@ @LIBS@ @CURSES@ @LIBPAM@

EXTRA_DIST = extract.pl
EXTRA_DIST += vtysh/extract.pl

vtysh_scan =

Expand Down Expand Up @@ -147,7 +153,7 @@ if BFDD
vtysh_scan += $(top_srcdir)/bfdd/bfdd_vty.c
endif

vtysh_cmd_FILES = $(vtysh_scan) \
vtysh_vtysh_cmd_FILES = $(vtysh_scan) \
$(top_srcdir)/lib/keychain.c $(top_srcdir)/lib/routemap.c \
$(top_srcdir)/lib/filter.c $(top_srcdir)/lib/plist.c \
$(top_srcdir)/lib/distribute.c $(top_srcdir)/lib/if_rmap.c \
Expand All @@ -167,5 +173,10 @@ vtysh_cmd_FILES = $(vtysh_scan) \
$(top_srcdir)/watchfrr/watchfrr_vty.c \
# end

vtysh_cmd.c: $(vtysh_cmd_FILES) extract.pl
./extract.pl $(vtysh_cmd_FILES) > vtysh_cmd.c
AM_V_EXTRACT = $(am__v_EXTRACT_$(V))
am__v_EXTRACT_ = $(am__v_EXTRACT_$(AM_DEFAULT_VERBOSITY))
am__v_EXTRACT_0 = @echo " EXTRACT " $@;
am__v_EXTRACT_1 =

vtysh/vtysh_cmd.c: $(vtysh_vtysh_cmd_FILES) vtysh/extract.pl
$(AM_V_EXTRACT) vtysh/extract.pl $(vtysh_vtysh_cmd_FILES) > vtysh/vtysh_cmd.c

0 comments on commit 8b7668e

Please sign in to comment.