Passing jobserver file descriptors to all children

2020-02-19 Thread R. Diez
Hi all: I am trying to use GCC's -flto=jobserver flag, but I cannot easily add the '+' character in front of the makefile recipe with Autoconf/Automake. See here for more details: https://gcc.gnu.org/ml/gcc-help/2020-02/msg00069.html The jobserver used to be a GNU Make-specific feature, but o

Re: Passing jobserver file descriptors to all children

2020-02-24 Thread R. Diez
> [...] Originally make did pass these file descriptors to all children, but there were bugs filed because some tools invoked by make expected to have specific file descriptors available; having make pass down open FDs caused them to fail. Relying on specific file descriptor numbers is asking

warning: type of ‘error’ does not match original declaration

2020-03-09 Thread R. Diez
Hi all: I am building GNU Make 4.3 with LTO, with the following commands: mkdir /home/rdiez/rdiez/temp/make-4.3/make-4.3-obj cd/home/rdiez/rdiez/temp/make-4.3/make-4.3-obj ../make-4.3-src/configure CFLAGS="-g3 -O3 -march=native -flto" --prefix="/home/rdiez/rdiez/make-4.3-bin" make --outp

Evaluating a variable only once after a recipe has run

2020-04-18 Thread R. Diez
Hi all: I am investigating the OpenWrt build system, which is a big, complex makefile. I recently came across the following definition in this file: https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=toolchain/musl/Makefile;h=2b9312bcbf123c03cf8947c52044557e27377e79;hb=HEAD MUSL_MAKEOPTS

Flag --no-builtin-rules etc. just for this makefile (no flag inheritance)

2020-04-18 Thread R. Diez
Hi all: Over the years, I have become used to specifying the following flags when running makefiles: 1) --no-builtin-variables or manually-written makefiles. That flag also disables all implicit rules. The reasons are: a) Makefiles run much faster if they do not have to check implicit rules

Re: Evaluating a variable only once after a recipe has run

2020-04-18 Thread R. Diez
First of all, thanks for the quick response. That's typically the job of a configure script. A configure script can rely on special targets in the Makefile for doing some of its probing. It deposits its results in an include makefile like "config.make". I am afraid that this does not really cu

Re: Evaluating a variable only once after a recipe has run

2020-04-18 Thread R. Diez
> You may find this trick from my blog to be helpful: > > http://make.mad-scientist.net/deferred-simple-variable-expansion/ Many thanks, that is exactly what I was looking for!

Re: Flag --no-builtin-rules etc. just for this makefile (no flag inheritance)

2020-04-18 Thread R. Diez
MAKEFLAGS is actually the solution. You can *add* to it and the flags take effect. Thanks for the trick. Unfortunately, the filtering is still a big issue in practice. If you take a look at OpenWrt's makefile, you will see that it is a huge beast with many contributors. The same is true fo

Re: Evaluating a variable only once after a recipe has run

2020-04-18 Thread R. Diez
> You may find this trick from my blog to be helpful: > >> > http://make.mad-scientist.net/deferred-simple-variable-expansion/ Would it be possible to encapsulate it somehow, so that other people immediately know what is going on? I mean something like this: # This definition does this be

Re: Evaluating a variable only once after a recipe has run

2020-04-18 Thread R. Diez
I don't see why not. Do you think there is some reason it wouldn't be possible? Hahaha. I was obviously trying to get you to write it. Well, maybe just the code, I can write the comments myself... O8-) You know, it's rather tricky stuff, I did not quite understand the escaping issue, you a

Re: Evaluating a variable only once after a recipe has run

2020-04-19 Thread R. Diez
> Oh. Well, you should just ask :) Many thanks, you are a star. ;-) > [...] > Deferred = $1 = $$(eval $1 := (shell $2))$$($1) Is there a way to allow variable number of arguments? This is so that all of the following work: $(eval $(call Deferred,OUTPUT,some-command)) $(eval $(call

Re: Flag --no-builtin-rules etc. just for this makefile (no flag inheritance)

2020-04-19 Thread R. Diez
> You do have to keep filtering that out for sub-makes, though. > > Another idea is: instead of filtering MAKEFLAGS, save it > and restore it: > > SAVED_MAKEFLAGS := $(MAKEFLAGS) > > Then in recursive recipes do MAKEFLAGS=$(SAVED_MAKEFLAGS) or whatever. I tried to implement your suggestion,

Re: Flag --no-builtin-rules etc. just for this makefile (no flag inheritance)

2020-04-20 Thread R. Diez
Hallo Paul: I have been investigating Kaz Kylheku's suggestion about adding flags to MAKEFLAGS inside the makefile. I believe that adding --no-builtin-variables has no effect. It is probably too late to do that inside the makefile. That means that option '--no-builtin-rules' does not get auto

Re: Flag --no-builtin-rules etc. just for this makefile (no flag inheritance)

2020-04-20 Thread R. Diez
It can be verified with a minimal Makefile that "make --print-data-base" shows an absence of built-in rules if MAKEFLAGS += --no-builtin-rules is present, and likewise that --no-builtin-variables causes the variables to disappear. > [...] Well, let's verify it then: Contents of file "makefil

How to detect spaces in paths

2021-12-15 Thread R. Diez
Hi all: I have written a makefile that accepts a directory path from outside like this: make SOME_PATH=/my/path all I keep forgetting that GNU Make does not support spaces inside filenames, so I wanted to check in the makefile that the given path has no spaces. This is what I came up with:

Re: How to detect spaces in paths

2021-12-15 Thread R. Diez
I think if $(words $(PATH_TO_CHECK)) is 1, then it's OK and if it's >1 then it contains whitespace. > [...] Brilliant, thanks for the trick!

Re: How to detect spaces in paths

2021-12-15 Thread R. Diez
Should handle empty vars: $(if $(filter-out 1,$(words "$(PATH_TO_CHECK)")),$(error spaces found)) That's a good trick, but I wouldn't use the double-quote character (") for that purpose, because it is misleading, as its meaning is overloaded in the shell etc. I would add some normal text

Feature request for --error-undefined-variables

2023-10-16 Thread R. Diez
Hi all: Makefiles can become complex beasts, and option "--warn-undefined-variables" helps find programming errors. Unfortunately, makefiles also tend to generate a lot of text, and therefore such warnings can be easily missed. This reduces the usefulness of "--warn-undefined-variables" to a g