make yacc usage POSIX compatible
config: put YACC in config.mk and use environmental variable if present ss: use YACC variable instead of hardcoding bison place options before source file argument use -b to specify file prefix instead of output file, as -o isn't POSIX compatible, this generates ssfilter.tab.c instead of ssfilter.c replace any references to ssfilter.c with references to ssfilter.tab.c tc: use -p flag to set name prefix instead of bison-specific api.prefix directive remove unneeded bison-specific directives use -b instead of -o, replace references to previously generated emp_ematch.yacc.[ch] with references to newly generated emp_ematch.tab.[ch] Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
31f45088c9
commit
5f78bc3e1d
|
|
@ -16,9 +16,11 @@ check_toolchain()
|
||||||
: ${PKG_CONFIG:=pkg-config}
|
: ${PKG_CONFIG:=pkg-config}
|
||||||
: ${AR=ar}
|
: ${AR=ar}
|
||||||
: ${CC=gcc}
|
: ${CC=gcc}
|
||||||
|
: ${YACC=bison}
|
||||||
echo "PKG_CONFIG:=${PKG_CONFIG}" >>$CONFIG
|
echo "PKG_CONFIG:=${PKG_CONFIG}" >>$CONFIG
|
||||||
echo "AR:=${AR}" >>$CONFIG
|
echo "AR:=${AR}" >>$CONFIG
|
||||||
echo "CC:=${CC}" >>$CONFIG
|
echo "CC:=${CC}" >>$CONFIG
|
||||||
|
echo "YACC:=${YACC}" >>$CONFIG
|
||||||
}
|
}
|
||||||
|
|
||||||
check_atm()
|
check_atm()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
arpd
|
arpd
|
||||||
ifstat
|
ifstat
|
||||||
ss
|
ss
|
||||||
ssfilter.c
|
ssfilter.tab.c
|
||||||
nstat
|
nstat
|
||||||
lnstat
|
lnstat
|
||||||
rtacct
|
rtacct
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
SSOBJ=ss.o ssfilter.o
|
SSOBJ=ss.o ssfilter.tab.o
|
||||||
LNSTATOBJ=lnstat.o lnstat_util.o
|
LNSTATOBJ=lnstat.o lnstat_util.o
|
||||||
|
|
||||||
TARGETS=ss nstat ifstat rtacct lnstat
|
TARGETS=ss nstat ifstat rtacct lnstat
|
||||||
|
|
@ -27,8 +27,8 @@ rtacct: rtacct.c
|
||||||
arpd: arpd.c
|
arpd: arpd.c
|
||||||
$(QUIET_CC)$(CC) $(CFLAGS) -I$(DBM_INCLUDE) $(CPPFLAGS) $(LDFLAGS) -o arpd arpd.c $(LDLIBS) -ldb
|
$(QUIET_CC)$(CC) $(CFLAGS) -I$(DBM_INCLUDE) $(CPPFLAGS) $(LDFLAGS) -o arpd arpd.c $(LDLIBS) -ldb
|
||||||
|
|
||||||
ssfilter.c: ssfilter.y
|
ssfilter.tab.c: ssfilter.y
|
||||||
$(QUIET_YACC)bison ssfilter.y -o ssfilter.c
|
$(QUIET_YACC)$(YACC) -b ssfilter ssfilter.y
|
||||||
|
|
||||||
lnstat: $(LNSTATOBJ)
|
lnstat: $(LNSTATOBJ)
|
||||||
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
|
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
*.yacc.c
|
*.tab.c
|
||||||
*.lex.c
|
*.lex.c
|
||||||
*.output
|
*.output
|
||||||
*.yacc.h
|
*.tab.h
|
||||||
tc
|
tc
|
||||||
|
|
|
||||||
13
tc/Makefile
13
tc/Makefile
|
|
@ -1,7 +1,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o tc_monitor.o \
|
TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o tc_monitor.o \
|
||||||
tc_exec.o m_police.o m_estimator.o m_action.o m_ematch.o \
|
tc_exec.o m_police.o m_estimator.o m_action.o m_ematch.o \
|
||||||
emp_ematch.yacc.o emp_ematch.lex.o
|
emp_ematch.tab.o emp_ematch.lex.o
|
||||||
|
|
||||||
include ../config.mk
|
include ../config.mk
|
||||||
|
|
||||||
|
|
@ -125,7 +125,6 @@ ifneq ($(IPT_LIB_DIR),)
|
||||||
CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
|
CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
YACC := bison
|
|
||||||
LEX := flex
|
LEX := flex
|
||||||
CFLAGS += -DYY_NO_INPUT
|
CFLAGS += -DYY_NO_INPUT
|
||||||
|
|
||||||
|
|
@ -158,8 +157,8 @@ install: all
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \
|
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.tab.h; \
|
||||||
rm -f emp_ematch.yacc.*
|
rm -f emp_ematch.tab.*
|
||||||
|
|
||||||
q_atm.so: q_atm.c
|
q_atm.so: q_atm.c
|
||||||
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
|
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
|
||||||
|
|
@ -178,8 +177,8 @@ ifeq ($(TC_CONFIG_XT),y)
|
||||||
LDLIBS += $$($(PKG_CONFIG) xtables --libs)
|
LDLIBS += $$($(PKG_CONFIG) xtables --libs)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
%.yacc.c: %.y
|
%.tab.c: %.y
|
||||||
$(QUIET_YACC)$(YACC) $(YACCFLAGS) -o $@ $<
|
$(QUIET_YACC)$(YACC) $(YACCFLAGS) -p ematch_ -b $(basename $(basename $@)) $<
|
||||||
|
|
||||||
%.lex.c: %.l
|
%.lex.c: %.l
|
||||||
$(QUIET_LEX)$(LEX) $(LEXFLAGS) -o$@ $<
|
$(QUIET_LEX)$(LEX) $(LEXFLAGS) -o$@ $<
|
||||||
|
|
@ -187,7 +186,7 @@ endif
|
||||||
# our lexer includes the header from yacc, so make sure
|
# our lexer includes the header from yacc, so make sure
|
||||||
# we don't attempt to compile it before the header has
|
# we don't attempt to compile it before the header has
|
||||||
# been generated as part of the yacc step.
|
# been generated as part of the yacc step.
|
||||||
emp_ematch.lex.o: emp_ematch.yacc.c
|
emp_ematch.lex.o: emp_ematch.tab.c
|
||||||
|
|
||||||
ifneq ($(SHARED_LIBS),y)
|
ifneq ($(SHARED_LIBS),y)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0 */
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
%{
|
%{
|
||||||
#include "emp_ematch.yacc.h"
|
#include "emp_ematch.tab.h"
|
||||||
#include "m_ematch.h"
|
#include "m_ematch.h"
|
||||||
|
|
||||||
extern int ematch_argc;
|
extern int ematch_argc;
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,6 @@
|
||||||
#include "m_ematch.h"
|
#include "m_ematch.h"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%locations
|
|
||||||
%token-table
|
|
||||||
%define parse.error verbose
|
|
||||||
%define api.prefix {ematch_}
|
|
||||||
|
|
||||||
%union {
|
%union {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct bstr *b;
|
struct bstr *b;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue