On 05/21/2014 12:03 AM, Waldek Hebisch wrote:
> I propose the patch in the attachement.  Merits:
> 
> - it avoids using spurious files which just happen to
>   match a wildcard

That's good.

> - knowledge about spad sources is limited to algebra

Perhaps also good.

> - extra dependence between algebra and doc is limited
>   to a single file

Good, but not perfect.

I strongly dislike the ../algebra part by which you refer to the
abbrev.list file.

In src/doc/Makefile I used

# We need access to the algebra source in order to generate a list of
# abbreviations (filenames and corresponding constructor name.
ALGEBRASOURCES=${fricas_src_algdir}

where I used

fricas_src_algdir = $(fricas_src_srcdir)/algebra

from config/var-def.mk.

I would rather like to add an extra variable that points to the
directory in which abbrev.list lives. For src/doc/Makefile, it shouldn't
matter where it lives, I just need a parameter. I dislike hardcoding it
via ../algebra .

So putting something like

algebra_srcdir = @top_srcdir@/src/algebra

into var-def.mk and then writing

examples.list: ${algebra_srcdir}/abbrev.list
        (for a in ${EXAMPLES}; do echo "-- $$a"; done; \
         cat $< \
        ) | ${AWK} '{if($$1=="--"){a[$$2]=1}else{if($$1 in a){print}}}'\
          | sort -k2 > $@

would be better for my taste.

Technically, your patch looks OK, just when I ran it inside src/algebra
to produce abbrev.list, I got a bit shocked by *one* big line like ...

sed -n 's/^)abbrev [a-z]*  *\([A-Z0-9]*\) *\([^ ]*\)/\1 \2/p' \
         /home/hemmecke/g/fricas-bisect/fricas/src/algebra/acplot.spad
/home/hemmecke/g/fricas-bisect/fricas/src/algebra/aggcat2.spad
/home/hemmecke/g/fricas-bisect/fricas/src/algebra/aggcat.spad
/home/hemmecke/g/fricas-bisect/fricas/src/algebra/algcat.spad
/home/hemmecke/g/fricas-bisect/fricas/src/algebra/algext.spad
/home/hemmecke/g/fricas-bisect/fricas/src/algebra/algfact.spad
... cut ...
/home/hemmecke/g/fricas-bisect/fricas/src/algebra/xpoly.spad
/home/hemmecke/g/fricas-bisect/fricas/src/algebra/ystream.spad
/home/hemmecke/g/fricas-bisect/fricas/src/algebra/zerodim.spad > abbrev.list

I immediately feared that this is going to lead to problems if my
directory name would have been even longer. Isn't there a max line
length that could eventually break the build?

Maybe VPATH would be a solution to that problem.

================
SPAD_SOURCES=$(patsubst %, %.spad, $(SPAD_SRCS))
VPATH=${srcdir}
abbrev.list: $(SPAD_SOURCES)
        sed -n 's/^)abbrev [a-z]*  *\([A-Z0-9]*\) *\([^ ]*\)/\1 \2/p' \
        $^ > $@
================

But I'm not sure whether that works in nonGNU make.

In addition to all of that...
Maybe it would be a good idea to already sort abbrev.list alphabetically
with respect to the long name of the constructor.

Ralf

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to