help-make
[Top][All Lists]
Advanced

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

target-specific object files


From: Ted Stern
Subject: target-specific object files
Date: Fri, 13 Nov 2015 13:29:58 -0800

Hello Paul et al.,

I'm familiar with target-specific variables and have been using them for
many years.

But they don't seem to be doing what I want in one circumstance -- I want
to build different target names depending on an inherited target-specific
variable.

For example

EXESUFF =#   blank to start

a$(EXESUFF).o : a.cpp
<tab> $(CXX) $(CXXFLAGS) -c $< -o $@

OBJS = a$(EXESUFF).o

b$(EXESUFF).out : $(OBJS)
<tab> $(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@

all:   b.out

clean:
<tab> /bin/rm *.o *.out

test:   EXESUFF = _test
test:   CXXFLAGS += -D__TEST__

% make all

(builds a.o and b.out)

% make clean; make test

(builds a.o and b.out -- but I want it to build a_test.o and b_test.out)

Is there a way to do what I want?

Thanks,

Ted


reply via email to

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