Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

makefile: ignore dependency when running target

I have this setup in my Makefile.

action1:
  does something

action2: action1
  does something else

I want to keep my configuration in case I want to use action1 as a dependency for action2, but sometimes I'd like to ignore action1 when running make action2 (e.g. I'd like to run make action2 without having to include action1). Can I setup some kind of flag to pass in to ignore the dependency when running target and how can I go about doing that?

like image 892
user3226932 Avatar asked Dec 13 '22 16:12

user3226932


1 Answers

make -o <name of dependency> lets you ignore a dependency and all its implications. From the man page:

-o file, --old-file=file, --assume-old=file
     Do not  remake the file file  even if it is  older than
     its dependencies, and do not remake anything on account
     of changes in file.  Essentially the file is treated as
    very old and its rules are ignored.
like image 194
Jeffrey Benjamin Brown Avatar answered Jan 02 '23 13:01

Jeffrey Benjamin Brown