3 ms·
Cause sometimes you need your tasks to have, you know, logic and stuff ? Or am I the only one who want to do the equivalent of a "if" in a build script from tim
by phtrivier 15y ago
Cause sometimes you need your tasks to have, you know, logic and stuff ? Or am I the only one who want to do the equivalent of a "if" in a build script from times to times, and feel completely helpless with Make ?
- endlessvoid94 15y agohttp://sunsite.ualberta.ca/Documentation/Gnu/make-3.79/html_chapter/make_7.html http://sunsite.ualberta.ca/Documentation/Gnu/make-3.79/html_...
- phtrivier 15y agoThanks. Did not knew about this (I should have pointed that I haven't been using Makefiles for a while). However : "Conditionals control what make actually "sees" in the makefile, so they cannot be used to control shell commands at the time of execution." (emphasis mine). So I get that is would not solve the kind of issues I had in mind... Never mind.
- snprbob86 15y agoYou're not supposed to put significant logic in a makefile. You've already got tons of tools for real logic. A makefile is a dependency graph. If statements are for defining slightly different graphs in slightly different environments. If you need to add real logic, write a shell script. A well written Makefile has a small preamble of variable definitions, followed by a couple of named convenience .PHONY targets (without any commands), followed by a small handful of pattern rules, followed by the dependency graph. Each edge in the dependency graph should include as few commands as possible, preferably just one!