Skip site navigation (1)Skip section navigation (2)
Date:      29 Jan 2002 01:47:48 -0800
From:      Ken McGlothlen <mcglk@artlogix.com>
To:        questions@freebsd.org
Subject:   Make question.
Message-ID:  <87aduxbi9n.fsf@ralf.artlogix.com>

next in thread | raw e-mail | index | archive | help
Something Is Odd.  I guess I don't understand the .for .. .endfor function.

For example, I have a directory loaded with files whose names are in the form
yyyymmdd.wmi (yyyy is the four-digit year, mm is the two-digit month, and dd is
the two-digit day, with ".wmi" being the "filetype").  When I have a Makefile
that goes like this:

        MONTHS          = 200110 200111 200112 200201
        MONTHS_WMIS     = 200110.wmi 200111.wmi 200112.wmi 200201.wmi
        DSTS            = 200110.html 200111.html 200112.html 200201.html

        all: $(DSTS)

        .for MONTH in $(MONTHS)
        DAY_WMIS != ls -1 ????????.wmi | grep '^'$(MONTH) | sort | uniq

        $(MONTH).html: $(DAY_WMIS) $(MONTH)i.wmi
                @echo "MONTHS:    " $(MONTHS)
                @echo "MONTH:     " $(MONTH)
                @echo "DAY_WMIS:  " $(DAY_WMIS)
                @echo "Making --> " $(MONTH).html

        $(MONTH)i.wmi: $(DAY_WMIS)
                ls -1 $(DAY_WMIS) | sort > $(MONTH)i.wmi
                @echo "Making --> " $(MONTH)i.wmi
        .endfor

and type make, I get this:

        $ make
        MONTHS:     200110 200111 200112 200201
        MONTH:      200110
        DAY_WMIS:   20020127.wmi 20020128.wmi
        Making -->  200110.html
        MONTHS:     200110 200111 200112 200201
        MONTH:      200111
        DAY_WMIS:   20020127.wmi 20020128.wmi
        Making -->  200111.html
        MONTHS:     200110 200111 200112 200201
        MONTH:      200112
        DAY_WMIS:   20020127.wmi 20020128.wmi
        Making -->  200112.html
        MONTHS:     200110 200111 200112 200201
        MONTH:      200201
        DAY_WMIS:   20020127.wmi 20020128.wmi
        Making -->  200201.html
        $ _

While it appears that the .for loop is working (according to MONTH), the
DAY_WMIS value doesn't change.  Is there any other way to do this so that it'll
work?

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87aduxbi9n.fsf>