This page was last updated on March 13th, 2020(UTC) and it is currently May 31st, 2020(UTC).
That means this page is 78 days, 19 hours, 22 minutes and 33 seconds old. Please keep that in mind.

25 - MAKE The last program you'll want to learn before we really get started is "make". I'm not going to cover makefiles themselves on this particular page, but the command line options. The long story short is, make is used for writing small scripts that can compile your code in different ways. Most commands and scripting options are merely actual CLI programs unrelated to make.

First is "-B", which you'll slowly come to find as important. The main purpose of makefiles over, say, a batch or script is to let make automatically decide whether or not to recompile a file. If you have 20+ file each with thousands of lines of code, and if you're also applying optimization flags, you're going to be spending alot of time waiting for the compiler to get done, which is especially annoying for small changes. "-B" basically overrides it's automatic detection, because sometimes it fails to see changes for whatever reason (varies per OS).

Next is "--debug=b" or "--debug=v" which make it tell you about which files it's updating and not updating. Most cases "b [basic]" is fine, and "v [verbose]" is only necessary for special situations. You'll want it when you're suspecting files aren't updating to make sure you need to use "-B" before actually doing so.

And then we have "-e" which allows us to add information to the makefile when we're using the makefile. Your makefile will ultimately have to be written to make no assumption that the person using your makefile (if you distribute your code, and this could include yourself 5 months down the line) will know what extra options to pass, though. Could be useful for adding some extra things during the development process, rather than for the end product.

"-j" followed by a number (separated by a space) is useful just about everywhere other than DOS (so keep this in mind), because it will allow multi-threaded execution of the makefile. The number is the number of threads (distributed instances of make) you want to use. You'll want to set this to the number of "cores" or processors you have. This is not a mandatory option, but it's particularly useful when compiling a large project for the first time (usually someone else's since you might have alot of .o files left over from yours).

"--assume-new=[filename here]" is like "-B", except it only applies to one specific file that is named. Generally, you also pass a "target" as an argument as well. For example "make run" to make the program and run it or "make clean" to get rid of the .o files and the program itself. I'll go over this more later.

Get your own web kitty here!
┬ęCopyright 2010-2020. All rights reserved.