Menu

A Dependancy Question

Help
2008-08-12
2013-03-15
  • Carl Inglis

    Carl Inglis - 2008-08-12

    Greetings,

    I am using makepp to manage a BI system. One of the requirements of this system is that certain files only be rebuilt once a month, but only after one of the other files has been built.

    (To be more specific, the "pricebook" needs to be rebuilt monthly, but only after the "sales-ytd" has been built.)

    The problem I have is that the "sales-ytd" is built daily, and therefore if I put the "pricebook" as having a dependancy on the "sales-ytd", the "pricebook" will be built daily.

    "pricebook" has a dependancy on a file which is created monthly by a different process, so triggering the monthly rebuild is not a problem; the only problem comes from the fact that the "pricebook" must be built /after/ the "sales-ytd".

    What I'm looking for is a way to specific precedence of build, without triggering a rebuild.

    The files concerned are not C, or C++; they are a scripting language, specific to this BI system, and therefore any rules which rely on default behaviour won't be an use.

    Any pointers, ideas, thoughts or questions are welcomed.

    Thanks!

    Carl

     
    • Daniel Pfeiffer

      Daniel Pfeiffer - 2008-08-13

      Hi Carl,

      From a make point of view I think there is no solution.  But by using Perl to cheat a bit you can do it:

      pricebook: sales-ytd other-monthly
          ifperl (localtime)[3] == 1
              &echo foo bar -o $(output)     # whatever creates the file
          else
              perl {}
          endif

      This changes the rule, doing something real when monthday is 1, and a dummy empty action on all other days.  The rule will get performed every time, but will only actually change the file on each 1st.

      Hiding the whole rule won't work, because you will likely have a dependency on it (from $(phony all) or some such), and makepp will also complain about a stale file (which used to have rule, but no longer does).

      Another way would be to leave this rule unconditional, not to depend on it, and to have a different invocation of mpp on the 1st, passing pricebook as a command line target.

      regards
      Daniel

       
      • Carl Inglis

        Carl Inglis - 2008-08-18

        Hi Daniel,

        I like the idea of a seperate target; that way my perl script can run the monthly stuff after the main make and then only if needed.

        Thanks for that!

        Carl

         

Log in to post a comment.