Search code examples
cvisual-studiocompilationgnu-makeobject-files

Compiling all .c files in .obj files using GNU make and Microsoft Visual Studio compiler


can anyone tell me what is wrong with this code:

CC = "C:\Program Files\Microsoft Visual Studio\VC98\Bin\CL.EXE"
CFLAGS = /nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(OBJ_PATH)\$(EXECUTABLE).pch" /YX /Fo"$(OBJ_PATH)\\" /Fd"$(OBJ_PATH)\\" /FD /GZ /c

$(OBJ_PATH)\%.obj : $(SOURCE_PATH)\%.c
    $(CC) $(CFLAGS) $<

it does not seem to recognize this rule as connecting the .obj to the .c


Solution

  • The backslashes are interpreted as escapes by GNU make and disable the special meaning of %. Try doubling the backslashes or replacing them by forward slashes.