Questions tagged [makefile]

A makefile is an input file for the build control language/tool make. It specifies targets and dependencies along with associated commands to perform (a.k.a. recipes) to update the targets.

A makefile is usually an input file for the build control language/tool make. The make utility and the corresponding makefile format is standardized by POSIX.

Common newbie mistakes:

Makefile variable assignment error in echo - running two distinct commands in a recipe and not realizing the shell from the first will exit and lose any changes to the environment.

Make implementations

More information

25125 questions
86
votes
2 answers

"fatal error: bits/libc-header-start.h: No such file or directory" while compiling HTK

I'm getting the following issue when trying to run make on the HTK library: (cd HTKLib && make HTKLib.a) \ || case "" in *k*) fail=yes;; *) exit 1;; esac; make[1]: Entering directory '/home/william/speech/htk/HTK-3.4.1/htk/HTKLib' gcc -m32 -ansi…
William
  • 1,154
  • 1
  • 9
  • 15
83
votes
2 answers

Makefile : contains string

A variable returns MINGW32_NT-5.1 or CYGWIN_NT-5.1. (yea, dot at the end) Need to compare that given var contains NT-5.1 positioned anywhere. Using cygwin and would like to be compatible with pretty much any *nix.
Pablo
  • 28,133
  • 34
  • 125
  • 215
83
votes
2 answers

what is .d file after building with make

Sometimes, I find .d files for a given source file. For instance, if I compile test.c, I've got test.d, test.o I understand that test.o is the object file but have no idea what is test.d for. Could you give any hints or pointers?
jaeyong
  • 8,951
  • 14
  • 50
  • 63
82
votes
9 answers

How to place object files in separate subdirectory

I'm having trouble with trying to use make to place object files in a separate subdirectory, probably a very basic technique. I have tried to use the information in this…
RussellG
  • 1,075
  • 1
  • 9
  • 9
82
votes
11 answers

How to use virtualenv in makefile

I want to perform several operations while working on a specified virtualenv. For example command make install would be equivalent to source path/to/virtualenv/bin/activate pip install -r requirements.txt Is it possible?
dev9
  • 2,202
  • 4
  • 20
  • 29
82
votes
7 answers

Debugging GNU make

Is there a command line way in make to find out which of the prerequisites of a target is not updated?
mithuna
  • 1,011
  • 1
  • 9
  • 9
81
votes
9 answers

Cygwin Make bash command not found

I installed cygwin with all the packages on windows 7 64 bit. For some reason the make command is giving me an error: bash make: command not found. I checked and in my bin folder, there is no make.exe. Can anyone help me on this? I really need make…
user593301
  • 903
  • 1
  • 8
  • 12
80
votes
3 answers

How to force an error in a gnumake file

I want to detect a condition in my makefile where a tool is the wrong version and force the make to fail with an error message indicating the item is not the right version. Can anyone give an example of doing this? I tried the following but it is…
WilliamKF
  • 41,123
  • 68
  • 193
  • 295
79
votes
3 answers

How do I make Makefile to recompile only changed files?

I have been struggling a bit to get make to compile only the files that have been edited. However I didn't have much success and all the files get recompiled. Can someone explain me why? My files are: main.c a_functions.c where main.c includes…
Pithikos
  • 18,827
  • 15
  • 113
  • 136
79
votes
5 answers

Why am I warned that the "CMAKE_TOOLCHAIN_FILE" variable is not used by the project?

When I build some third-party code, I am seeing the following warning from CMake: CMake Warning: Manually-specified variables were not used by the project: CMAKE_TOOLCHAIN_FILE What is causing this warning? I checked the configuration files,…
pleerock
  • 18,322
  • 16
  • 103
  • 128
78
votes
6 answers

Sources from subdirectories in Makefile

I have a C++ library built using a Makefile. Until recently, all the sources were in a single directory, and the Makefile did something like this SOURCES = $(wildcard *.cpp) which worked fine. Now I've added some sources that are in a subdirectory,…
ggambetta
  • 3,312
  • 6
  • 32
  • 42
77
votes
7 answers

Where to find "gmp.h"?

I am installing a library, and got this error message: xxxx@ubuntu$ make (cd num; make all) make[1]: Entering directory `/home/xxxx/num' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/home/xxxx/num' (cd itv; make all) make[1]:…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
76
votes
5 answers

How to set the LDFLAGS in CMakeLists.txt?

I set the CFLAGS in CMake by CMAKE_C_FLAGS. Is something like this to set LDFLAGS?
hich9n
  • 1,578
  • 2
  • 15
  • 32
76
votes
2 answers

How does Makefile know that a file changed and then recompile it?

Just out of curiosity, how does Makefile know that a file changed (and then recompile it)? Is it up to make? Is it up to the compiler? If so, is it language dependent?
makeMonday
  • 2,303
  • 4
  • 25
  • 43
76
votes
8 answers

How to compile makefile using MinGW?

I'm new to this. Just wanted to ask how to compile a makefile. I am using MinGW compiler in C language. Do I have to save all my files in MinGW\bin? because right now my files are in a different directory. Appreciate the help.
AAA
  • 811
  • 2
  • 7
  • 7