Skip to main content
Share Your Experience: Take the 2024 Developer Survey
59 votes

How to run make file from any directory?

You could use make -C dir to change to directory dir before reading the pointed makefile. Please notice that option -C is capitalized.
Jonathan's user avatar
  • 691
47 votes

Compiling C files on Ubuntu and using the executable on Windows

The standard compiler toolchain on Ubuntu will produce Linux executables, not Windows executables. It is possible to install a cross-compiler that will produce Windows executables - this Stack ...
john_e's user avatar
  • 656
25 votes

Variables in GNU Make recipes, is that possible?

Thanks to This is the solution to change a variable in a recipe: recipe: $(eval variablename=whatever)
user3645902's user avatar
16 votes

Keep color in less after make and pipe

The simplest solution is: unbuffer make |& less -r This is based on the answer to Preserve colors while piping to tee I had to "sudo apt-get install expect" to get the unbuffer command ...
Digicrat's user avatar
  • 261
12 votes

Compiling C files on Ubuntu and using the executable on Windows

This is called cross-compiling. You need a "toolchain" (compiler, linker, etc.) that will generate the appropriate code and format, involving: The target processor architecture. In your case is is ...
jcaron's user avatar
  • 1,873
11 votes

Using make from Windows PowerShell

2021 - March Windows 10 Enterprise 64Bit Successful Approach Despite looking old, the gnuwin install for "make" works fine reflecting stability and backward support in Linux and Windows. I ...
user2048773's user avatar
11 votes

How to escape "$@" in a makefile?

Figured out how to escape it - needed a backslash: "\$$@"
xomm's user avatar
  • 321
8 votes

Make install into a temporary directory?

The answer to this question depends on which open source project you're attempting to install this way. The general answer is that some open source projects have Makefiles which provide optional ...
Eirik Fuller's user avatar
5 votes

Using make from Windows PowerShell

** 2022 update ** With the package manager Chocolatey, run choco install make. To verify that you now have make, run make --version. To install Chocolatey, run: Set-ExecutionPolicy Bypass -Scope ...
Little Helper's user avatar
5 votes

Variables in GNU Make recipes, is that possible?

taking what @user3645902 mentioned, here is the solution to the main question: recipe: @$(eval REV=`svn info $<|grep 'Last Changed Rev'|cut -f4 -d`) @echo $(REV)
vimdude's user avatar
  • 247
5 votes

Where does "make install" put the files?

"make -n install" will do a dry run of the install process and tell you where things will be installed to.
ztalbot's user avatar
  • 61
5 votes

make: mk-build-deps: commande not found

The mk-build-deps command is a part of devscripts package , to install it run: sudo apt-get install devscripts
GAD3R's user avatar
  • 3,780
4 votes

What is the difference between `make clean` and `make distclean`?

Why the libvpx step uses make clean instead of make distclean At the time of writing the guide libvpx had no rule in its Makefile for the target distclean, so clean was used instead. Why make (dist)...
llogan's user avatar
  • 60.1k
4 votes

python3.2 - ERROR:root:code for hash md5 was not found

Your problem is that you're using OpenSSL 1.1 and an old version of Python that doesn't support that version of OpenSSL. Python 3.2 was released in 2011 and OpenSSL 1.1.0 was released in 2016. Since ...
bk2204's user avatar
  • 2,626
3 votes

Jenkins Docker image has no make or sudo

you can run this command, get bash in your container and then install whatever you want: docker exec -it -u root jenkins bash otherwise you can configure it into your dockerfile
mijhael3000's user avatar
3 votes

How to check if make uninstall will work

Yes it is... In the Makefile there are different sections. You can enumerate them by pressing tab after you write make (but before you press enter ;-)). Search the one with uninstall and check if it ...
Hastur's user avatar
  • 19k
3 votes

Where does "make install" put the files?

Further to Matteo's answer, you can examine the Makefile to see where a particular program is going to install. Using GNU Hello as an example: /usr/local/src/hello-2.10 $ cat Makefile | grep prefix .....
crossroadsman's user avatar
3 votes

Where do I find nmake for Windows 7 x64

Nmake doesn't come natively in Windows 10, but you could include it without installing the complete Visual Studio by installing Microsoft Visual C++ Build Tools. when complete, navigate to this ...
osazemeu's user avatar
3 votes

Linux From Scratch

The use of a Makefile makes life easier for both the developer and the end user. Basically, it is a cheat sheet of how to build a particular piece of software. For a simple "Hello world" a g++ hw....
ivanivan's user avatar
  • 2,952
3 votes

Cannot use `time` keyword in Makefile rule action

Having sh symlinked to bash does not mean that invoking sh will be equivalent to invoking bash. This is what Archwiki says: When Bash, mksh and zsh are invoked with the sh name, they automatically ...
curusarn's user avatar
  • 482
3 votes

Add all firmware to CONFIG_EXTRA_FIRMWARE?

Compiling and booting into an "intermediate" kernel with include/uapi/linux/binfmts.h:MAX_ARG_STRLEN set to (PAGE_SIZE * 128) let an "all firmware" build of kernel 5.17.4 (plus ...
genpfault's user avatar
  • 546
3 votes

Stuck on "checking the maximum length of command line arguments..." when running make on MSYS2

My workaround was that I identified with Process Explorer (Former SysInternals tools) the checking sh.exe and killed it. The compilation (or configure) process continued. I've read that this is a bug ...
Freelancer's user avatar
3 votes

Variables not being set in Makefile

You need to remember that the "makefile" part of make, is separate from the "shell" part. Once you're inside the recipe for the makefile it's all shell commands. That means you ...
maxprehl's user avatar
2 votes

What is the character used to indent the Make file rule recipe?

In light of the accepted answer: recipes must be preceded by a tab character, which is automatically replaced if set expandtab is enabled in your .vimrc. Overwriting your .RECIPEPREFIX is not ...
Louis's user avatar
  • 31
2 votes

How to run make file from any directory?

This is an old question but I like to use a ~/.bashrc alias, which looks like this: alias makeaway="cd /dir/to/make && make && cd -"
user1148325's user avatar
2 votes

Using make from Windows PowerShell

As this is the first result I get on Bing when I search for "PowerShell make", I'm creating this answer to note that the official GNU page and the mirrors have Make for Windows source as ...
coocooman3's user avatar
2 votes

Using make from Windows PowerShell

Install Make for Windows from GNU Make and add C:\Program Files (x86)\GnuWin32\bin to your Path Path Ubication Edit Path
Víctor Alejandro Sagal Muñoz's user avatar
2 votes

Installing lapacke using make on Mac

I'm not quit sure where you got that lapacke* package. the latest version of netlib lapack comes with lapacke inside. to get it installed/compiled: download the latest lapack from netlib website (you ...
Foad's user avatar
  • 662
2 votes

Makefile issues with interactive shells started as a target

Found it. Was nothing regarding bash, but the old gnu make version that ships with os x - which seems to have problems piping an interactive shell. brew install homebrew/dupes/make and using gmake ...
DrSlow's user avatar
  • 51

Only top scored, non community-wiki answers of a minimum length are eligible