makefile question: source code path (need Guru fast)

I’m trying to set up a makefile to, when compiling each source file, look through three directories in order, and compile the first version it finds. The .PATH.c macro shown here is an example of what I want to do, but that syntax is for Opus make, and doesn’t work for me. I’m using nmake (I think the Microsoft nmake, not the ATT/Lucent nmake). Is there a way to do this in regular make, or my version of nmake? I’ve tried to google the answer, but between the different versions of nmake, and the indecipherable Microsoft MSDN reference site, I’m stumped.

I’ll put the more complete backstory below, in case it helps:

I’m compiling a code using the Intel Fortran compiler, which works with the Microsoft Visual C++ .net (2003) IDE. I have the code compiling in the IDE for 32 bit windows, with the directory structure similar to below.



C:\maindir\common
 source001.for
 source002.for
 ...
 source100.for
c:\maindir
 source012.for
 source093.for
 source101.for
 source102.for
 ...
 source150.for
 include1.inc
 include2.inc
 include3.inc
c:\maindir\common\release
 (The common 32 bit .obj files go here)
c:\maindir\release
 (All the other32 bit .obj files and the 32 bit executable go here)


I need to also compile the code for 64 bit windows, where there are only a few differences. So I’d like to make the directory shown below with just the makefile and the different code, and have the directories searched in the order c:\maindir\64bit, c:\maindir, c:\maindir\common, with the first match found used. There are only three include files, so I can handle them by hand if I need to, but there are a lot of source code files.

Currently, I’m just copying all the source code to a separate directory, and I have a makefile working there, but I have to be careful to not overwrite the 64 bit-only source files with changed 32 bit source files.



c:\maindir\64bit
 makefile
 source012.for
 source102.for
 source111.for
 include2.inc
 (Preferably, *all* the 64 bit .obj files end up here, or in a subdirectory)


I’m going to use my one bump, but I suspect it’s futile. I’ve also posted this at CodeGuru, also with no reply yet, and at the Intel Fortran Forum with some replies, but no solution.

Come on guys, this is your chance to show them all up!

It seems to me that you’re going about this in the wrong way. You probably want separate directories for 32-bit-specific things and 64-bit-specific things. Then when you build the 32-bit app, build with the 32-bit directory and when you build the 64-bit app, build against the 64-bit directory.