Make Concept thoughts

Merge makefiles with IDE project files

All IDEs have project files hierarchy like .vcproj in Visual Studio. The same thing is in Makefile world: all make-based source trees have Makefile hierarchy. There is functionality in IDEs to generate makefiles and some make-systems in turn have functionality to convert their makefiles into IDE project files. The example is CMake that can convert its makefiles to Visual Studio project files and Visual Studio can create MS Nmake makefiles.

The two hierarchies are separate and it is not convenient:
  • No single version of Makefile/Project files in source code repository
  • No way to modify a Makefile easily and affect both Makesystem and IDE settings
  • IDE project files are hardly merged in version control systems
Developer should alway choose to have IDE-based development or command line based development.

But what if we merge Makefile and IDE project files hierachy? To do this we get Makefile hierarchy because makefiles are usualy human readable in comparison with IDE project files. Then we learn IDE to read makefiles as if they are project files. IDE should read it and seek for definite variables that it recognizes. For example CPPS variable in Makefile contains .cpp files in some directory that IDE shows in its user interface as source file list.

The problem for all Make tools is that they provide only tools, not engines. The goal for Fastmake is to provide Make engine as a library. It can be linked freely to any IDE program. Library interface allows to load Makefile and query any variable or run any target.

This can greatly simplify Makesystem+IDE friendship.

Pattern rules vs. alternatives

In standart make pattern rules and alternative functionality is mixed. For example
%.o : %.cpp
%.o : %.c
are the alternatives to make .o files from .cpp or .c files.

But what if we want to have alternatives for explicit targets. For example
a.obj : a.cpp ;
a.obj : a.c ;
We cannot do this because standart make does not have alternative functionality for explicit targets.

And what if we want to have a pattern rule just to have a pattern which is not the alternative:
%.dir :; cd $* ; make # (this is cd to % and run make)
We also cannot do this because standart make treat each pattern rule as an alternative and process them differently from non-alternate explicit rules. To understand this you can analyze the output of the following two pieces of code by GNU make:
a:b.o;
%.o:c; # pattern rule
a:b.o;
b.o:c; # explicit rule
GNU make does not report an error for pattern targets because it does not know for what alternative to report an error. This makes harder for the user to understand an error for pattern targets.

The decision of this problem could be extending syntax which splits alternative and pattern functionality.