Hello,
How to pass arguments to make thru command line? Have read this and that threads, but still not clear. My customized Makefile as:
What I intend is to run like this:
to pass the "infile_path" and "outfile_path" to my bash_script.sh.
How to accomplish this?
Thanks a lot!
Last edited by yifangt; 02-28-2014 at 05:09 PM..
Reason: expression not accurate
One step further, how to let make accept some clues like:
It seems quite common to see makefile accept some argument as
The advantage for this format is the order of the argument will not matter, and the -- format can provide some clues on the parameters to be passed.
Got lost with most online makefile tutorials, especially with those automatic variables $@, $<, $|, $* and $? etc. Before coming to those tricks I feel should catch the straight-forward format first. Thank you again!
It seems quite common to see makefile accept some argument as
You're thinking of configure scripts - they take a --prefix argument, makefiles don't.
Quote:
Originally Posted by yifangt
The advantage for this format is the order of the argument will not matter, and the -- format can provide some clues on the parameters to be passed.
Order of arguments with "make val=arg" doesn't matter either, and I don't know what you mean by the format providing clues on the parameters to be passed - give the variables in your makefile sensible names, and they'll make sense.
Also, this helps distinguish between arguments to your makefile (look like val=arg) and arguments to the make program itself (look like --val=arg), so it's clearer where it's being used. Also, they can be set from the environment variable - i.e. if a user knows they always want PHRASE to be "hi", they can just do:
and they'll not have to pass it to your makefile.
Bottom line: This is how you pass arguments to makefiles. You cannot do it --this-way.
This User Gave Thanks to JohnGraham For This Post:
I took it for an example of what I was trying:
OK, I got the point now, the -- does not matter too much if the arguments can be set as phrase=hi, kmer=24, gmer=something would be good enough. I am aware of the configure options, which I should have looked into deeper to have more idea. Thank you very much again!
I have a makefile and want to allow passing -01 -02 -03 for the user to define
the level of optimization he wants. Doing this gets make to send an error.
make -03
make: invalid option -- '0'
make: invalid option -- '3'
Usage: make ... (5 Replies)
Hi,
I want to run a target of makfile using script by passing different arguments to it again n again. I i need to grep certain things from the log file.
eg
make abc KAB=8 BAC=8 >& KAB_BAC.log
grep "timeA" KAB_BAC.log
grep "timeB" KAB_BAC.log
(i want to store the difference of the two time... (0 Replies)
Hi,
i have a file.txt with data
Bangalore
Chennai
Hyd
filename of the script is: new.sh
result=`cat file.txt | grep $1`
if
then
echo pass
else
echo fail
fi
i am executing the file in the cmd line as "sh new.sh Bangalore"
o/p is pass
if i give "sh new.sh delhi"
o/p is... (6 Replies)
I have an for loop that reads the following file
cat param.cfg
val1:env1:opt1
val2:env2:opt2
val3:env3:opt3
val4:env4:opt4
.
.
The for loop extracts the each line of the file so that at any one point, the value of i is
val1:env1:opt1 etc...
I would like to extract each... (19 Replies)
I need to pass arguments to a shell script.My batch is calling some java program.
#################
x=$1
y=$2
java -classpath program
###################
if first parameter and second parameter is null then
java -classpath program
if first parameter is not null and second parameter is... (3 Replies)
Hi
I have a script to which I pass multiple arguments, for example lets say the script name is "abc". I run the script like
./abc def /file <directory location>
In the above "def" is the first argument and "/file" is the second argument. I expect <directory location> that is passed after... (4 Replies)
Hi,
I have a script which adds the user credentials to an ldap server. Im passing the variables as below..
/path/my_script $uname $pwd $environ ${deposit}
If i enter some special characters like ';' in $pwd, script returns an error which is set to display if the user enters... (5 Replies)
Hi,
How to pass parameter to makefile?
Please let me know if any one knows and also please put an example of makefile with this feature.
thanks,
Manju. (3 Replies)
I've written a script (bgrep) for a more advanced grep command (& attached a cut down version below). I'm trying allow all grep options to be used, or in any combination.
The script works fine if I type say
bgrep -i -files product
it will return a non-case sensitive list of matches for... (3 Replies)
I'm trying to pass a filename, or all the files in the current directory to the ls command with a script. Unsuccessful so far, here are a few of my attempts:
#!/bin/ksh
read fname
#if (( $# > 0 )); then
$fname | ls -l
#fi
this produces a long listing of all the files in my current... (4 Replies)