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
8
votes
3 answers

How to enable multiline logs instead of single-line progress-logs

Here is a sample output of my cmake: 2017/10/27 07:51:46 Platform overridden to 'RHEL5_64' -- cmake version: 3.2.3 -- Configuring done -- Generating done -- Build files have been written to: /local/home/etc [3/3] Linking CXX shared library…
Nawaz
  • 353,942
  • 115
  • 666
  • 851
8
votes
1 answer

Help simplifying a Makefile for multiple executables

I have common code (e.g. hello.cpp) that is used by multiple executables. I'm using a single Makefile to build it all: EXE=app1.out app2.out SRC=hello.cpp OBJ=$(SRC:.cpp=.o) SRC_MAIN=app1.cpp app2.cpp OBJ_MAIN=$(SRC_MAIN:.cpp=.o) all: $(EXE) …
mpenkov
  • 21,621
  • 10
  • 84
  • 126
8
votes
1 answer

Run Makefile on pip install

I have some protocol buffer definitions which need to be built to Python source as part of the pip install process. I've subclassed the setuptools.command.install command in setup.py but I think it's trying to run the Makefile after the package is…
Josh
  • 3,445
  • 5
  • 37
  • 55
8
votes
3 answers

g++: internal compiler error: Segmentation fault (program cc1plus) - where do I start?

I am porting code that compiled on Ubuntu 14.04 to 16.04. I have cloned my git repo, installed dependencies and tried the usual make command, soon I hit a g++: internal compiler error: Segmentation fault (program cc1plus) ... yet I am not sure where…
zabumba
  • 12,172
  • 16
  • 72
  • 129
8
votes
2 answers

Why doesn't my Makefile interpolate an expression in a command

I'm trying to write a super simple Makefile to run the tests in a Go project. The project's dependencies are vendored, but I want to skip these tests. When running this from the command line I simply do $ go test $(go list ./... | grep -v…
m90
  • 11,434
  • 13
  • 62
  • 112
8
votes
1 answer

verbose rakefile - print all executed command lines to stdout

I've just began building my first Rakefile (Ruby version of makefile), and I'd like to debug my script easily using verbose mode (like makefile -V or bash -x) is there an option to do so on ruby ? thanks
Zohar81
  • 4,554
  • 5
  • 29
  • 82
8
votes
2 answers

Makefile error exit with a message

Is there any way to output a error message when the error happens.Let's go into details,I want to know whether one file content equal to another or not.If not ,make should exit and output a error message. test: cmp --silent tmp/test.txt…
user6796845
8
votes
1 answer

Default Makefile for Sphinx

I'm trying to understand the Makefile that is automatically produced by sphinx-quickstart. Here it is: SPHINXOPTS = SPHINXBUILD = sphinx-build SPHINXPROJ = myproj SOURCEDIR = source BUILDDIR = build .PHONY: help Makefile %:…
Filip Kilibarda
  • 2,484
  • 2
  • 20
  • 31
8
votes
1 answer

Makefile adds itself as target

I have a Makefile for a C++ program that uses automatic dependency generation. The %.d recipe is taken from the GNU Make manual. The problem is that somehow "Makefile" is being added as a target and then an implicit rule is causing it to assume it's…
Jol
  • 83
  • 1
  • 3
8
votes
2 answers

Linking with CMakeLists: ld cannot find library

I have a CMakeLists.txt file, with the following: target_link_libraries(${PROJECT_NAME} OpenNI2) When I run cmake, I receive no errors. But when I run make, I receive the following error: /usr/bin/ld: cannot find -lOpenNI2 However, I have a file…
Karnivaurus
  • 22,823
  • 57
  • 147
  • 247
8
votes
5 answers

Is there a way to force rebuilding a target (make -B) without rebuilding its dependencies?

GNU Make has -B option that forces make to ignore existing targets. It allows to rebuild a target, but it also rebuilds all the dependency tree of the target. I wonder is there a way to force rebuilding a target without rebuilding its dependencies…
Kirill Bulygin
  • 3,658
  • 1
  • 17
  • 23
8
votes
0 answers

GNUMAKE Expected exactly one source file error

So I am working on building a NDK sample in Android Studio 2.2.2. The project use clapack (a math library) and it also has a testclapack.cpp at the same level as clapack folder. An Android.mk file is also at the same directory. The content of the…
PsychoTodd
  • 91
  • 4
8
votes
1 answer

Makefile special characters meaning and use

What do the following characters means in a Makefile? $@ , $? , $* , $< , $^ I have seen some explanations but i did not fully get how to exactly use it.
user4579229
8
votes
1 answer

using `date` in Makefile variable

Using GNU Make 4.1, in my Makefile I can create a timestamp log file with this:: flush_log: @echo "==> flush logs" cat file > file_`date +%FT%T%Z`.log But who to put: file_`date +%FT%T%Z`.log in a var inside the Makefile e.g to…
user3313834
  • 7,327
  • 12
  • 56
  • 99
8
votes
3 answers

error: 'strdup' was not declared in this scope

I am trying to Build and Install the Apache Thrift compiler and libraries As shown in instructions run ./configure && make And I get this error: thrift 0.9.3 Building C++ Library ......... : no Building C (GLib) Library .... : no Building Java…
Tony Tannous
  • 14,154
  • 10
  • 50
  • 86