How to Incremental compilation in NDK? - compilation

I have many cpp files in my android.mk,every times I add a cpp to Android.mk,it compiles all cpp,it's a lot of wasting time,so I need a way to Incremental compile.

Related

What is the difference between .ilk and .iobj files?

I noticed that Visual Studio generates *.ilk files for debug builds and *.iobj files for release builds. As I understand, both of these file types are used as input for incremental linker. What is the difference between them? Can they be used together? How can I disable these files in project settings?
According to this answer, .iobj files are produced to support incremental link-time code generation (aka LTCG, and what used to be called, I believe, 'whole program optimization') and LTCG is normally only enabled for release builds.
One optimisation that LTCG can perform is inline a function from another compilation unit (i.e. source file). The compiler (of course) can't do this. There are no doubt others.
.ilk files, on the other hand, support incremental linking for debug builds, to get fast link times. This is not the same as incremental LTCG, where the linker tries to make use of cross-compilation-unit optimisations that it has done before, again to speed things up, but in a different way.
It follows that to suppress generation of .iobj files, turn off 'incremental link time code generation' for your project, and to suppress generation of .ilk files, turn off 'incremental linking'. I believe that both of these are linker options. But why bother? - they speed up development. Instead, I delete these files when I archive [a version of] my project.
Incremental linking is normally turned off for release builds, although I'm not sure why. Perhaps the two options are mutually incompatible, I've never tried enabling them both at once. Or maybe MS figured that we were fed up with them cluttering up our hard disks with build products, who knows?

How to not recompile all files when building Go package and changed just one file?

In C for instance, files that were not modified since the last build are not rebuilt because their .o file is there already.
Is there something similar in Go ? I waste a lot of time rebuilding everything when I just made modifications to one file.

Compiling specific files in a project in dev c++

I am writing a project on dev c++, that has a big number of files. However, the biggest part of them do not change every time I compile the code again, thus they do not have to be compiled again.
How can I compile only several files that I choose, and not the whole project?
Or is the compiler already doing it?
Will it help with compilation time?
*These are theoretical questions, I do not really mind waiting each time couple of seconds. It just got me interested.
Thanks
Compiling is a multistage process divided into two components: compilation and linking. Actully even if a program compiles fine it is not necessary that it work,because of the errors while linking. The total process of transformation from a source code to a object file can be termed as build.
Compilation refers to the processing of source code files (.c, .cc, or .cpp) and the creation of an 'object' file. The compiler merely produces the machine language instructions that correspond to the source code file that was compiled.This step doesn't create anything the user can actually run.
Linking refers to the creation of a single executable file from multiple object files. In this step, it is common that the linker will complain about undefined functions (commonly, main itself). So while compilation if the function is not defined in the current file ,it assumes that the function is declared somewhere else and the linker links the functions which is defined in other files
The compiler does its thing, and the linker does its thing -- by keeping the functions separate, the complexity of the program is reduced.The main advantage is that this allows the creation of large programs without having to redo the compilation step every time a file is changed. Instead, using so called "conditional compilation", it is necessary to compile only those source files that have changed; for the rest, the object files are sufficient input for the linker. Finally, this makes it simple to implement libraries of pre-compiled code:
If you're using an IDE this will be taken care for you defaultly and for command line tools, there's a nifty utility called make.

Stop XCode from embedding build time in executables

XCode4 is putting build time in executables it creates. When I build the same code twice, binaries will differ by few bytes belonging to a unix timestmap.
Is there a way to prevent this from happening?
(I'm running expensive tests and benchmarks after each build and cache results based on hash of executables, but ever-changing executables broke my cache and pollute benchmark results with duplicates).
I've worked around this by switching to building project myself "old skool" way with Makefiles & gcc.

How to compile resource files conditionally in Xcode?

I have many image/video files should be included as resource. Their size overs 30MB. So it takes to much time when I compile them. This slows down my development speed.
So I'm finding a way to compile those some resource files conditionally. Like #ifdef directive in source code.
It's good if it can be specified in source code file. Any recommended method?
First, in your Target, move the "Copy Bundle Resources" step after the Compile and Link steps. I have never quite figured out why Apple wants to copy the resources first, but it's a major slow-down on development because you wind up copying resources even when there are compile errors.
Next, to actually run the program with only certain resources, you'll need to make two targets. In your lightweight target, just don't copy the resources you don't want. Unfortunately there's no easy way to keep the two targets in sync if you make changes to the build, but using xcconfig files will generally keep it pretty easy.

Resources