help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell for evaluating .SHELLFLAGS


From: h.becker
Subject: Re: Shell for evaluating .SHELLFLAGS
Date: Tue, 26 May 2015 19:01:12 +0200
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Icedove/31.0

I know nothing, but to me it looks like the OP is mixing SHELL features: '<(echo ".output $@")' doesn't look like a sqlite3 feature, it looks like Unix shell redirection.

What works is something like

$ cat sqlite3.ini
.output all
$ cat Makefile
SHELL=/usr/bin/sqlite3
# .SHELLFLAGS= $(DB)
.SHELLFLAGS=-init $(INI) $(DB)

DB=u.db
INI=sqlite3.ini

all:
        select * from radio;
$
$ make --debug=v
GNU Make 4.1
Built for x86_64-unknown-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
Updating goal targets....
Considering target file 'all'.
 File 'all' does not exist.
 Finished prerequisites of target file 'all'.
Must remake target 'all'.
select * from radio;
-- Loading resources from sqlite3.ini

Successfully remade target file 'all'.
$

On 05/26/2015 02:14 PM, Paul Smith wrote:
On Mon, 2015-05-25 at 21:05 -0700, Afif Elghraoui wrote:
Hello,
I am trying to use sqlite3 as my Makefile shell. In order to have the
query outputs go to a file, I need to pass a file in to sqlite using its
-i flag. I rely on the process substitution feature in bash for the
.SHELLFLAGS to provide the file:

SHELL=/usr/bin/env sqlite3
.SHELLFLAGS=-init <(echo ".output $@") $(DB)

I get this error:
/bin/sh: 1: Syntax error: "(" unexpected
Makefile:13: recipe for target 'fq' failed

It looks like .SHELLFLAGS is evaluated with /bin/sh regardless of what
SHELL is set to. Is there any way I could evaluate them with bash?

You're missing the main point: the values of SHELL and SHELLFLAGS aren't
being evaluated by /bin/sh, or bash... they're not being evaluated by
any shell at all!

The entire point of setting SHELL is you're choosing a shell that make
will invoke.  Make does not use a shell to start the shell that you
requested: it invokes the shell you requested directly (using the exec()
system calls).

The simplest way to do what you want is create a script (outside of
make) that will operate like this, then set SHELL in your makefile to
that script.  You can use #!/bin/bash at the top of that script to
request it be run in bash, if you like.


_______________________________________________
Help-make mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-make





reply via email to

[Prev in Thread] Current Thread [Next in Thread]