![]() To use this makefile to create the executable file called mybuild, type: We will use the previous makefile as a sample. make removes (deletes) mybuild and all object files at make clean.įor more on library (static vs dynamic, dll), see Libraries.As it now has all up-to-date object files for the rule, it executes the command to build mybuild. make looks at the targets foo.obj and compiles these object files in a similar fashion. ![]() ![]() If not, it runs the command for main.obj by compiling main.cpp to get the object file. If no, as in the example, it checks if main.obj is up to date. ![]() make checks whether the prerequisites of main.obj have further dependencies.If yes, as in the example, it runs the rule for first prerequisite, that is, main.obj, to find its dependencies. make next checks if any of the two object files are listed as targets.make runs the rule for first target mybuild and figures its dependencies on main.obj and foo.obj.LIBPATH:$(LIBS) myLib.lib /NODEFAULTLIB:libcmt.lib Here is the example of nmake calling makefile.Ĭl /o myTest.exe main.obj foo.obj /link \ ![]() Without a target nmake will look for the first available target in the makefile and build it. We can run nmake without a target or we can specify a target such as nmake clean. While it may look like cl.exe is doing all the work, cl.exe does the compilingįor all the compile options we can use cl and for all the linker options we can use link. When we run nmake, it looks for makefile in the current directory. This nmake section assumes that we have Visual C 2008. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |