1

I want to have 'modules' in my build system, folders that are compiled conditionally.

They would just contain a Makefile.include files which in the most basic case should only contain

include $(BASEDIR)/Makefile.module

Makefile.module would then add the include/ directory of the modules to the include path as well as add the directory to VPATH and if not specified differently, would add all *.c files in the folder as *.o targets.

Now in order to do this I need to get the path of the Makefile.module in Makefile.module that included Makefile.module.

How would I do that? I know I can get the path of the current Makefile by retrieving the last element from $(MAKEFILE_LIST) with lastword - but how would I get the second-last element?

user1273684
  • 1,559
  • 15
  • 24

0 Answers0