Okay. We've been compiling programs.
We've been talking about make and how it's useful for
building larger programs and tracking their dependencies and changes and so forth.
And I'm going to show you a little bit of compiling with a makefile and so forth.
So, at the moment, I have here a handful of files and a handful of header files,
a handful of C files, a handful of header files and a makefile.
And this isn't a super big project but we want a small example.
So right now if I type make,
we'll delve into the makefile in a second.
It's going to compile all of these things and create
my program which doesn't really do anything super interesting, just computes it.
Now, if I were to open up a file1.c and make a change in here,
let's say that I realized that this really should be plus one from
some testing and debugging that I've been doing or something like that,
and then I go to compile again and I do make,
you'll notice that this time it only recompiled
file1.c to an object file and then we'll link to the program.
This is really nice because it didn't recompile these things.
These are all pretty small files so they compiled quickly,
but in a real big project it might take a while.
Okay. And in fact,
now that we're dealing with things in Emacs,
we may as well not even go back to the command line.
We can just compile an Emac.
So if I hit control C control V,
you'll see at the bottom it says compile command and it says make-k.
So when I hit enter,
it actually runs make - k just says keep going.
If you run into errors, try and make as many things as you can.
So you can see as many errors at once.
You don't have to use it. It's a default.
It finished with no problems.
If I already have a syntax error,
let's say I leave off that semi-colon and I compile,
it's going to display my errors in Emacs.
And in fact, lets make it so that we have a couple errors in here.
Now if I go to these errors,
it will jump to wherever in the code that error is coming from.
So this is on that line.
This error message is coming from the makefile as this time it failed to make that thing.
This is on that line of code. So this works really nice there.
We can just stay in Emacs,
move around and see our errors.
In your readings, you'll learn about the details of how to make a makefile,
starting with a very simple makefile and building up to sort of a
nice feature for makefile that's flexible and lets you add more and more files.
But this is how we can use those in this environment.
We just create a file called makefile with
whatever we need in there and then we go from there.