.mak file for directory with source code in subdirectories

"earthwormgaz" <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization http://groups.google.com
Message-ID <[email protected]>
Hello group,

I have a set of directories, each with sub folders that contain source
code. For each of these I am trying to write a .mak file, and then have
each build from this and pull the resultant libs together at the end to
form a binary.

So, I have my list of sources ...

SRCS = \
  example/file.cpp
  different/example/file.cpp

I then have the following ...

OBJS := $(patsubst %.cpp, $(BLD)/%.o, $(SRCS))

$(BLD)/$(TRG) : $(OBJS)
	@$(DBG_AR)
	@$(AR) $(ARFLAGS) $(OBJS) $(ARFLAGS) -o $@

In the example I copied this from, the files were all in the same
subdirectory, and the author had used this trick ...

vpath %.cpp code/directory

Obviously I can't use this trick, and it chokes for me, I think that is
because of the directories difference.

Can anyone advise me on what to do here?

Cheers,

Gaz
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.