help-make
[Top][All Lists]
Advanced

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

Problem with pattern rules


From: DrDavey
Subject: Problem with pattern rules
Date: Wed, 21 Mar 2012 09:09:20 -0700 (PDT)

I was hoping someone could point out what I'm doing wrong in the first three
pattern rules below.  Note these rules have no recipes.  I'm using GNU Make
3.80.  I've attached the Makefile.  Thanks for any help.

TARGETS = x y z

.PHONY: $(TARGETS)\
            $(patsubst %,%_all,$(TARGETS)) \
            $(patsubst %,%_rel,$(TARGETS)) \
            $(patsubst %,%_deb,$(TARGETS)) \
            $(patsubst %,%_clean,$(TARGETS)) \
            $(patsubst %,%_clean_rel,$(TARGETS)) \
            $(patsubst %,%_clean_deb,$(TARGETS))

# I want x dependent on x_rel and x_deb and so on for y and z.
# This is not working
$(TARGETS): $(patsubst %,%_rel,$@) $(patsubst %,%_deb,$@)

# I want x_all dependent on x and so on for y and z.
# This is not working
$(patsubst %,%_all,$(TARGETS)): $(patsubst %_all,%,$@)

# I want x_clean dependent on x_clean_rel and x_clean_deb  and so on for y
and z.
# This is not working
$(patsubst %,%_clean,$(TARGETS)): $(patsubst %,%_rel,$@) $(patsubst
%,%_deb,$@)

# Pattern rules below are working and use sub-make files to provide recipes
for
# x_rel, x_deb, x_clean_rel, x_clean_deb and so on for y and z.

# Rules for <target>_rel targets
# The sub-make file must define the rel target
$(patsubst %,%_rel,$(TARGETS)): filename = $(patsubst
%_rel,makefile_%.mak,$@)
$(patsubst %,%_rel,$(TARGETS)):
        echo $(MAKE) -f $(filename) -j $(MAX_THREADS) -C common/build rel

# Rules for <target>_deb targets
# The sub-make file must define the deb target
$(patsubst %,%_deb,$(TARGETS)): filename = $(patsubst
%_deb,makefile_%.mak,$@)
$(patsubst %,%_deb,$(TARGETS)):
        echo $(MAKE) -f $(filename) -j $(MAX_THREADS) -C common/build deb

# Rules for <target>_clean_rel targets
# The sub-make file must define the clean_rel target
$(patsubst %,%_clean_rel,$(TARGETS)): filename = $(patsubst
%_clean_rel,makefile_%.mak,$@)
$(patsubst %,%_clean_rel,$(TARGETS)):
        echo $(MAKE) -f $(filename) -C common/build clean_rel

# Rules for <target>_clean_deb targets
# The sub-make file must define the clean_deb target
$(patsubst %,%_clean_deb,$(TARGETS)): filename = $(patsubst
%_clean_deb,makefile_%.mak,$@)
$(patsubst %,%_clean_deb,$(TARGETS)):
        echo $(MAKE) -f $(filename) -C common/build clean_deb


Here's what I'm getting when I use this make file
>make x
make: Nothing to be done for `x'.
>make x_all
make: Nothing to be done for `x_all'.
>make x_clean
make: Nothing to be done for `x_clean'.
http://old.nabble.com/file/p33544584/Makefile Makefile 
-- 
View this message in context: 
http://old.nabble.com/Problem-with-pattern-rules-tp33544584p33544584.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.




reply via email to

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