Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
12 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
25 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
61 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 ...
4
votes
1answer
3k 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 ...
1
vote
1answer
276 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
446 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
1k 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
653 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
48 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
527 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
1k 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 ...---...
3
votes
0answers
731 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 (do not work). Is there a tool to visualize the Directed Acylic Graphs (...
0
votes
2answers
909 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
608 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
42 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
633 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, ...
3
votes
2answers
2k 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
195 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
270 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 --...
8
votes
2answers
10k 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
155 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
48 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
268 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
2answers
4k 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
903 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 $...
17
votes
3answers
8k 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
364 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/...
0
votes
1answer
322 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
149 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
142 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 ...
1
vote
2answers
11k 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
121 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
302 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
276 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
399 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
1k 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 "$(@)" ...
1
vote
3answers
547 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
600 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, ...
3
votes
1answer
1k views

GNU Make does not ignore failed command

I have written a rule where a directory should be removed if it exists: .PHONY: distclean distclean: -rmdir release make distclean prints: rmdir release rmdir: failed to remove ‘release’: No ...
0
votes
1answer
331 views

Why gmake fails if vpath points to current directory

Why this doesn't work? If I remove VPATH or set it to '.' - all fine. Empty dir, a.cpp, b.cpp exist before running. VPATH=./. dir/lib.a: dir/a.o dir/b.o touch $@ x: touch x dir/%.o: ...
3
votes
1answer
2k views

Target-specific make variables

How can I force a target-specific variable to be set immediately (line 2)? I want the output of make to be release and make debug to be debug. X = release debug: X = debug debug: all # the rest is ...
20
votes
3answers
36k views

Don't stop make'ing if a command fails, but check exit status

I am trying to instruct GNU Make 3.81 to not stop if a command fails (so I prefix the command with -) but I also want to check the exit status on the next command and print a more informative message. ...
1
vote
0answers
221 views

How to compile dcp2icc?

After trying for hours I am unable to compile dcp2icc-0.1 on Linux. With a simple Makefile added to the original code it fails as follows: g++ -o build/XMP/source/XMPCore/ExpatAdapter.o -c -O2 -...
9
votes
1answer
1k views

Restricting GNU‑Make to POSIX Make behaviour

Is there a known way to make Linux's make reject unintended use of GNU‑Make specific extensions in Makefile when editing or using other's Makefile in Linux? I mean, restricting GNU‑Make to behave as ...
3
votes
1answer
2k views

What does make[number] mean in make V=s?

When I enable make V=s to read the full log of make. I always see make[numer] in the log. e.g: datle@debian:~/workspace/cpx/trunk$ make rm -rf openwrt/tmp cp config/defaut.config openwrt/.config cd ...
7
votes
4answers
602 views

How can I get gmake to give me a list of all included makefiles?

I've inherited a major mess of a makefile network that was itself inherited from another project, with makefiles included all over the place. I'm trying to make a simple change without gutting the ...