Skip to main content

Questions tagged [gnu-make]

GNU Make is the GNU project's implementation of the `make` utility. On BSD systems, the GNU Make executable is sometimes called `gmake` to differentiate it from BSD Make.

Filter by
Sorted by
Tagged with
1 vote
1 answer
61 views

How to join strings without implicit space?

I'm trying to organize a Makefile with complex commands into something more readable. I'm trying to break down a long list of parameters, but even single parameters are too bad, hence I wanted to ...
gcb's user avatar
  • 428
0 votes
1 answer
72 views

what is the difference between 'Recursively Expanded Variable Assignment' and 'Simply Expanded Variable Assignment' in Makefile?

I am confused about the difference between them. I have read the GNU documentation, but I am still confused. The value you specify is installed verbatim; if it contains references to other variables, ...
lcWhhx's user avatar
  • 33
-1 votes
1 answer
182 views

Why is there such error of "arm-linux-gcc: not found"?

For building u-boot of my board, I followed below two commands as told: $ sudo make nanopi_h3_defconfig ARCH=arm CROSS_COMPILE=arm-linux- $ sudo make ARCH=arm CROSS_COMPILE=arm-linux- I got the ...
Stan Huang at Taiwan's user avatar
1 vote
0 answers
311 views

log output (stdout) from within make file

How do I send the output (stdout) to a log file from WITHIN the make file? I am NOT interested in a command line solution such as "make > build.log". Listed below is my generic make file. ...
jwzumwalt's user avatar
  • 269
0 votes
0 answers
96 views

Makefile and pid files

I have some convenience rules in a Makefile that depends on pid files, but sometimes the pid files are there when the processes aren't. What's a good pattern to work around this in make? For example, ...
gcb's user avatar
  • 428
0 votes
1 answer
99 views

Make does not rebuild transitive dependencies of pattern rules on change, why?

