help-make
[Top][All Lists]
Advanced

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

Re: "targetted" pattern rules


From: Greg Chicares
Subject: Re: "targetted" pattern rules
Date: Sat, 18 Feb 2006 16:54:34 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

On 2006-2-17 16:44 UTC, Helge Avlesen wrote:
> 
> OBJS1=\
> dir1/file1.o \
> dir2/file2.o \
> ...
> OBJS2=\
> dir1/file3.o \
> dir2/file4.o \
[...]
> now, what I want is to create pattern rules, that will compile the
> OBJS1 group with one set of flags and OBJS2 with another
[...]
> $(OBJS1) : %.o : %.F90 ; $(F95) -c $(PFREEFLAGS1)  -o $@ $<
> $(OBJS1) : %.o : %.F   ; $(F95) -c $(PFIXEDFLAGS1) -o $@ $<
> $(OBJS1) : %.o : %.f90 ; $(F95) -c $(FREEFLAGS1)   -o $@ $<
> $(OBJS1) : %.o : %.f   ; $(F95) -c $(FIXEDFLAGS1)  -o $@ $<
> $(OBJS1) : %.o : %.c   ; $(CC)  -c $(CFLAGS1)      -o $@ $<

For all files in $(OBJS1), all these static pattern rules apply,
not just the one rule you want. I'd use target-specific variable
values:

$(OBJS1): CFLAGS   := CFLAGS1
$(OBJS1): CXXFLAGS := CXXFLAGS1

$(OBJS2): CFLAGS   := CFLAGS2
$(OBJS2): CXXFLAGS := CXXFLAGS2

%.o: %.c
        $(CC) -c $(CFLAGS) $< -o$@

%.o: %.cpp
        $(CXX) -c $(CXXFLAGS) $< -o$@




reply via email to

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