15.3.4 Modifying the Makefile

To compile the new C-language source files separately, you must refer to each source file in the makefile. Since this application is a medium-model application, use the /AM option when compiling. For clarity, you should also name each segment by using the /NT option.

You will also need to change the link command line so that it refers to the medium-model library MLIBCEW.LIB rather than the small-model library SLIBCEW.LIB.

The makefile for the Memory application should look like this:

memory.res: memory.rc memory.h
    rc /r memory.rc

memory1.obj: memory1.c memory.h
    cl /c /AM /Gsw /Zp /NT MEMORY_MAIN memory1.c

memory2.obj: memory2.c memory.h
    cl /c /AM /Gsw /Zp /NT MEMORY_INIT memory2.c

memory3.obj: memory3.c memory.h
    cl /c /AM /Gsw /Zp /NT MEMORY_WNDPROC memory3.c

memory4.obj: memory4.c memory.h
    cl /c /AM /Gsw /Zp /NT MEMORY_ABOUT memory4.c

memory.exe: memory1.obj memory2.obj memory3.obj memory4.obj \
    memory.def
    link memory1 memory2 memory3 memory4,memory.exe,,mlibcew \
    libw,memory.def
    rc memory.res

memory.exe: memory.res
    rc memory.res