[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question on patten matching and GNUmake
From: |
Praveen Jain |
Subject: |
Question on patten matching and GNUmake |
Date: |
Wed, 30 Jun 2004 21:56:09 -0700 |
I intend to do:
gmake sup/libbmp.so
gmake lc/libbmp.so
1) Following works for me:
1.1) a global rule:
%.so:
@mkdir -p $(@D)
$(LD) $(LIBLDOPTS) $^ -o $@
1.2) In makefile I do:
sup/libbmp.so: sup/a.o sup/b.o
lc/libbmp.so: lc/a.o lc/b.o
2) I've few targets (such as sup, lc) but too many libs in various
directories. So to reduce permutations, I tried to do following instead
2.1) global rule:
sup/%.so lc/%.so:
@mkdir -p $(@D)
$(LD) $(LIBLDOPTS) $^ -o $@
2.2) In makefile now I do:
%/libbmp.so: %/a.o %/b.o
when I do gmake sup/libbmp.so or lc/libbmp.so, it tells me target is undefined.
3) If I modify as follows:
a global rule: same as (2.1)
3.1) In makefile, I do:
%/libbmp.so: %/a.o %/b.o ; # i.e. add empty command
while I don't get target undefined, now make merges (2.1) and (3.1) and
resultant command becomes empty.
Bottom line, looks to me using % pattern matching as in (2.2) requires a
command. But providing empty (or any other) command causes merge with global
rule in-effective.
A rule which has no patten matching doesn't require a command to be present.
Any suggestions/pointers will be highly appreciated. I'm using 3.80 version of
GNU make.
Thanks
Praveen
- Question on patten matching and GNUmake,
Praveen Jain <=