Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So can that be solved like this, or is there some other subtlety I'm missing?

  foo: baz
    compile $< -o foo -o bar

  bar: foo
(Can someone tell me how to do code tags on HN please? :) Edit: fixed now, thanks!)


> Text after a blank line that is indented by two or more spaces is reproduced verbatim. (This is intended for code.)

(from https://news.ycombinator.com/formatdoc)


Among other things, now you have to maintain a set of dummy targets. If you have a variable (possibly generated) that is basically

  A_MESS_OF_FILES := foo bar zot
You now have to create dummy targets for bar, baz, and zot and not forget to add them. Or maybe break it into

  MAIN_FILE := foo
  SUBORDINATE_FILES := bar zot

  foo: baz
    sudo make me a foo

  $(SUBORDINATE_FILES): %: foo


Subtlety. Now the dependencies are `baz` -> `foo` -> `bar`, that is `foo` is a temporary target and won't be (re)build if `bar` already exists. Which may or may not be a problem. This temporary target (whatever the actual term is) can be "elevated" to a "normal" target with the use of some special target (which I'm too lazy to look up right now).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: