[comp.windows.ms.programmer] Save time compiling-here's how!

dave@wucs1.wustl.edu (David T Mitchell III) (03/06/91)

Keywords: 

Here's something that might save you some time.  You're probably linking more
than necessary if you are using a standard make file.

Here's a standard make file setup, similar to the ones generated by MS's PWB,
Borland C++, and even found in Petzold:

	myprog.exe: a1.obj a2.obj myprog.def myprog.res
		link {blah, blah}
		rc myprog.res

Very often you just change the resource file (after modifying a dialog
template, menu, etc) and want to recompile.  The problem is that changing
the resource file causes the object files to be UNNECESSARILY re-linked.
That takes time, especially if you've got a bunch of them.

SOLUTION:

Change your makefile to split the task of linking and resource compiling.

	myprog.XXX: myprog.exe myprog.res
		rc myprog.res
		echo xxx > myprog.XXX

	myprog.exe: a1.obj a2.obj myprog.def
		link {blah, blah--exactly the same as above}
		

Now, just make myprog.XXX instead of myprog.EXE.  This works by creating a
dummy file (myprog.xxx) to corrospond with the step of resource compiling;
the .exe file is only relinked when it changes.


p:S.  A more elegant solution would probably be to use the resource
compiler's -FE switch (rename .exe file, SDK Tools FManual, p3-6), but I
haven't been able to get the damn thing to work.


dave	dave@wucs1.wustl.edu
	the mira corporation
	314/434-4343