Problems with ALT_OUTPUTDIR in debug build

Kelly O'Hair Kelly.Ohair at Sun.COM
Thu Jan 10 17:18:28 UTC 2008



Volker Simonis wrote:
> Hi,
> 
> me again. I' found that the additional "-fastdebug" directories are
> created unconditionally by the top-level makefile, in the setup-step:
> 
> setup:
>         $(MKDIR) -p $(OUTPUTDIR)/j2sdk-image
>         $(MKDIR) -p $(ABS_OUTPUTDIR)/j2sdk-image
>         $(MKDIR) -p $(OUTPUTDIR)-fastdebug/j2sdk-image
>         $(MKDIR) -p $(ABS_OUTPUTDIR)-fastdebug/j2sdk-image
> 
> Is this really necessary?

Unfortunately yes. Unless we change some other makefile logic that isn't part
of the OpenJDK. I agree it's ugly, but there was a reason. It had something
to do with the Windows and those "short paths" and how the
short path changes if you 'rm -f -r outputdir ; mkdir outputdir' the original
path. The above fixed the problem.

Many of the ugly things in the makefiles were done to deal with Windows issues,
which I tried to bury in the Defs-windows.gmk files when I could.

> 
> Morever I found that I can create a debug build that honours the ALT_OUTPUTDIR
> setting and leaves me with only one bogus "-fastdebug" directory as follows:
> 
> make SKIP_DEBUG_BUILD=false SKIP_FASTDEBUG_BUILD=true DEBUG_NAME=debug
> ALT_OUTPUTDIR=/build/my_debug_build
> 
> This will create the following two directories in /build:
> 
> my_debug_build
> my_debug_build-fastdebug
> 
> and put all the stuff into "my_debug_build" as desired. After the
> build I can remove "my_debug_build-fastdebug" and be happy.
> 
> Any comments if this is the right way to do a debug build?

If it works it's fine. I usually just run 'make debug_build', does that not work?

-kto

> 
> Regards,
> Volker
> 
> 
> On 1/10/08, Volker Simonis <volker.simonis at gmail.com> wrote:
>> Hi,
>> there seems to be a problem with the handling of ALT_OUTPUTDIR for debug and
>> fastdebug builds. The top-level makefile contains the following definitions:
>>
>> Makefile
>> --------
>>
>> include $(JDK_MAKE_SHARED_DIR)/Defs-control.gmk
>>
>> COMMON_DEBUG_FLAGS= \
>>         DEBUG_NAME=$(DEBUG_NAME) \
>>         ALT_OUTPUTDIR=$(_OUTPUTDIR)-$(DEBUG_NAME) \
>>         NO_DOCS=true
>>
>> generic_debug_build:
>>         @$(ECHO) $@ build started: `$(DATE) '+%y-%m-%d %H:%M'`
>>         $(MAKE) $(COMMON_DEBUG_FLAGS) setup build
>>         @$(ECHO) $@ build finished: `$(DATE) '+%y-%m-%d %H:%M'`
>>
>>
>> As you can see, it always sets the value of ALT_OUTPUTDIR to
>> "$(_OUTPUTDIR)-$(DEBUG_NAME)" where _OUTPUTDIR is the default value of the
>> output directory which is defined in "jdk/make/common/shared/Defs-control.gmk"
>> as follows (i.e. "linux-i586" on x86/Linux):
>>
>> jdk/make/common/shared/Defs-control.gmk
>> ---------------------------------------
>> # Default output directory
>> _OUTPUTDIR=$(CONTROL_TOPDIR)/build/$(PLATFORM)-$(ARCH)
>>
>> Shouldn't COMMON_DEBUG_FLAGS use $(OUTPUTDIR) instead of $(_OUTPUTDIR) or
>> am I missing something.
>>
>>
>> It is also quite confusing that the build always creates
>> $(OUTPUTDIR)-fastdebug subdirectories, no matter if we do a fastdebug build or
>> not. I think that only the directories should be created which are used later
>> on for the build. If I do for example "make debug_build" without specifying
>> "ALT_OUTPUT_DIR", make will create four output directories as follows:
>>
>> linux-i586
>> linux-i586-debug
>> linux-i586-debug-fastdebug
>> linux-i586-fastdebug
>>
>> in the build directory, while the output only goes to "linux-i586-debug".
>> What are the "-fastdebug"-directories (especially
>> "linux-i586-debug-fastdebug") good for?
>>
>> If I do "make debug_build ALT_OUTPUTDIR=/build/xxx" the build creates:
>>
>> linux-i586-debug
>> linux-i586-debug-fastdebug
>> xxx
>> xxx-fastdebug
>>
>> but the output goes to "linux-i586-debug" as in the previous case.
>>
>> If we fix the top-level Makefile as suggested above, we'll get:
>>
>> xxx
>> xxx-debug
>> xxx-debug-fastdebug
>> xxx-fastdebug
>>
>> with all the output going to "xxx-debug". That seems much better, but
>> still we have three unused directories!
>>
>> In my eyes, the cleanest solution would be if ALT_OUTPUTDIR would be honoured
>> "as is", as the output directory for everything we built, without anything
>> appended to it. So the developer should be free to choose whatever he wants as
>> the output directory. And there should be no additional directories created.
>>
>> Regards,
>> Volker
>>



More information about the build-dev mailing list