mainmake - Support: sr #105552, (include subdir/Makefile) extra...


You are not allowed to post comments on this tracker with your current authentication level.

sr #105552: (include subdir/Makefile) extra option to change directory. This option is hopefully much better than recursive make.

Submitter:  None
Submitted:  Sat 09 Sep 2006 04:04:45 PM UTC
Category:  None Priority:  5 - Normal
Severity:  1 - Wish Status:  None
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  Any

Mon 11 Sep 2006 09:33:18 AM UTC, comment #2: 

sr #105552
I have done some thinking and experimenting and come up with "included targets".

All targets in the included targets are built using the rules from the file that the target was included from. The dependency tree is built using all rules.
Implicit rule that automatically try to use the makefile to build the target using the makefile in the targets directory would be great (it actually does exactly this for the current directory and it has an alghoritm for rule search).

Extra comments:
I use to think of the Makefile as a way to express dependencies and rules how to update them.
I have seen that using variables and repeat the build rule is very common I prefer using implicit rules because the dependencies become clearer.

I currently use a method there i add the directory to all Makefiles.

It requires discipline (easy to make errors) and extra writing and is hard to read and if I want to include targets from another makefile I have to use recursive make (considered harmful because it doesn't build the whole dependency tree).

The file can never know from which directory it will be included using the current directory as a starting point seems like a very good idea.

Everything that is incuded is global. Targets in the included file could work different if it's inlcuded than run alone.

Sat 09 Sep 2006 05:49:28 PM UTC, comment #1: 

I agree that recursive make has some serious issues.  However, I don't see how your suggestion would work in practice.  First, make could only modify target and prerequisite names; any filenames that were contained in command scripts could not be modified.  Although a well-written makefile will use automatic variables for most of the file references, there are those that don't which could be confusing.

Also, blindly adding a path prefix to EVERY target and EVERY prerequisite doesn't seem like a good idea to me; there are all sorts of reasons why you might not want the pathname (maybe you're putting the objects in a different directory or similar).

Finally, I don't think it's too difficult to prefix files with a variable which can be empty if you're doing a local build, or non-empty otherwise.  It does take some discipline but I just don't think the alternatives work well enough to justify the confusion of using them.

If you have a specific, detailed description of exactly how you envision this working, please provide it and we can discuss.


Paul D. Smith <psmith>
Group administrator
Sat 09 Sep 2006 04:04:45 PM UTC, original submission:  

(include subdir/Makefile) extra option to change directory or new command.
I have tried to use "include dir/Makefile" instead of recursive make and it works great but i have to have add dir to all files in in dir/Makefile.
I think it will be good if it's also possible (maybe default) to include only the specified target(s) in dir/Makefile because Quite often it's only the generated foo.o file that are needed and the other targets could create a mess especially if they contains wildcards. It's important that no changes have to be made to dir/Makefile.

Different examples how it could work:
include -d dir Makefile (change to subdir include Makefile, if include all rules could get messy)

import subdir/target (include target (wildcard,target(s))??? defaults to makefile in subdir but possible to specify file with -f) This one feels good!!!

import -f subbdir/ (don't know exactly how this should work)

Vhy recursive make are considered harmful:



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


Follows 1 latest change.

Date Changed by Updated Field Previous Value => Replaced by
2006-09-09 None Carbon-Copy- Added -ej tillgänglig-

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code