quantum wrote:the following question came to my mind: An Engine developer wants his costumers around the world to compile his sources on their own machine in order to gain some speed. But he also wants to keep his sources secret because he wants to gain some bucks.
I wonder if there is a way to accomplish both aims?
It depends on the level of security you want. You cannot make it impossible for the client to discover the secrets of your code, but you can make it harder.
The most straightforward way is to run the code through a code obfuscator. That will make it somewhat hard for the client to make sense out of it.
Another way would be to encrypt the source and to let the compiler decrypt it (assuming you are able to modify the compiler). However, this would be relatively easy to hack. This should probably be combined with code obfuscation (before encryption).
Yet another possibility would be to not provide the actual source code, but only a form of intermediate code. Whether this is possible depends on the level of control you have over the compiler.
It's probably safer to keep the source on the developer's machine and compile it differently for each client. There is no absolute need to compile it on the client's machine, it is sufficient to know the specs of the client's system and let a (cross-)compiler compile the code specifically for that client.
If it's a product aimed at a mass market, just compile it for a fixed set of architectures and add a script that runs the version best matching the client's specs.