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

Makefile 'if' condition with regexp

I need to do something like this: case `uname -m` in i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;; esac But I need to do this in makefile for a particular target. I have not found a method to make an if condition with a regular…
Kron
  • 367
  • 2
  • 5
  • 8
9
votes
3 answers

makefile error: undefined reference to main

I am trying to compile my piece of code using make. Normally I compile my code like this: mipsisa32r2el-timesys-linux-gnu-g++ -o testing -I/usr/include/libxml2 -L/develop/xc4/rootfs/parsecpp/lib -L/develop/xc4/rootfs/parsecpp/sqlite-mips2/lib…
nic
  • 125
  • 1
  • 3
  • 7
9
votes
2 answers

How can I compile sqlite for WinRT / ARM?

I've successfully compiled my WinRT version of SQLite for x86 as described by Tim Heuer. However, I am still struggling how to compile the dll for WinRT on ARM CPUs. I've run nmake with the Visual Studio ARM command prompt, but that just gives me…
Adrian Grigore
  • 33,034
  • 36
  • 130
  • 210
9
votes
3 answers

Build OpenSSL on Linux with -g for debugging

I have a segfault coming from OpenSSL (specifically SSL_read) that I'd like to debug. I think the best step to take here is to build the library myself with debug symbols so I can step into the function and see the command it's happening on. It's…
djechlin
  • 59,258
  • 35
  • 162
  • 290
9
votes
3 answers

Make or Shell Variables In Linker Script

Is it possible for a linker script to access makefile/shell variables and make a decision based on the said variable? For example, suppose I want to change the start of the RAM area below without using a different linker script, would it be possible…
jkayca
  • 241
  • 3
  • 5
9
votes
2 answers

How to treat a warning as an error in a Makefile?

Is it possible to treat warnings as errors in a Makfile (and thus exit before Makefile proceeds) Furthermore, is it possible to filter out which warning yields an error? My use case: I want to use --warn-undefined-variables in combination with…
timotheecour
  • 3,104
  • 3
  • 26
  • 29
9
votes
2 answers

makefile target specific variables as prerequisites

Related: Target-specific Variables as Prerequisites in a Makefile I'm trying to craft a Makefile which uses a target-specific-variable to specify the output directory for the object files and the final executable. The idea is to maintain two…
Chris Browne
  • 1,582
  • 3
  • 15
  • 33
9
votes
2 answers

Auto-install packages from inside makefile

Goal: when the user types 'make packages', automatically search for the package libx11-dev (required for my program to compile) and, if not found, install it. Here's a stripped-down version of my makefile: PACKAGES = $(shell if [ -z $(dpkg -l |…
1''
  • 26,823
  • 32
  • 143
  • 200
9
votes
2 answers

In a makefile, how VPATH works?

in the following website https://make.mad-scientist.net/papers/how-not-to-use-vpath/ the author says: VPATH was designed to find sources, not targets. but in GNU make's manual, it says: The value of the make variable VPATH specifies a list of…
Y.L.
  • 1,274
  • 6
  • 23
  • 39
9
votes
6 answers

Qt - Error 2 at compile time

I just downloaded Qt SDK 4.8.1 and, after installing it, I simply tried to compile a default C++ project, but I got this strange error. 16:50:24: Running build steps for project test... 16:50:24: Configuration unchanged, skipping qmake step. …
user1372813
  • 135
  • 1
  • 1
  • 6
9
votes
2 answers

g++ with python.h, how to compile

I compile one test code with g++ without any issue. #include "Python.h" int main(int argc, char** argv) { Py_Initialize(); PyRun_SimpleString("import pylab"); PyRun_SimpleString("pylab.plot(range(5))"); …
bbc
  • 1,061
  • 4
  • 13
  • 21
8
votes
4 answers

How to make `make` make an a executable for each C file in a folder?

My question is deceptively simple, but I have lost several hours of study trying to get the solution. I'm trying to create a Makefile that builds an executable for each .c file in a directory. I have tried the following: CC = gcc SRCS = $(wildcard…
eduardomoroni
  • 4,140
  • 1
  • 21
  • 18
8
votes
2 answers

nmake appending to variables

Utility: NMake Platform : Windows 7 I have the following Makefile FILE = $(shell) *.c FILE += $(shell) *.cpp exec: @echo $(FILE) This works perfectly fine with make. This throws up the following error with nmake makefile(2) : fatal error…
gudge
  • 1,053
  • 4
  • 18
  • 33
8
votes
4 answers

Eclipse CDT: Skip make/build before Debug/Run

I am debugging a large Makefile-based C project which takes 15 seconds to run "make" even if no changes to the sources are done. That means that whenever I relaunch the program, I need to wait for 15 seconds before I can even start debugging. The…
eold
  • 5,972
  • 11
  • 56
  • 75
8
votes
2 answers

android ANTLR make not working properly

I am trying to use ANTLR on Android, and I found this: ANTLR and Android After downloading the AntlrJavaRuntime I am not sure of what to do, I am supposed to make this: 1. lunch the appropriate target 2. make AntlrJavaRuntime 3. verify that…
George W
  • 187
  • 9