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
votes
1answer
39 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 ...
0
votes
2answers
33 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 := ...
0
votes
0answers
18 views

Induction in makefile

Can I make a recipe where a file named 3 has 2 as a prerequisite. 2 has 1 as a prerequisite. And 1 has no prerequisite? Something like 1: touch 1 n: n - 1 touch n
0
votes
1answer
31 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/...
0
votes
1answer
97 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 ...
0
votes
1answer
37 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: ...
0
votes
0answers
26 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 ...
0
votes
0answers
23 views

Calculate prerequisite in Makefile

I've got below Makefile with two targets based on a dynamic list of items. I'm trying to get the container_targets to require binary_targets as a prerequisite. I'm trying to calculate the prerequisite ...
0
votes
0answers
37 views

Use variables in Makefile recipe

Consider this Makefile: DIRS = foo bar baz ADIRSGLOBAL = $(addprefix A, $(DIRS)) all: $(DIRS) $(DIRS): ADIR=$(addprefix A, $@) @echo $(addprefix A, $@) @echo "ADIR="$(ADIR) ...
1
vote
0answers
20 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 ...
1
vote
1answer
170 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, ...
0
votes
1answer
12 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?
1
vote
1answer
66 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 ...
2
votes
2answers
474 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 ...
1
vote
1answer
209 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 "...
0
votes
1answer
720 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?
-1
votes
1answer
26 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++ -...
0
votes
0answers
88 views

Comparison in Makefile from shell variable

I am working on a makefile script to check the input is equal to a number check-number: $(eval API_STATUS := 201) ifeq ( $(API_STATUS) , 201) @echo "equal" else @echo "not equal" endif ...
1
vote
1answer
33 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 -...
3
votes
3answers
230 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 ...
2
votes
1answer
99 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 ...
0
votes
1answer
290 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 ...
8
votes
1answer
13k 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 ...
3
votes
1answer
2k views

Make - How to suppress make error messages without suppressing other output

I'm implementing a simple build system that's actually just a wrapper around Make. Since this build system already emits its own error messages, I don't want Make to produce error messages like make: ...
2
votes
2answers
1k views

Why don't here strings in Makefiles using Bash work?

