<div dir="ltr"><div>I don't think you need to explicitly include the .config file [in case you're doing that].<br></div>Running the build should create those vars cleanly.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 23, 2015 at 2:53 PM, Mats Karrman <span dir="ltr"><<a href="mailto:mats.dev.list@gmail.com" target="_blank">mats.dev.list@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Thanks for your help!<br>
    <br>
    I was actually working on something similar to your (2), using
    CONFIG_ variables but there were some trouble with the logic behind
    including the .config file and then also, all string options are
    exported with "quotes" around them and that messed up the DEPENDENCY
    declaration.<br>
    <br>
    BR // Mats<div><div class="h5"><br>
    <br>
    <div>On 2015-01-23 08:18, Alexandru Ardelean
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>Well, you need to specifiy Ax in the DEPENDS section of
              B.<br>
            </div>
            <div>Since there are 3 Ax, you can do it 2 ways:<br>
            </div>
            <br>
            1) Create Bx (x = 1-3) packages; B1 depends on A1, B2
            depends on A2, B3 depends on A3; so, if you select the
            correct Bx, the correct Ax will also get built.<br>
          </div>
          You can also use build variants to keep Bx in a single
          Makefile; you can check the  package/ncurses/Makefile for
          hints. <br>
        </div>
        The build variants does not seem too popular, but you can try
        it.<br>
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div><br>
                    2) In the Makefile of B you can do a "dynamic"
                    DEPENDS.<br>
                    Before the package definition (i.e.  define
                    Package/B ) you can add a A_DEPENDS variable.<br>
                  </div>
                  <div>You can do something like:<br>
                    ifeq ($(A_DEPENDS),)<br>
                  </div>
                  <div>   ifeq ($(CONFIG_A1),y)<br>
                  </div>
                  <div>        A_DEPENDS := A1<br>
                  </div>
                  <div>   endif<br>
                  </div>
                  <div>endif<br>
                  </div>
                  <div>ifeq ($(A_DEPENDS),)<br>
                    <div>   ifeq ($(CONFIG_A2),y)<br>
                    </div>
                    <div>        A_DEPENDS := A2<br>
                    </div>
                    <div>   endif<br>
                    </div>
                    <div>endif<br>
                    </div>
                    ifeq ($(A_DEPENDS),)<br>
                    <div>   ifeq ($(CONFIG_A3),y)<br>
                    </div>
                    <div>        A_DEPENDS := A3<br>
                    </div>
                    <div>   endif<br>
                    </div>
                    <div>endif<br>
                    </div>
                    A_DEPENDS should equal to either A1, A2 or A3, if
                    either is selected. Note that CONFIG_Ax is as
                    defined in the .config file.<br>
                  </div>
                  <div>Then<br>
                    define Package/B<br>
                  </div>
                  <div>  DEPENDS:= ............ $(A_DEPENDS)<br>
                  </div>
                  <div>endef<br>
                  </div>
                  <div><br>
                  </div>
                  <div>If I look at this approach, it does what you
                    asked for.<br>
                    But all in all, I would say there would be a cleaner
                    approach if Ax and B are known.<br>
                  </div>
                  <div><br>
                  </div>
                  <div>If the assumption would be that Ax are similar
                    packages (or variants of a base A), then I'd make a
                    single package A, and define some options to it.<br>
                  </div>
                  <div>Based on those options A would be a variation of
                    type Ax (x = 1 - 3).<br>
                  </div>
                  <div>Then  <br>
                  </div>
                  <div>define Package/B<br>
                    <div>  DEPENDS:= ............ A<br>
                    </div>
                    <div>endef<br>
                    </div>
                    <div><br>
                    </div>
                    <div>And you can configure A with whatever options
                      you need.<br>
                    </div>
                    <div><br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, Jan 22, 2015 at 8:34 PM, Mats
          Karrman <span dir="ltr"><<a href="mailto:mats.dev.list@gmail.com" target="_blank">mats.dev.list@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
            <br>
            I'm struggling with a problem and I can't really get it to
            work as I want.<br>
            <br>
            Say you have 3 packages, A1, A2 and A3, that all provide the
            include file "f.h".<br>
            I also have package B that build-time depends on "f.h".<br>
            <br>
            I will enable either A1, A2 or A3 in the .config for a build
            but how do I make<br>
            OpenWRT understand that it cannot build B until either of Ax
            is built?<br>
            <br>
            I'd be ever so greatfull for some good hints on how to solve
            this.<br>
            <br>
            (and oh, I'm on "Attitude-Adjustment")<br>
            <br>
            Best regards,<br>
            Mats<br>
            _______________________________________________<br>
            openwrt-devel mailing list<br>
            <a href="mailto:openwrt-devel@lists.openwrt.org" target="_blank">openwrt-devel@lists.openwrt.org</a><br>
            <a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel" target="_blank">https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>