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
0 votes
0 answers
133 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,341
0 votes
1 answer
305 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
  • 101
0 votes
0 answers
47 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
721 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
176 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
1k 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
289 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,022
1 vote
1 answer
747 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
  • 328
17 votes
1 answer
6k 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
234 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
98 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. ...
rok's user avatar
  • 399
0 votes
1 answer
105 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
245 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
303 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
  • 227
1 vote
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
  • 87
9 votes
1 answer
4k 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
3 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
313 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
1k 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,203
1 vote
1 answer
786 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,269
0 votes
1 answer
196 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
39 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
120 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
  • 87
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
  • 469
0 votes
1 answer
296 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
  • 469
4 votes
3 answers
2k 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
  • 43
0 votes
1 answer
221 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
4k 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
268 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
4k 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
705 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
908 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
939 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
  • 563
1 vote
0 answers
443 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
5 votes
1 answer
3k 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
  • 426
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
  • 29.6k
3 votes
2 answers
3k 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
  • 197
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
50 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
1 vote
1 answer
41 views

How do I get Make to acknowledge two intermediate dependencies from one recipe?

I am converting .sup files to .ass files using the following recipes: %.idx %.sub: %.sup bdsup2subpp --language en -o $*.sub $< %.srt: %.sub vobsub2srt $* %.ass: %.srt ffmpeg -...
Score_Under's user avatar
3 votes
3 answers
534 views

What is "sed -i 's,-m64,,g'" doing to this Makefile?

What is the meaning of sed command sed -i 's,-m64,,g' Makefile? Does it simply remove -m64 argument from Makefile? Is it the same with sed -i 's/-m64//g' Makefile, just use / delimiter in place of ...
minto's user avatar
  • 511
2 votes
1 answer
697 views

alternatives to using make as a script runner [closed]

tl;dr make is working for me, but I'm looking for the appropriate tool. I'm currently using Makefiles as script runners for my projects. In order to standardize each project, I just create a makefile ...
basic_q's user avatar
  • 21
0 votes
1 answer
976 views

Process continues to run after receiving uncaught SIGINT (Ctrl-C from terminal)

I am trying to interrupt some running processes with Ctrl-C from the terminal in Centos7; some do, some don't. One of the problematic processes (Process-A) is a GNU makefile with nothing fancy; just ...
sidcha's user avatar
  • 137
17 votes
1 answer
36k views

Makefile: Default Value of Variable that is set but has null value

I have a Makefile that has a variable that needs to have a default value in case when variable is unset or if set but has null value. How can I achieve this? I need this, as I invoke make inside a ...
Porcupine's user avatar
  • 1,802
1 vote
1 answer
516 views

Check FreeBSD version in Makefile

I have these lines in my Makefile: PLATFORM = $(shell uname -r) OLD_FREEBSD = 7.3-RELEASE-p2 ...
Sergius's user avatar
  • 813