lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Moving away from make


From: Graham Percival
Subject: Re: Moving away from make
Date: Sat, 1 Oct 2011 13:35:02 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

On Sat, Oct 01, 2011 at 02:12:44AM +0200, address@hidden wrote:
> It might be true that Python is more readable for newcomers than make
> (though reading your examples, I'm not at all convinced of that...) --
> but how much does that really matter?

Many people already have some familiarity with python --
particularly in lilypond, where a good chunk of our code is in
python.  This lessens the burden of understanding build-system
stuff.

> The reason casual contributors
> have trouble making build system modifications, is not the syntax (which
> is really easy to learn IMHO), but the fact that build systems are
> inherently a very complex matter. (As you observed yourself...) The best
> syntax imaginable won't do anything to change this.

The benefit of python is that you can leverage existing python
knowledge, as well as using niceties like loops and functions.

For example, take a look at make/website.make.  I spent somewhere
on the order of 50 hours working on the new website build system
(including other scripts, not just that file).  I found some info
on creating loops in gnu make, but it didn't seem possible to have
loops in pure bsd make.  So I resorted to bash, i.e.:

website-xrefs: website-version
        for l in '' $(WEB_LANGS); do \
                len="$${#l}" ; \
                r="$$l"; \
                if [ "$$len" -gt "0" ] ; then \
                        r="$$r"/; \
                fi ; \
                $(EXTRACT_TEXI_FILENAMES) \
                        -I $(top-src-dir)/Documentation \
                        -I $(top-src-dir)/Documentation/"$$l" \
                        -I $(OUT) -o $(OUT) --split=node \
                        
--known-missing-files=$(top-src-dir)/scripts/build/website-known-missing-files.txt
\
                        $(quiet-flag) \
                        $(top-src-dir)/Documentation/"$$l"/web.texi
;\
                for m in $(MANUALS); do \
                        n=`echo "$$m" | sed
's/Documentation/Documentation\/'$$l'/'` ; \
                        b=`basename "$$n" .texi`; \
                        d=`basename "$$b" .tely`; \
                        if [ -e "$$n" ] ; then \
                                $(EXTRACT_TEXI_FILENAMES) \
                                -I $(top-src-dir)/Documentation \
                                -I
$(top-src-dir)/Documentation/"$$l" \
                                -I
$(top-src-dir)/Documentation/"$$r""$$d" \
                                
--known-missing-files=$(top-src-dir)/scripts/build/website-known-missing-files.txt
\
                          $(quiet-flag) \
                                -I $(OUT) -o $(OUT) "$$n" ; \
                        fi ; \
                done; \
        done;


this is, of course, completely disgusting.  line continuations on
top of a bash for loop on top of make results in horrible
substition rules like
        len="$${#l}"

I really, really wish that I could have written this in python.
Rewriting that as 2 or 3 python functions would make it so much
easier to read and understand!
(can you have functions in makefiles?  that would simplify stuff)


I may have missed some simple way to do the above in make.  If so,
please let me know about it!

Cheers,
- Graham



reply via email to

[Prev in Thread] Current Thread [Next in Thread]