0

so maybe i'm missing something here, but here's what i'm trying to do:

test.c: printf("HGID=%s\n", HGID);

build.sh: gcc test.c -o xxx -DHGID="\"$(hg id)\"" $HGID=12345678+ tip all is well.

now with build.sh: HGSTR="\"$(hg id)\"" gcc test.c -o xxx -DHGID="$HGSTR" still okay

but if i try to change build.sh to this: CFLAGS=-DHGID="\"$(hg id)\"" gcc test.c -o xxx $CFLAGS the madness starts... gcc: error: tip": No such file or directory how do i get a quoted string with spaces to gcc in this case?

jww
  • 97,681
  • 90
  • 411
  • 885
Piotr
  • 541
  • 4
  • 19
  • My instinct is to do this kind of thing with make rather than a shell (and if needed, invoke make from the shell script). Reading the duplicate link seems to reinforce that choice. – Chris Stratton Mar 26 '19 at 21:41
  • Please place answers in Answer blocks. Later, you can accept your own Answer. Also see [How does accepting an answer work?](https://meta.stackexchange.com/q/5234/173448) – jww Mar 27 '19 at 03:07

0 Answers0