Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

background jobs in makefile

2 views
Skip to first unread message

James

unread,
Aug 18, 2010, 1:46:11 PM8/18/10
to
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.

TIA
jl

Henrik Carlqvist

unread,
Aug 18, 2010, 3:36:30 PM8/18/10
to

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

0 new messages