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
7
votes
1 answer

Error Building Clang

I am trying to build Clang on Linux (Amazon's EC2). I am running the make as per the guide at: http://clang.llvm.org/get_started.html I am getting the following link error messages: llvm[2]: Linking Debug+Asserts executable…
user265445
  • 341
  • 1
  • 4
  • 11
7
votes
2 answers

Makefile Using ifeq condition inside foreach loop

I have lots of variables called allow_xxx where xxx is a feature. I would like to create a variable inside my makefile with all values that are allowed. This is what I try to do: allow_feat1 := 1 allow_feat2 := 1 allow_feat3 := 1 list_features :=…
Charles B
  • 160
  • 1
  • 12
7
votes
3 answers

Undefined references in makefile

Ok, ive read about 10 tutorials, but i keep getting errors all the time, i have 5 files, main.cpp class.cpp, class.h and functions.cpp and functions.h. All of those use functions from different objects meaning that functions in functions.cpp uses…
Bartlomiej Lewandowski
  • 10,771
  • 14
  • 44
  • 75
7
votes
2 answers

Compile linux kernel (2.6) module including non kernel headers

Is it possible to compile a linux kernel(2.6) module that includes functionality defined by non-kernel includes? For example: kernelmodule.h #include #include #include // printk() // ... #include…
Mike Hamer
  • 1,155
  • 11
  • 22
7
votes
2 answers

How to make makefile host dependent?

I need to compile my program with or without some libraries depending on which of the two hosts it is running. I don't know what to use at the right side of HOST= in my makefile to make this work as I want it to: …
morynicz
  • 2,322
  • 2
  • 20
  • 34
7
votes
1 answer

How to config glib in Makefile?

I am using Eclipse CDT to develop a C software. I would like to use glib, but it always reports "Unresolved inclusion: ". I have installed glib on my ubuntu: carl@Carl:~$ dpkg -l | grep libglib ii libglib-perl 2:1.223-1 …
Joy
  • 9,430
  • 11
  • 44
  • 95
7
votes
2 answers

Netbeans Remote C++ Development "No rule to make target" Error

When creating a simple Remote C++ Development application in Netbeans, I get the following error: gmake[2]: Entering directory '/path/to/project' gmake[2]: *** No rule to make target '/path/to/project/cpp/file' gmake[2]: Leaving directory…
ossys
  • 4,157
  • 5
  • 32
  • 35
7
votes
2 answers

How to debug a program compiled with 'make'?

Tutorials for gdb suggest compiling with 'gcc -g' to compile the program with debug symbols. However, I want to debug a program compiled with make. How can I instruct make to compile with debugging symbols? Thanks.
Anders Feder
  • 595
  • 2
  • 5
  • 18
7
votes
6 answers

Error compiling OpenSSL with MinGW/MSYS

Download source files from official OpenSSL site. I follow the INSTALL.M32 file in OpenSSL folder. I open msys.bat, go to the OpenSSL folder, then type $ ./config It says "Configured for MinGW", than I type $ make and after few minutes receive…
Alecs
  • 2,256
  • 8
  • 32
  • 45
7
votes
4 answers

Makefile - How should I extract the version number embedded in `pyproject.toml`?

I have a python project with a pyproject.toml file. Typically I store the project's version number in pyproject.toml like this: % grep version pyproject.toml version = "0.0.2" % I want to get that version number into a Makefile variable regardless…
Mike Pennington
  • 41,899
  • 19
  • 136
  • 174
7
votes
1 answer

How to fix Makefile syntax error when using wildcard on make clean?

I have a simple Makefile that just contains this one target. It looks like this: SHELL:=/bin/bash clean: rm !(*.tex|Makefile|*.pdf) When I run this command in bash it works fine, i.e. it gives no errors and it removes the desired files.…
nvcleemp
  • 514
  • 8
  • 21
7
votes
1 answer

Django collectstatic --no input Yes instead of no

I am using Django3 and i have currently the following command in my makefile for "Build" python3 manage.py collectstatic to automate my buildprocess with a pipeline i would like to get rid of the prompt that asks You have requested to collect…
mambu231
  • 83
  • 1
  • 3
7
votes
4 answers

How do I write a clean Makefile?

The Makefiles that I have dealt with, for the most part, are complex and hide a lot of relationships. I have never written one myself, and was wondering if anybody had some tips on writing a Makefile that is easy to read and reusable?
cssndrx
  • 773
  • 2
  • 9
  • 17
7
votes
5 answers

What is the cause of not being able to divide numbers in GCC

i'm having a very strange situation. Every time I try to compile my arm project (LPC2378, codesourcery arm-none-eabi-gcc-4.5.1) I am left with the same error whilst linking /media/data/Projects/arm/uart/main.c:39: undefined reference to…
regomodo
  • 644
  • 3
  • 9
  • 18
7
votes
3 answers

In Makefile, how to cleanup lockfile files?

In GNU Make 3.81, I need to remove a lockfile in the event of an error in any part of the toolchain. Is there a special target that will allow me to do this? Do I need to write a wrapper script? In the example below, I need unlock_id to happen if…
Jeff
  • 552
  • 1
  • 8
  • 16