Hi,
Can any one out there please help me. I'm desperate for a solution.
Problem:
t1 and t2 are 2 tools to be connected in series.
T1 takes in an input file and produces an output
T2 takes t1's input and produces an output
Assume:
t1 and t2 do the flollowing
t1 -i <input_file_to_reverse> -o <output_file_reversed>
t2 -i <reversed_file> -o <decoded_file>
Assume also
an <expected_output_file_reversed> exists.
A diff script exists that will be invoked after t1 runs
that is
diff -i1 <output_file_reversed> -i2 <expected_output_file_reversed>
-o<diff_file>
if the files are identical diff returns 0
else it returns 23
Now t1, the diff script and t2 have to be run in series.
t2's input should be t1's output if diff returns 0
or
t2's input is the expected_output_file if diff returns 23.
Consider further if this has to be done using a makefile (only).
#makefile:
########################### macros ###############################
t1_expected_output=expected_reversed_data.dat
t1_input_file=input.dat
t1_output_file=reversed_output.dat
t2_input_file=$(t1_output_file)
t2_output_file=decoded_file.dat
########################### end macros ###############################
$(t2_output_file) : $(t2_input_file) diff_file.dat
t2 -i $(t2_input_file) -o $(t2_output_file);
diff_file.dat : $(t1_output_file) $(t1_expected_output)
diff -i1 $(output_file_reversed) -i2
$(expected_output_file_reversed)
#
# what i need is to check the return status of diff and then proceed.
#
# return = diff -i1 <output_file_reversed> -i2
<expected_output_file_reversed> -o <diff_file>
# if test $return -ne 0
# then
# t2_input_file=t1_expected_output
# fi
# How do i check return values and branch off appropriately?
#
#
$(t1_expected_output) $(t1_input_file):
echo dummy;
$(t1_output_file) : $(t1_input_file)
t1 -i $(t1_input_file) -o $(t1_output_file);
Question:
# How do i check return values and branch off appropriately in
makefiles?
# How can I Change macro values based on execution of tools?
If there is no support in makefile for doing this? is there any
workaround for my problem?
thanks in advance.
regards
linus
Please reply to
Sent via Deja.com http://www.deja.com/
Before you buy.