Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to run some commands globally in a Gnu Make file
    primarykey
    data
    text
    <p>I have a gnu Makefile that collects version information through environment variables. Now, I want to do "something" globally before any target is built using the gnumake syntax. As pseudo code, this means:</p> <ul> <li>when a specified file exists, delete it</li> <li>run through an array of strings and put their value into a specified file</li> </ul> <p>I tried this:</p> <pre><code>$(shell if exist $(subst /,\,$(products)filenames.h) del /F/Q $(subst /,\,$(products)filenames.h)) $(foreach Item, $(EnvFilenames), @echo $(Item) &gt;&gt; $(subst /,\,$(products)filenames.h)) </code></pre> <p>this gives me an error:</p> <pre><code>C:\temp\Makefile.mak:72: *** missing separator. Stop. </code></pre> <p>where Line 72 is the <code>$(shell ...</code> line. If I put this in a <code>define</code> section:</p> <pre><code>define foobar $(shell if exist $(subst /,\,$(products)filenames.h) del /F/Q $(subst /,\,$(products)filenames.h)) $(foreach Item, $(EnvFilenames), @echo $(Item) &gt;&gt; $(subst /,\,$(products)filenames.h)) endef </code></pre> <p>and call this for a target, it runs fine:</p> <pre><code>$(products)$test.o : test.c $(commons) $(call foobar) $(cc) $(cflags_m) test.c -o$@ </code></pre> <p>and does what it should... but as soon as I want to call it from inside of another <code>define</code>, it fails again with a missing seperator.</p> <p>What does it mean and how can I fix it?</p> <p>Compilation takes place on a Win32 platform and does not have to be multi-platform.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload