[Top][All Lists]

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

looping over prerequisites

From: Rajarshi Guha
Subject: looping over prerequisites
Date: Wed, 06 Oct 2004 00:22:39 -0400

  I've recently been delving into make and I'm facing a simple problem
that I can't seem to get around.

I have a src directory that has a few subdirectories, each one having
its own makefile.

My top level makefile would like this:

        $(MAKE) -C subdir1
        $(MAKE) -C subdir2

and so on.

Is there any way to shorten this? In addition the makefiles in each
subdirectory have 2 or 3 targets (all, install, clean). So I'd like to
call the 'all' target in the top level makefile and it should recurse
through the sub directories each time calling the 'all' target in each
subdirectory and so on.

So what I want is:

        for each subdir
                $(MAKE) -C $subdir all
        for each subdir
                $(MAKE) -C $subdir install

and so on

I had tried doing this:

SUBDIRS=subdir1 subdir2 subdir3

all: $(SUBDIRS)
        $(MAKE) -C $(SUBDIRS)

but this clearly doesn't work as it tries to pass everything after the
subdir1 as a target to the makefile under subdir1/

I'd appreciate any pointers to how I can achieve this.


Rajarshi Guha <address@hidden> <>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
Q: What is a dyslexic, agnostic, insomniac?
A: Someone who lays awake at night wondering if there really is a dog!

reply via email to

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