help-make
[Top][All Lists]
Advanced

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

Re: Making in subdirectories


From: Paul D. Smith
Subject: Re: Making in subdirectories
Date: Mon, 19 Feb 2001 12:15:43 -0500

%% Magnus Fromreide <address@hidden> writes:

  mf> In what section? Phony targets?

Yes.

  mf> Are you suggesting

  mf> SUBDIRS:=A B
  mf> PROGS:=$(SUBDIRS:%=prog%)
  mf> LIBS:=$(SUBDIRS:%=lib%)
  mf> TARGET=null

  mf> prog: $(PROGS)
  mf> $(PROGS): $(LIBS)
  mf> lib: $(LIBS)
  mf> $(PROGS): TARGET=prog
  mf> $(LIBS): TARGET=lib
  mf> $(LIBS) $(PROGS):
  mf>         @test -d $(@:$(TARGET)%=%) || mkdir $(@:$(TARGET)%=%)
  mf>         $(MAKE) -C $(@:$(TARGET)%=%) $(TARGET)

  mf> .PHONY: $(LIBS) $(PROGS) lib prog

  mf> or what?

  >> Try $(MAKECMDGOALS).

  mf> I still can't see how MAKECMDGOALS could help me in this situation.

Something like this:

  SUBDIRS   = A B

  prog:
  prog lib: $(SUBDIRS)

  $(SUBDIRS):
          $(MAKE) -C $@ $(MAKECMDGOALS)

  .PHONY: $(SUBDIRS) prog lib

Does this not do something you need?

You can also make simple prerequisites, like:

  a: b

to make sure everything builds in the right order in the face of
parallel builds.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist



reply via email to

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