Can I have a question to everybody?
Bcz I haven't understand so far.
Can you compile a program with many different ways?
If not , waht is the reason of compliling?
This thread seems to be veering wildly away from the original topic, but in answer to your questions:
In a more general sense - the point of compiling is to convert a programs source code from a human readable format (e.g. C, or C++ etc), to machine-code instructions that the computer can understand and execute.
re:
Can you compile with many different ways?
I'm not sure exactly what you mean here, but assuming you mean something like:
"Are there different ways to compile programs?"
or
"Can a program be compiled using a different compiler, or a different build-system?"
That would depend on a number of different factors:
- The project in question,
- It's complexity,
- How its build system is set up by the developers,
- How many options the build system affords the user,
- The compilers that are supported
- The different architectures it targets
etc. etc.
Many free-software projects are set up to
only use the GNU build system (autotools and make). Likewise, there are some that
only support cmake, or qmake, or boost::jam, or apache ant.
Some projects even have their build system set up to support cross-compilation (where you can do things like build a Windows executable, or an ARM executable for your raspberry pi from your Linux environment)
Over the years I have also seen one or two cross-platform projects that provide support for several different build-systems (GNU make, CMake etc)
AND several different compilers
AND provide projects/solutions for several IDE's like Codeblocks, eclipse, xcode, Borland/embarcadero and Visual Studio - so that people who prefer working in an IDE can build the program too. Which offers a lot of flexibility and allows users to be able to build the software using their preferred method.
But supporting multiple build-systems is a huge maintenence burden for developers. So many software projects only choose one cross-platform build-system and anybody who wants to build the program themselves just has to download the relevant software to do so.
Also, sometimes developers will set-up the build system to provide optional program features that you can enable or disable at compile time. This is often done by passing parameters to the build scripts, or adding/changing settings in some of the configuration scripts.
If you disable/exclude features at compile time, then those pieces of functionality will not be available in the final executable. In order to re-enable them, you would have to enable them in the configuration scripts and then re-build the program again.
The Linux kernel is a prime example of this. The Linux kernel has a LOT of optional modules and features that can be enabled/disabled at compile time.
Generally speaking - by default - All distros usually enable a LOT of modules and features in order for their kernel to run on a wide range of motherboards, with different wireless cards, or other components. But some people like to tinker with the kernel on their PC's and build their own custom version to tune it to their specific hardware - removing all unnecessary modules and features. Or to remove conflicts, or to add support for newer hardware that is not supported in their installed distros current kernel.
Going back to the idea of different ways of compiling a program - to summarize - it ultimately depends on how the developers have set up their build-system. Some projects can be compiled in a number of different ways, others can only be compiled one way!
What I can find in wed says more or less the same things.
Download the source code, extract it, run "./configuration", run "make" and program is ready for use.
Where is your personal touch in all this?
As previously mentioned, GNU make (and the rest of autotools) is just one build-system and it is used by a lot of free software projects. But there are also a lot of projects that use other build-systems like cmake or boosts 'jam', or qmake (QT's build system), or apache ant etc..
BTW: Another time when you might want to compile and build a program yourself:
On very rare occasions, you might install a software package from your distro that has a particular feature disabled and you may find that you need to manually build and install the program yourself to re-enable that functionality.
Generally speaking, the package maintainers for most distros build their packages with most of the optional, compile-time features enabled. But sometimes certain optional parts are disabled.
(perhaps it has an optional feature that is deprecated, considered obsolete, or introduces a potential security hole)
If you
need to be able to use that disabled functionality, you won't be able to access it using the version you installed from your package manager. In which case, manually building and installing is your only option.
This situation only ever happened to me once - many years ago. I forget exactly which package it was - it was a long time ago. I was running Ubuntu on one of my ancient laptops and there was a program that had a feature I needed to be able to use. But it was unavailable because the version in the repo had been built with that functionality disabled. So I had to manually build and install from source to re-enable the required functionality.
For the life of me, I can't remember what package it was! But I do remember that it took a lot of research to find out why the functionality was unavailable and to work out what I needed to do to fix the issue!
Again, it's an extremely rare event - it's only happened to me once in all the years I've been using Linux. But it is something that could happen again in the future!