[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: background jobs in makefile
From: |
Henrik Carlqvist |
Subject: |
Re: background jobs in makefile |
Date: |
Wed, 08 Dec 2010 15:04:04 -0000 |
User-agent: |
Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) |
James <hslee911@yahoo.com> wrote:
> all:
> for f in xx yy; do\
> (make $$f &);\
> done;\
> wait
> @echo [ $@:done ]
>
> xx yy:
> sleep 2
> @echo [ $@:done ]
>
>
> How do I put backgroud jobs in makefile?
> "wait" does not seem to work here.
The right way to do it:
Makefile:
-8<-------------------------
all: xx yy
xx yy:
sleep 2
@echo [ $@:done ]
-8<-------------------------
Then, at the command prompt type:
make -j 5
The number after -j is the maximum number of simultaneous jobs that make
will spawn. It is also possible (but sometimes dangerous) to not give any
number att all:
make -j
Then make does not limit the number of simultaneous jobs spawned.
regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc123(at)poolhem.se Examples of addresses which go to spammers:
root@localhost postmaster@localhost