~amavect/mkexercises

b1d56fda5b1e9fae6662b2566ec832ad2430c891 — glenda 3 years ago 8a8285b master
update problem 01
1 files changed, 8 insertions(+), 5 deletions(-)

M basics/01/mkfile
M basics/01/mkfile => basics/01/mkfile +8 -5
@@ 9,8 9,11 @@ meow: kitty
kitty:
	echo 'first line' >kitty

# Entering 'mk newfile' in the command shell will first generate 'original'.
# Then, 'original' will then be used to create the newfile.
# Notice how the build recipe uses 'kitty' to create 'meow'.
# A mkfile must capture this behavior in order to work correctly.
# Entering `mk meow` in the command shell will first generate 'kitty'.
# Then, 'meow' will be generated.

# It is also possible to specify multiple dependencies, separated by spaces:

purr: kitty meow


@@ 21,13 24,13 @@ purr: kitty meow



# Run 'mk cats'
# Run `mk cats`

# Now, run 'mk cats' again. Why is 'cats' remade again?
# Now, run `mk cats` again. Why is 'cats' remade again?
# 'cats' and the dependent files were made so quickly that they have the
#  same time stamp. mk stays on the safe side and calls the targets out of date.
# The only fix to this is to have finer-grained time stamps.
# Calling 'mk cats' multiple times reaches a point that 'cats' isn't remade.
# Calling `mk cats` multiple times reaches a point that 'cats' isn't remade.
# It is good practice to create mkfiles that are:
# * time-independent - Don't depend on sub-second time to generate data.
# * deterministic - Do the same thing with the same files.