I have a Makefile, roughly so: .PRECIOUS: %.a %.b %.c %.a: touch $@ %.b: %.a touch $@ %.c: %.b touch $@ If I create "test.c" with a make test.c, all the 3 files (...
peterh's user avatar
  • 9,848
0 votes
0 answers
376 views

Correctly run interactive command through Makefile

I have a bespoke interactive command (a "repl") which needs a series of build steps to be performed beforehand. Makefiles are a very good fit for this particular build process, because of ...
deprecated's user avatar
  • 2,371
2 votes
1 answer
895 views

Installing new version of gnu make without compiling on Linux Lite

I'm on Linux Lite 5.8. The installed version of gnu make is 4.2.1 but the latest gnu make version is 4.4.1. Is there a simple way to install this latest version without it being to compile from source?...
AntonioCS's user avatar
  • 121
0 votes
0 answers
68 views

makefile error "error checking context: 'no permission to read from" when file is not readable

I'm running into an error of: make deploy_test error checking context: 'no permission to read from '.../ssh-priv-key''. make: *** [Makefile:24: build_deploy] Error 1 This ssh-priv-key file is ...
Chris Stryczynski's user avatar
0 votes
1 answer
1k views

Including cURL in makefile

I'm using curl in my code and running through Makefile. but while running with "make" command its giving error like "curl/curl.h: No such file or directory". Here below is my ...
nima's user avatar
  • 1
1 vote
1 answer
276 views

How do I use a shell assignment in a makefile so that it works with both FreeBSD make (bmake) and macOS make (GNU Make 3.81)?

I'd like to use the shell assignment operator (i.e., !=) in a makefile that is going to be executed on FreeBSD, macOS, and Linux. Here's an example: a!= seq 3 .PHONY: all all: $a .PHONY: $a $a: ...
Mateusz Piotrowski's user avatar
0 votes
1 answer
2k views

Invoking "make -j16 -l16" failed

I want to simulate Tiago robot in Gazebo and I am using ROS available package. Before, I simulated it without problem but right now I can not. I am using ROS melodic and ubuntu 18.04 on KVM virtual ...
Pouyan's user avatar
  • 13
3 votes
1 answer
503 views

Remake included makefile only when needed

Let's say that I have a Makefile that has two “main” targets: foo.o and clean. The former one has a recipe to create the foo.o file. The latter one removes all the temporary files. To remove the need ...
jiwopene's user avatar
  • 1,071
1 vote
1 answer
1k views

Serialize all rules in GNU make: best practise?

I have a makefile and want to make sure that all the rules are executed sequentially, that is, that no parallel execution is performed. I believe I have three ways of achieving this: With ....
Clément's user avatar
  • 378
17 votes
1 answer
8k views

Why is echo -e behaving weird in a Makefile?

I was writing a Makefile (on Ubuntu 20.04, if it's relevant) and noticed some interesting behavior with echo. Take this simple Makefile: test.txt: @echo -e 'hello\nworld' @echo -e '...
Dominick Pastore's user avatar
1 vote
0 answers
324 views

Permission denied error when using make all-recursive?

I am using autotools and GNU make to build a C library, there is a line all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive In the Makefile, and I get an error compiling make all-recursive make: ...
Super User's user avatar
0 votes
1 answer
107 views

Same make command fails in macOS, but succeeds in Linux

I'm using below Makefile and make publish fails on macOS while succeeding in Linux (alpine, Ubuntu, Debian) with the below error: $ make publish "docker images" requires at most 1 argument. ...
rokpoto.com's user avatar
0 votes
1 answer
164 views

why is this makefile command running so frequently

I have the makefile below. Why does the rule for the data/vix.csv target always execute when I run make, though? In a recent answer on SO, someone showed me how to update last_updated.txt on 24 hour ...
Taylor's user avatar
  • 123
1 vote
2 answers
267 views

Spike in number of page faults with make -j`nproc`

I am running a benchmark to figure out the number of jobs I should allow GNU Make to use in order to have optimal compile time. To do so, I am compiling Glibc with make -j<N> with N an integer ...
Abdelhakim AKODADI's user avatar
3 votes
0 answers
378 views

Editting Makefile in VS Code

I have many questions about writing makefiles in visual studio (vs) code. The first question is, how to make vs code recognize certain files as makefiles. For instance, when a file's suffix is "....
Ziqi Fan's user avatar
  • 237
2 votes
2 answers
2k views

How can I execute recipe iff a file exists?

I'm writing a Makefile recipe that needs to execute IF AND ONLY IF a certain file exists... Here's what I have: clean: $(if $(shell test -s ${MFN_LSTF}), \ $(foreach mfn, $(shell cat ${...
Thesevs's user avatar
  • 107
11 votes
1 answer
6k views

Makefile command substitution

My Makefile: all: ...(other rules) clean clean: rm $(find . -type f -executable) When I delete clean rule from the above Makefile everything works as expected. After adding, make (also make ...
Elgin Cahangirov's user avatar
2 votes
1 answer
2k views

Why are the pkg-config commands in the makefile not being recognized when I run the script?

I am trying to run make for an open-source project on my Debian virtual machine but I do not understand why the commands based on pkg-config are not being recognized. One of the commands is as follows:...
a_sid's user avatar
  • 247
4 votes
1 answer
1k views

multiple target specific gnu make variables?

How do I set more than one target specific variable? If I try: x: Y := foo Z := bar I end up with Y = "foo Z := bar". There must be some syntax which will allow for multiple variables...
agapanthusblue's user avatar
0 votes
1 answer
343 views

Error when using Makefile..sed

An app is trying to configure with sudo make configure (cd /opt/ioapi-3.2/ioapi ; sed -e 's|IOAPI_BASE|/opt/ioapi-3.2|' -e 's|LIBINSTALL||' -e 's|BININSTALL||' -e 's|IOAPI_DEFS||' -e 's|NCFLIBS|-L/...
afernandezody's user avatar
2 votes
2 answers
2k views

Is it possible to display variables outside rules using GNU Make?

Is it possible to display variables outside rules using GNU Make? Consider the following Makefile: x = foo bar baz ifdef x @echo $(x) endif This results in Makefile:4: *** commands commence ...
Shuzheng's user avatar
  • 4,601
1 vote
1 answer
975 views

Using `[email protected]` in Makefile dependency won't work

Trying a Makefile rule like the following did not work (GNU Make 4.0): foo: [email protected] other.o bar: bar.o other.o The file foo.c was compiled (to foo.o), but the link command was cc -o .o. In contrast,...
U. Windl's user avatar
  • 1,493
0 votes
1 answer
245 views

FreeBSD - problem with linking protobuf

I have a small application that was tested on Linux and it worked. Now I would like to build the same code on FreeBSD. To build it on FreeBSD I needed to change a little my Makefile. Here is my ...
tomi7654's user avatar
1 vote
1 answer
56 views

Use an interactive shell under Make

I'm trying to use an interactive shell under Make. Here's an example with Docker: ubuntu: docker run -it ubuntu bash This ubuntu target doesn't work well. For example, when I type I can't see the ...
Anatole Lucet's user avatar
0 votes
0 answers
138 views

Clang Exits with Error Code 1

gmake (with Clang10) complains that in file m_file.cpp there is "no matching function for call to 'fileno'". Also, that it "cannot initialize a param of type 'FILE *' ::fclose(m_fp). ...
xsundevil's user avatar
0 votes
2 answers
2k views

If function in Makefile seems to disregard conditional and executes unexpectedly

The following is a simple recipe that is not behaving as I want it to: $(eval PkgName := $(shell pacman -Qq zsh | awk '{print $$1}')) $(if ifeq ($(strip ${PkgName}),), pacman -Sy --noconfirm zsh) All ...
Thesevs's user avatar
  • 107
0 votes
0 answers
28 views

Valid bash won't execute in make [duplicate]

# Makefile test : while true; do echo test done test2 : while true; do echo test; done make test throws the error while true; do /bin/sh: -c: line 1: syntax error: unexpected ...
Mason's user avatar
  • 489
0 votes
1 answer
439 views

How can I run make on file update?

I would like to be able to watch the files in my project and have make run every time one of the targets gets updated (unless it's changed by make itself I suppose). This is a common feature in many ...
Mason's user avatar
  • 489
5 votes
3 answers
3k views

How do I build PKGCONF and LIBFFI and subsequently Python3.9 with ctypes support without sudo and write access to /usr/local?

How do I properly configure pkgconf and libffi to allow the python3 build process to correctly use my libffi version at every step of the build process, in order to import the _ctypes module correctly?...
szofar's user avatar
  • 53
0 votes
1 answer
246 views

Determining the type of makefile recipe

I want to determine the type of recipe the user entered in the shell. However the below code always return false . all clean: ifeq ("$@", "clean") echo "This is an ...
Javad Rahimi's user avatar
4 votes
1 answer
5k views

is there any way to skip a make's target?

I am trying to add a patch so that a software can compile and run correctly, unfortunately in order to add the change I am trying I always run into an annoying code style check error. Is there any way ...
jeferson lemos's user avatar
-1 votes
1 answer
307 views

How to introduce variables in Makefile

I'm using Bash on Ubuntu and GNU Make 4.2.1. I'm trying to write a Makefile that would perform simple operations on some data (.TXT files) I have. My different .TXT files are stored in 3 directories ...
Alex 's user avatar
  • 33
3 votes
2 answers
5k views

Variable not found in makefile recipe

why doesn't this simple recipe work ? .PHONY: test test: foo := $(shell ls | grep makefile) ;\ echo $(foo) results in $> make test makefile:65: warning: undefined variable 'foo' foo := ...
GuillaumeA's user avatar
0 votes
1 answer
817 views

Compiling drivers/staging

I need to compile all staging drivers. I am using make allyesconfig and I have also set CONFIG_BROKEN=y and CONFIG_COMPILE_TEST=y . Right now, make modules C=1 M=drivers/staging prints MODPOST drivers/...
thatbangaloreanguy's user avatar
0 votes
1 answer
3k views

What is the meaning of shell in $(shell uname -r)

I was reading a makefile where I found this statement make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules Can anyone explain what is shell here. Command substitution is being tried here ...
Kishan Kumar's user avatar
0 votes
1 answer
1k views

Why is only the first prerequisite executed?

Here is the makefile. .PHONY: all target1 target2 target all: target1 target2 target1: NUM = 1 target2: NUM = 2 target1 target2: target target: @echo "this is target ${NUM}" And the output is: ...
Suyee's user avatar
  • 1
1 vote
0 answers
1k views

Custom error message in GNU make if required but not otherwise?

In GNU's make is it possible to print a custom error message instead of GNU's default one, possibly with the line number as well? I am fine with make's default behavior in all other scenarios. Here ...
Nishant's user avatar
  • 643
1 vote
0 answers
603 views

Pattern-specific make variable based on the highest level target name

Goal In the usual case of a target (mother target) calling another target (child target) as prerequisite, I'd like to assign a pattern-specific variable (see the manual page) with the following ...
jmon12's user avatar
  • 121
6 votes
1 answer
4k views

What's the difference between percent vs asterisk (star) makefile prerequisite

I'm trying to understand why some Makefiles have prerequisites with %.txt and others have *.txt. I've created this folder layout. $ tree . . ├── hi1.txt ├── hi2.txt ├── hi3.txt └── Makefile First, I ...
425nesp's user avatar
  • 446
0 votes
1 answer
14 views

Outputing the predefined variables `make -R` references?

According to the docs on make there is a -R switch, -R, --no-builtin-variables Don't define any built-in variables. How can I find those builtin variables and their values?
Evan Carroll's user avatar
  • 31.8k
4 votes
2 answers
4k views

How to get the relative path between two directories?

Say I have a variable with a path release/linux/x86, and want the relative path from a different directory (i.e. ../../.. for current working directory), how would I get that in a shell command (or ...
Andreas's user avatar
  • 207
2 votes
2 answers
5k views

"Command not found" passing argument from Makefile to shell script

I have a info.properties file where I have this MY_NAME property and I can use this property on my Makefile. I already tried but I can't use that property directly on myScript.sh file. So I'm trying ...
Ninita's user avatar
  • 134
1 vote
2 answers
3k views

Makefile - Set multiple variables on a single stage

I have this Makefile where I'm having some troubles on simply set some variables: my_stage: echo "FULL_NAME=$(FULL_NAME)" echo "MY_NAME=$(MY_NAME)" $(eval SOME_NAME=$(shell sh -c "...
Ninita's user avatar
  • 134
1 vote
1 answer
5k views

Simple shell loop fail in Makefile

Why does the shell loop l='abc de f'; for k in $l ;{ echo $k; } inside Makefile not work ? instead only give abc de f at once How to solve such in the definitive way?
user avatar
-1 votes
1 answer
71 views

Makefile not linking required dependency

The two target executables are made successfully at first: $ rm build/* bin/* $ make g++ -Wall -g -c -o build/Person.o src/Person.cpp g++ -Wall -g -c -o build/PersonTests.o test/PersonTests.cpp g++ -...
lockjaw-0's user avatar