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
2
votes
2answers
53 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
29 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
0answers
25 views

I want to automate the process of updating the exported variables [duplicate]

I have multiple variables defined in a Makefile with some values/strings initialized. I want to have a target with which, I can update any of the variable in run time. For that I wrote a script ...
0
votes
1answer
77 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
32 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
170 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 ...
0
votes
0answers
21 views

Difficulty with pattern rule in Gnu make

I want to write a pattern rule in Gnu make that will make e.g. file foo/XXX/XXX.o depend on file bar/XXX.c. That is, it "expands" to foo/abc/abc.o: bar/abc.c ... foo/def/def.o: bar/def.c ...
1
vote
1answer
53 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
156 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 ...
5
votes
1answer
9k 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 ...
2
votes
1answer
850 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
778 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 ...
4
votes
3answers
3k 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
74 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
721 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 ...---...
5
votes
0answers
1k 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
1k 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
983 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
65 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
946 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, ...
5
votes
2answers
3k 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
221 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
304 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 --...
10
votes
2answers
17k 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 ...
1
vote
1answer
2k 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
300 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
83 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, ...
41
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
462 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
6k 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
1k 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 $...
19
votes
3answers
12k 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
434 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
435 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
166 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 ...
1
vote
2answers
182 views

Check in bash if make has done something

I'm calling make from a bash script. Part of the rest of the script only needs to be executed if make actually did something (i.e. it doesn't say nothing to be done for...). How would I check on ...
2
votes
2answers
14k views

Why does make stop with “Makefile:6: *** multiple target patterns. Stop.”?

Goal I write my slides in a markdown file and compile it to reveal afterwards, uploading it to my webserver and do other things. I wanted to organise the steps after the markdown is written in a ...
2
votes
2answers
137 views

How to prevent Make from randomly overriding files?

Suppose I am in an empty directory. If I now create a Makefile containing nothing but all: randomFilename and an empty file called randomFilename.sh, then GNU Make will perform cat randomFilename.sh &...
1
vote
1answer
337 views

Latexmk, from Makefile, from bash script, from Cron - Latexmk not being executed

I have several Git repositories with LaTeX files that I want to have typeset automatically. The idea is to have a central bash script (run by a cronjob) that executes a bash script in every repository,...
2
votes
1answer
2k views

Percentage symbol in $(shell) in GNU Makefile dependency

I am aware of LatexMk, but can't install that on the machine where I want to run pdflatex, so I need to write a Makefile of which %.pdf files are targets that depend on %.tex and the *.tex files that %...
3
votes
2answers
1k views

Make target with two words

I'm using a Makefile to compile my Clean code. My Clean files have file names of the format *.icl and are compiled to binaries with the same name but without .icl. This is done with the rule: $(EXE): ...
3
votes
1answer
316 views

Is there a way to disable recursive make?

If I have a makefile I have to use that is using recursive make, is there an easy option to disable that? http://aegis.sourceforge.net/auug97.pdf
1
vote
1answer
474 views

'pkglibexecdir' is not a legitimate directory

I'm following some outdated instructions in an attempt to compile some proprietary, closed-source, unsupported, legacy code. Here is what a typical shell session looks like: $ autoreconf -fi src/...
3
votes
2answers
2k views

What is the order order-only prerequisites are processed in a GNU Make file?

I've been reading the documentation but it's still unclear to me how the order is processed. In the example: myrule: | myrule_step1 myrule_step2 @echo "$(@)" myrule_step1: @echo "$(@)" ...
2
votes
3answers
1k views

How to tell whether GNU make is being used in a makefile?

I know GNU Make is by far the most commonly used, but I'm looking for a way to verify that GNU Make is the actual make program that is being used. Is there a special variable I can print from within ...
1
vote
4answers
759 views

Using environment variables for shorter recipes in GNU Make

I would like recipes in GNU Make to use environment variables instead of command line arguments, to make them shorter, so that I can concentrate better on what changes in each command. For example, ...