Make is a general purpose workflow program, usually used for compilation. But it can be used for anything.
When you do something like "make all", the make program executes a rule named "all" from a file in current directory named "Makefile". This rule usually calls the compiler to compile some source code into binaries.
When you do "make install", the make program takes the binaries from the previous step and copies them into some appropriate locations so that they can be accessed. Unlike on Windows, installation just requires copying some libraries and executables and there is no registry requirement as such. In short, "make install" just copies compiled files into appropriate locations.
Answer from sharjeel on Stack ExchangeMake is a general purpose workflow program, usually used for compilation. But it can be used for anything.
When you do something like "make all", the make program executes a rule named "all" from a file in current directory named "Makefile". This rule usually calls the compiler to compile some source code into binaries.
When you do "make install", the make program takes the binaries from the previous step and copies them into some appropriate locations so that they can be accessed. Unlike on Windows, installation just requires copying some libraries and executables and there is no registry requirement as such. In short, "make install" just copies compiled files into appropriate locations.
make install does whatever the Makefile author wants it to do. Typically, by this point, it is too late to change the install directory, as it is often known earlier, during the build, so help files and configuration files can be referenced with the correct pathnames.
Many projects use the GNU Autotools to try to improve their portability among hardware and operating system differences. (Different Unix variants use slightly different headers for declarations of functions that are slightly off the usual path -- except most programs need one or another of the ones declared in different locations.)
When a project does use the Autotools, the normal mantra to install it is:
./configure
make
make install
The ./configure typically allows you to use a command line option like --prefix /opt/apache or something similar to specify a different pathname. /usr/local/ is a common default prefix. It is far easier for locally built software to live in one place and distribution-provided software to live in the "main directories": /usr/ /bin/, and so on. (Packagers are very careful to never touch files in /usr/local/ -- they know it is exclusively for system administrators.)
Anyway, the ./configure --prefix /path/to/new/prefix will set a variable in the Makefile that is available when compiling the program, modifying the manual pages so they point to the correct locations for files, modifying configuration files, etc. So make will build the software specifically for the install location you want and make install will install it into that location.
Most programs can run even without the final make install step -- just ./program_name will often start them up. This is definitely a per-project thing -- some, like postfix, qmail, etc., are made up of many different moving pieces and rely on them all working together. Others, like ls or su might be self-contained enough to execute fine from the directory they were built in. (This is not often useful -- but sometimes very useful.)
However, not all projects use the Autotools -- they are huge, complicated, and miserable to maintain. Hand-written Makefiles are much simpler to write, and I personally think just distributing a simple Makefile with configuration variables available is a lot easier on developers and users both. (Though the ./configure ; make ; make install mantra is really easy on users when it works.)
makefile - How can I install and use "make" in Windows? - Stack Overflow
[Noob Question] What does make install really do.
command line - sudo make install - what is being installed? - Unix & Linux Stack Exchange
makefile - why "make" before "make install" - Stack Overflow
Videos
Run the command:
sudo apt-get install build-essential
Chances are you will need things like gcc to actually do the building so you might as well install those as well. The build-essential package will install other tools used along with make.
sudo apt-get update
sudo apt-get -y install make
(-y = answer 'yes' to any prompts)
Check the installed version:
make -v
make is a GNU command, so the only way you can get it on Windows is installing a Windows version like the one provided by GNUWin32. Anyway, there are several options for getting that:
Directly download from Make for Windows
Using Chocolatey. First, you need to install this package manager. Once installed, you simply need to install
make(you may need to run it in an elevated/administrator command prompt):choco install makeAnother recommended option is installing a Windows Subsystem for Linux (WSL or WSL 2), so you'll have a Linux distribution of your choice embedded in Windows 10, where you'll be able to install
make,gcc, and all the tools you need to build C programs.For older Windows versions (Microsoft Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, or Windows 7 with msvcrt.dll) you can use GnuWin32.
An outdated alternative was MinGW, but the project seems to be abandoned, so it's better to go for one of the previous choices.
GNU Make is available on Chocolatey.
Install Chocolatey from here.
Then,
choco install make.
Now you will be able to use Make on Windows. I've tried using it on MinGW, but it should work on CMD as well.
Hi !
I'm sorry for the noob question but I don't manage to find a proper makefile to understand what the install target does by myself.
But apparently, what I understood is that make builds the program executable and make install just moves the executable to the right location, right ?
So that means a software installation is basically just moving an executable to the right location in a computer ? 🤔
The commands that are executed by make install (or any invocation of make) are defined in the Makefile (and files included by the Makefile). For simple programs, you can just look for a line install: and see the commands in the lines below. But makefiles can also be quite complicated and scattered across various subdirectories. For details, see the manual for make, or an introduction to make.
As @Romeo Ninov wrote, you can also use the command make -n install so see what commands would be executed. Beware that for larger makefiles this output may not be accurate, and if you haven't built the program yet it will likely show you all the commands to build before showing the commands to install.
If no file arg ist passed to make , make looks for a file named Makefile in current dir. With the switch -f an alternative file can be passed to make. See man make for more information. By the way: make is one of these such good old Unix tools so try to get familiar with it ...
When you run make, you're instructing it to essentially follow a set of build steps for a particular target. When make is called with no parameters, it runs the first target, which usually simply compiles the project. make install maps to the install target, which usually does nothing more than copy binaries into their destinations.
Frequently, the install target depends upon the compilation target, so you can get the same results by just running make install. However, I can see at least one good reason to do them in separate steps: privilege separation.
Ordinarily, when you install your software, it goes into locations for which ordinary users do not have write access (like /usr/bin and /usr/local/bin). Often, then, you end up actually having to run make and then sudo make install, as the install step requires a privilege escalation. This is a "Good Thing™", because it allows your software to be compiled as a normal user (which actually makes a difference for some projects), limiting the scope of potential damage for a badly-behaving build procedure, and only obtains root privileges for the install step.
A lot of software these days will do the right thing with only make install.
In those that won't, the install target doesn't have a dependency on the compiled binaries.
So to play safe, most people use make && make install or a variation thereof just to be safe.
Witha tar.gz generally just decompress it to the folder you want it installed in such as /usr/bin or /usr/sbin, etc… However, in this case it looks like the linux version of putty is already in a repository so you should not be using a targz you would be better serves using the package manager in Debian apt. Using apt-get install, see for putty from repositories. How to Install PuTTY on Ubuntu Linux | Numato Lab Help Center
When installing software from the command line via tar I’ve never paid attention to what directory I’m doing it from…always did it from the “Downloads” directory…I’d like to know what is the appropriate procedure for installing software via the command line…I’d like to install puTTY, the terminal emulator, which I’ve downloaded and is currently in the “Downloads” directory as a .tar.gz file…should I install it from there, move it to /tmp, or some other directory more appropriate for doing installs?? Thanks…