Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we include another Makefile in a GNU Makefile by using the relative path?

Tags:

makefile

gnu

I have a Makefile in:

project/all_app/myapp/src/Makefile

I also have a master Depend.mk in

project/Depend.mk

Can I include the main Makefile by using the relative path?

include ../../../../Depend.mk
like image 328
un33k Avatar asked Aug 25 '09 11:08

un33k


People also ask

Can a makefile recursively call another makefile?

The command section of a makefile rule may recursively call "make". We can use this to organize a multipart project, or set of projects, into a set of subdirectories which each have their own makefile.

How do you call a makefile in makefile?

Normally you should call your makefile either makefile or Makefile . (We recommend Makefile because it appears prominently near the beginning of a directory listing, right near other important files such as README .) The first name checked, GNUmakefile , is not recommended for most makefiles.

What is $@ and in makefile?

From make manpage: $@ is: The file name of the target of the rule. If the target is an archive member, then '$@' is the name of the archive file. In a pattern rule that has multiple targets (see Introduction to Pattern Rules), '$@' is the name of whichever target caused the rule's recipe to be run.

How do I use IFEQ in makefile?

The ifeq directive begins the conditional, and specifies the condition. It contains two arguments, separated by a comma and surrounded by parentheses. Variable substitution is performed on both arguments and then they are compared.


1 Answers

Be warned that make's include starts at pwd, not the path to the Makefile. (so make -f will probably cause problems)

like image 61
jrr Avatar answered Oct 22 '22 12:10

jrr