[ofa-general] Re: [PATCH 5/7] osm: QoS - compiling policy file parser

Michael S. Tsirkin mst at dev.mellanox.co.il
Mon Aug 20 05:40:49 PDT 2007


> Quoting Michael S. Tsirkin <mst at dev.mellanox.co.il>:
> Subject: Re: [PATCH 5/7] osm: QoS - compiling policy file parser
> 
> > Quoting Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>:
> > Subject: [PATCH 5/7] osm: QoS - compiling policy file parser
> > 
> > Compiling QoS policy file parser.
> > 
> > C & H files are generated from Lex & Yacc files and the 
> > generated files are compiled.
> > Generated files are not included in git, but they do get
> > included in RPM as they are also created by 'make dist'.
> > 
> > Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
> > ---
> >  opensm/include/Makefile.am |    2 ++
> >  opensm/opensm/Makefile.am  |   28 +++++++++++++++++++++++++++-
> >  opensm/opensm/configure.in |    2 ++
> >  3 files changed, 31 insertions(+), 1 deletions(-)
> > 
> > diff --git a/opensm/include/Makefile.am b/opensm/include/Makefile.am
> > index ea62507..b83205f 100644
> > --- a/opensm/include/Makefile.am
> > +++ b/opensm/include/Makefile.am
> > @@ -90,6 +90,8 @@ EXTRA_DIST = \
> >  	$(srcdir)/opensm/osm_state_mgr_ctrl.h \
> >  	$(srcdir)/opensm/osm_perfmgr.h \
> >  	$(srcdir)/opensm/osm_perfmgr_db.h \
> > +	$(srcdir)/opensm/osm_qos_policy.h \
> > +	$(srcdir)/opensm/osm_qos_parser_y.h \
> >  	$(srcdir)/complib/cl_thread_osd.h \
> >  	$(srcdir)/complib/cl_packon.h \
> >  	$(srcdir)/complib/cl_atomic_osd.h \
> > diff --git a/opensm/opensm/Makefile.am b/opensm/opensm/Makefile.am
> > index 6dfa824..6c7208d 100644
> > --- a/opensm/opensm/Makefile.am
> > +++ b/opensm/opensm/Makefile.am
> > @@ -56,7 +56,21 @@ opensm_SOURCES = main.c osm_console.c osm_db_files.c \
> >  		 osm_ucast_lash.c osm_ucast_file.c osm_ucast_ftree.c \
> >  		 osm_vl15intf.c osm_vl_arb_rcv.c \
> >  		 st.c osm_perfmgr.c osm_perfmgr_db.c \
> > -		 osm_event_plugin.c osm_dump.c
> > +		 osm_event_plugin.c osm_dump.c \
> > +		 osm_qos_parser_y.c osm_qos_parser_l.c osm_qos_policy.c
> > +
> > +osm_qos_parser_y.c: $(srcdir)/osm_qos_parser.y $(srcdir)/../include/opensm/osm_qos_policy.h
> > +	$(YACC) -y -d $(srcdir)/osm_qos_parser.y
> > +	mv y.tab.c osm_qos_parser_y.c
> > +	mv y.tab.h osm_qos_parser_y.h
> > +	cp -f osm_qos_parser_y.c $(srcdir)/
> > +	cp -f osm_qos_parser_y.h $(srcdir)/../include/opensm/
> > +
> > +osm_qos_parser_l.c: $(srcdir)/osm_qos_parser.l $(srcdir)/../include/opensm/osm_qos_policy.h
> > +	$(LEX) $(srcdir)/osm_qos_parser.l
> > +	mv lex.yy.c osm_qos_parser_l.c
> > +	cp -f osm_qos_parser_l.c $(srcdir)/
> > +
> 
> Why do you use these mv tricks?
> Can you not use the -o flag to generate the output file with the proper name?

Alternatively, if you do not want to use flex/bison extensions,
you can use -t flag to have lex output to standard output,
and -b flag to supply prefix to yacc.

BTW, I think it's a good idea to also use -p prefix to reduce
the global namespace pollution by yacc.


-- 
MST



More information about the general mailing list