Skip to contentSkip to conversation

makefiles: obj vs. objtree

DISCUSSION Randy Dunlap 2 participants 3 messages Feb 18, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

Can someone clarify the difference(s) in these variables, please?

Documentation/kbuild.txt says about objtree:

$(objtree) is the directory where output files are saved. The output directory is often set using "O=..." on the commandline.

Documentation/makefiles.txt says about obj:

    $(obj)
	$(obj) is a relative path which points to the directory
	where the target is saved. Always use $(obj) when
	referring to generated files.

These appear to be the same to me, but let me be more specific:

In some cases (or places), Documentation/DocBook/Makefile uses $(obj) and other cases/places, it uses $(objtree). Does it have these correct, or should some of them be fixed?

thanks,

Signature · 1 line
~Randy
#1 lore raw
Quoted 10 lines · Randy Dunlap

Can someone clarify the difference(s) in these variables, please?

Documentation/kbuild.txt says about objtree:

$(objtree) is the directory where output files are saved. The output directory is often set using "O=..." on the commandline.

Documentation/makefiles.txt says about obj:

Quoted 7 lines
    $(obj)
	$(obj) is a relative path which points to the directory
	where the target is saved. Always use $(obj) when
	referring to generated files.

These appear to be the same to me, but let me be more specific:

$(objtree) is the toplevel build directory (as the doc says the directory you specify with O=).
$(obj) is the directory below $(objtree) where the targets of the current Makefile are saved:

$ make O=/build/dir
$(objtree) == /build/dir
$(obj) == /build/dir/fs in fs/Makefile
Quoted 3 lines

In some cases (or places), Documentation/DocBook/Makefile uses $(obj) and other cases/places, it uses $(objtree). Does it have these correct, or should some of them be fixed?

$(objtree)/Documentation/DocBook could be written as $(obj) in Documentation/DocBook/Makefile.

hth,
Michal

#2 lore raw
Quoted 29 lines · Michal Marek
Quoted 10 lines · Randy Dunlap

Can someone clarify the difference(s) in these variables, please?

Documentation/kbuild.txt says about objtree:

$(objtree) is the directory where output files are saved. The output directory is often set using "O=..." on the commandline.

Documentation/makefiles.txt says about obj:

Quoted 7 lines
    $(obj)
	$(obj) is a relative path which points to the directory
	where the target is saved. Always use $(obj) when
	referring to generated files.

These appear to be the same to me, but let me be more specific:

$(objtree) is the toplevel build directory (as the doc says the directory you specify with O=).
$(obj) is the directory below $(objtree) where the targets of the current Makefile are saved:

$ make O=/build/dir
$(objtree) == /build/dir
$(obj) == /build/dir/fs in fs/Makefile
Quoted 8 lines
Quoted 3 lines

In some cases (or places), Documentation/DocBook/Makefile uses $(obj) and other cases/places, it uses $(objtree). Does it have these correct, or should some of them be fixed?

$(objtree)/Documentation/DocBook could be written as $(obj) in Documentation/DocBook/Makefile.

hth,

Yes, it does. I get it. Thanks.

Signature · 1 line
~Randy