5. make - recipes

make

recipes describe how to build a specific target. In general, shell programming can be used (bash on *IX machines). Furthermore, full programms can be executed which then can read files and built a target file.

ra.txt:
	 echo 123g.2345 > ra.txt
de.txt:
	 echo -54.8765 > de.txt
pipe: ra.txt de.txt
	 python pipe.py

Here the first targets write ra and de into two different files.Then a python script merges them to a proper position and writes the result into the file position.csv.

pipe.py:

import string
def make_position():
  a = open('ra.txt', 'r')
  b = open('de.txt', 'r')
  ra = a.readline().rstrip(string.whitespace)
  de = b.readline().rstrip(string.whitespace)
  return ra + ' , ' + de
if __name__=="__main__":
  print make_position()
  f=open('position.csv', 'w')
  f.write(make_position())

Line breaks:

Some commands are executed with a few arguments. This can make recipes a littly messy. For increased readability, line breakscan be inserted but must be escaped with a [.


Hendrik Heinl

Copyright Notice