I just solved a problem with my Makefile(s). Make trips over every <<< with the error message /bin/sh: 1: Syntax error: redirection unexpected And I would like to know why. (I am using Bash ...
5
votes
3answers
4k views

How can I partially serialize with GNU make

When I have a make task where a specific target needs to be made before another, while in parallel mode, this is simple when using SunPro Make (dmake). The following makefile: install: dir dir/file ...
10
votes
2answers
1k views

How can I use files from HTTP as prerequisites in GNU make?

I want to use files from the World Wide Web as prerequisites in my makefiles: local.dat: http://example.org/example.gz curl -s $< | gzip -d | transmogrify >$@ I only want to "transmogrify" ...
0
votes
1answer
83 views

Why does GNU make's eval convert a list to a scalar?

I'm trying to to use eval to define a few make variables, but implicitly it seems to convert a list into a scalar. I can't seem to figure out how to avoid this behavior. Here's my current Makefile: ...
2
votes
0answers
751 views

Is there an automatic translator from Makefile to CMakeLists.txt?

I have several inherited projects - on RHEL 7, part of which are created using make, and the rest are utilising cmake. I'm wondering: is there an automatic translator that will take a Makefile as ...
-1
votes
1answer
2k views

What does exactly does GNU make dep do?

I am trying to understand GNU Make and trying to understand some c code and GNU autotools. There's a folder let's say lib, with three subfolders and a makefile. lib ...libA ...---compile.sh ...---...
8
votes
1answer
2k views

Visualizing dependencies coded up in makefiles as a graph

Closely related to How to display dependencies given in a makefile as a tree? But the answers given there is not satisfactory (does not work). Is there a tool to visualize the Directed Acylic Graphs (...
1
vote
2answers
2k views

Makefile, sqare brackets built-in, variable expansion and command substitution

To embrace the DRY (Don’t Repeat Yourself) principle, I sometimes need to share pieces of shell commands in a Makefile. So there is a recipe somewhere in that file like: shell=/bin/bash # … .ONESHELL:...
1
vote
1answer
1k views

GNU make - How to concatenate to variable depending on shell command result (GCC version)?

I want to add another option to the CFLAGS make variable, depending on the result of a shell command that i want to execute outside of a recipe in my "configuration" section of the makefile. This is ...
0
votes
1answer
73 views

How can I refactor this Makefile to not use fake .out outputs?

I have tests in tests/FILENAME-test.sh and for each one I want to run the script inside a docker container. How can I refactor this Makefile to not use TEST_OUTPUTS like I have? Also, how can I make ...
3
votes
1answer
1k views

Why does make behave strangely when writing multiple targets using the % character?

According to GNU Make Manual A rule with multiple targets is equivalent to writing many rules, each with one target, and all identical aside from that. The same recipe applies to all the targets, ...
6
votes
2answers
5k views

gnuMake, How to have an environment variable override

Currently I am working with Makefiles that have definitions like MYLIB=/.../mylib-1.2.34 The problem is that these are different for different developers, and it is a pain having to re-edit the file ...
1
vote
0answers
229 views

Compiling Octave: how to add a new item to the include directories for Qt?

Situation My distro is Ubuntu 14.04. I am installing Octave 4.2.1. I have a shell script doing this for me using GNU make. Octave is in search of Qt libraries. I wish to use the Qt5 5.8 binaries ...
1
vote
0answers
320 views

PHP 7.1.2 cannot Gmake : Zend Error

I use Solaris 11.3 Sparc 64 bit, Mysql Enterprise Advance 5.7.1, Apache 2.4.25 and PHP 7.1.2 I configure PHP with following parameter. export CC="gcc -m64" export CFLAGS="-std=gnu99" ./configure --...
11
votes
2answers
21k views

What does % symbol in Makefile mean

I am playing around with makefiles and I came across %.o or %.c. From what I understood, it specify all c or o files. But why this work: %.o: %.c $(CC) -c $^ -o $@ and this doesn't work ...
3
votes
1answer
3k views

gcc compiles gcc with errors 'template with C linkage' and 'template specialization with C linkage'

I am working with Ubuntu 14.04 LTS. This already ships a packaged gcc 4.8.4 but I wanted to have a later version of gcc. Using the existing version 4.8.4, I built version 4.9.4 from the source code ...
0
votes
1answer
351 views

Make pattern match directories

I'm using gnu make and stow to manage some configurations (dotfiles). I have multiple directories in my repo: dotfiles/ ├── Makefile ├── package1/ └── package2/ Currently, my Makefile looks like: ...
2
votes
0answers
97 views

How to check if a target will be run?

I know that the variable MAKECMDGOALS In GNU Make will contain the names of final goals for the run, i.e. the targets included on the command line. However I'd like to check if a target will be made, ...
42
votes
1answer
4k views

How does this Makefile makes C program without even specifying a compiler?

I was using a Makefile from the book "Advanced Linux Programming (2001)" [code]. It was strange for me to see that GNU make does compile the code correctly, without even specifying a compiler in the ...
1
vote
1answer
542 views

apply rules in a list of files in GNU Make (or 'for' instruction in GNU Make)

I have this rules in my GNU Makefile: FITXER = fitxa.md $(FITXER).html: $(FITXER) pandoc --from markdown --to html $(FITXER) -o $(FITXER).html $(FITXER).jpeg: $(FITXER).html wkhtmltoimage $(...
7
votes
3answers
8k views

Using wildcard in GNU Make pattern rule

Assume doc.pdf is the target. The following rule triggers a regeneration of doc.pdf whenever doc.refer is updated, but is also happy when doc.refer does not exist at all: doc.pdf: doc.mom $(wildcard ...
0
votes
1answer
2k views

How to use bash variables inside make

I thought that make interprets the rule's set of commands literally, passing them to the sub-shell. But this doesn't seem to work in this case: default: loop echo $$RANDOM This prints echo $...
21
votes
4answers
15k views

How to display dependencies given in a makefile as a tree?

Problem I want to see the dependencies for one or more targets of a makefile. So I am looking for a program that can parse makefiles and then will represent the dependencies in some tree-like format (...
0
votes
1answer
505 views

GNU Make4.1 Segmentation Fault

During a make check after compiling GNU Make-4.1, the following error occurs. make[2]: Entering directory '/mnt/lfs/sources/make-4.1' cd tests && perl ./run_make_tests.pl -srcdir /mnt/lfs/...
1
vote
1answer
540 views

Recursive Make passing targets in OS X

I am trying to write a recursive clean target for GNU Makefile on OS X (GNU Make 3.81 - from XCode). Following GNU Make documentation, I came up with the following: Main Makefile ALLSUBMAKES=$(...
0
votes
1answer
171 views

Why is echo not working for mt valgrind command?

So I have my makefile working great, except that It doesn't create the valgrind.out file and I don't know why. So the console succesfully prints out that my executable file line is created but not ...