How can we modify a Makefile script to handle more new pairs of source files indicated by its extension name to be compiled by Make automatically correctly and preferably interactively

objects = a.o  b.o c.o d.o e.o f.o main.o h.o i.o

Binary : $(objects)
     g++ -o Binary $(objects)

now as below, after the first line ie. original pair, source files should be added such but only one pair replace the previous pair, and the next pair replace the current and so on, with the original pair as the starting point

e.cpp     and i.cpp,
e.aaa.cpp and i.aaa.cpp,
e.bbb.cpp and i.bbb.cpp,
e.ccc.cpp and i.ccc.cpp 

So we can have Make to produce 4 binaries from those module that is original Makefile script added with 3 pairs of source files while all the rest held still constant


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.