After making changes to an Arduino source file, how do I recompile on my PC?

I made a change to hardwareSerial.cpp. How do I recompile the Arduino source code and use with my sketch? Thanks!

You should be able to just compile as usual. I know there is some caching of the core libraries so it's possible that you could run into a situation where that file is not recompiled. I'd hope there is a check to see if any modifications have been made but I haven't tested this lately and I know they've done some work on that recently. I know the caching is redone when you switch boards but I think that was recently changed so it only happens when necessary (e.g. when switching cores), I believe that has not been released yet though.

A trick I like to use to check if a file is being compiled is to temporarily add an #error (or #warning if you want the compilation to proceed). Then you know for sure.

jumping on what pert said, just change boards, compile, change boards back and re-compile.

Here's some evidence for the core getting recompiled if any files have been altered since it was cached:

Isn't it nice to be programming at a time that this is an option? Is was not too long ago that compiling that many lines of source would take all night.

Yeah, but if you compare the compilation speed of Arduino IDE 1.8.4 to 1.6.5 it's significantly slower. They've been doing some work on this to avoid unnecessarily recompiling files and it's gotten better since the releases closer to 1.6.6 when the preprocessing system was completely redone. There are definitely other improvements that somewhat make up for the slowness but it always startles me when I go back to an old IDE version to do some backwards compatibility checking. I'm sitting there waiting for the compilation and then finally realize that it finished almost instantly. I think it might be OS dependent also, like Windows is slower than Linux if I remember correctly.