Hi

I want to compile main.cpp with a macro value which is the output of a 
script I have in the same directory:

 g++ -g -O2 -DNDEBUG -I common --std=c++11 *-DCOMMIT_ID=`./get_commit_id`* 
-c main.cpp -o main.o 

I get this error:
1) [1.498s] build-release: g++ -g -O2 -DNDEBUG -I common --std=c++11 
-DCOMMIT_ID=`./get_commit_id` -c main.cpp -o main.o                         
                                                 
fatal: Not a git repository (or any parent up to mount point 
/home/noam/w/hprouter/src)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount point 
/home/noam/w/hprouter/src)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).


What is the correct way to run my script?

The script itself:
$ cat get_commit_id 
#!/bin/bash

COMMIT_ID=`git log -1 --oneline | cut -d\  -f 1`
if output=$(git status --porcelain | grep -v ??) && [ -z "$output" ]; then
# Working directory clean
COMMIT_ID+="clean"
else 
  # Uncommitted changes
  COMMIT_ID+="_dirty"
fi
echo $COMMIT_ID 

PS: I know there are other ways to get the commit id, but the question is 
more general as to accessing the file system during build

Thanks
Noam

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to