Click to See Complete Forum and Search --> : makefile question: source code path


ZenBeam
September 8th, 2008, 11:04 AM
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 (http://www.opussoftware.com/tutorial/TutAdvanced.htm#Search%20Directories) 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 or 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 (http://msdn.microsoft.com/en-us/library/y2be734c.aspx), 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 other 32 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.


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)


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.