Using nmake, is it possible to have the makefile build all the .cpp files in the current directory automatically, without having to specify them individually?
So, instea
You can use a rule like this:
{src\mystuff}.c{tmp\src\mystuff}.obj::
$(CC) /nologo $(CFLAGS) /c /Fotmp\src\mystuff\ $<
which will find and compile all the .c
files in src\mystuff
and put the object files in tmp\src\mystuff
. Substitute .cpp
for .c
in your case.
Note that the first character on the second line should be a tab, not spaces.
Also, $(CC)
is predefined by nmake to be cl
, and you can add any compiler flags you need to $(CFLAGS)
, hard-code them in the rule or add a different variable there, as you prefer.