Merge ~epics-core/epics-base/+git/fixups:makedebug into ~epics-core/epics-base/+git/epics-base:core/master
Status: | Rejected |
---|---|
Rejected by: | Andrew Johnson |
Proposed branch: | ~epics-core/epics-base/+git/fixups:makedebug |
Merge into: | ~epics-core/epics-base/+git/epics-base:core/master |
Diff against target: |
86 lines (+42/-0) 4 files modified
configure/CONFIG (+7/-0) configure/RULES_ARCHS (+1/-0) configure/RULES_BUILD (+15/-0) configure/RULES_TOP (+19/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Johnson | Needs Fixing | ||
Review via email: mp+333987@code.launchpad.net |
Description of the change
Add a makefile target "debug" to print some information useful when troubleshooting build problems. Not intended to replace 'remake -p', but rather a simpler first line tool.
Gives different output when run in TOP vs. other source directories. Not recursive (this gives a lot of redundant output).
Example output from TOP
> $ make debug
> Select variables:
> CROSS_COMPILER_
> SHARED_LIBRARIES = YES
> STATIC_BUILD = NO
> HOST_OPT = YES
> CROSS_OPT = YES
> USE_POSIX_
> LINKER_USE_RPATH = YES
> INSTALL_LOCATION = .
> Makefiles used in /home/mdavidsav
> Makefile
> configure/CONFIG
> configure/RELEASE
> configure/
> /home/mdavidsav
...
> Module search path: (relative to /home/mdavidsav
> DEVLIB2 = ./../devlib2
> EPICS_BASE = /home/mdavidsav
> Run 'make -C someApp/src debug' for more detailed information
On typing 'make debug' I would not expect the build system to just print a load of internal variables and their values, some of which could be confusing to naive users.
Let's start with the target name. The top result to a Google search for "make debug" (with quotes) is a Stack-Overflow question whose answer shows how to get a Makefile to construct a debug build of their project instead of a regular build — that's what I would expect it to do too. A target named more like 'show-config' or 'show-config-vars' would at least describe what this is trying to do. Also the title "Select variables" implies I can choose which ones are printed; "Selected" would be a better word in this case.
The changes to implement this are scattered about the build system; I would prefer to have the definitions in the same file as the rules that use them (and have duplicates where necessary). I would also suggest separating out the Makefile list into a separate command (make show-makefiles perhaps). Here's an alternative rule for that:
#------ ------- ------- ------- ------- ------- ------- ------- --
# These rules show the set of Makefiles, config files and
# rules files loaded by GNUmake.
SHOW_MAKEFILES = $(MAKEFILE_ LIST:%= show-makefile. %) makefile. %=%)"
show-makefiles: $(SHOW_MAKEFILES)
$(SHOW_MAKEFILES): show-makefile.%:
@echo " $(@:show-
.PHONY: show-makefiles show-makefile.%
Unfortunately the values of many of the variables you're showing can (and sometimes will) be different once GNUmake gets down into an O.<target> build directory. Contrary to the text displayed by the debug-top rule src directories won't show the ultimate values, you must be in an actual build directory to see the values for a particular target. For example:
tux% make PRINT.COMMANDLI NE_LIBRARY NE_LIBRARY O.linux- x86_64 -s PRINT.COMMANDLI NE_LIBRARY O.RTEMS- uC5282 -s PRINT.COMMANDLI NE_LIBRARY
COMMANDLINE_LIBRARY = ''
tux% make -C src/tools -s PRINT.COMMANDLI
COMMANDLINE_LIBRARY = ''
tux% make -C src/tools/
COMMANDLINE_LIBRARY = 'READLINE_NCURSES'
tux% make -C src/tools/
COMMANDLINE_LIBRARY = 'READLINE'
For demonstration purposes I used a variable you don't print, but any of the ones you do print may be similarly overridden in one of the configure/ os/CONFIG_ SITE.*. * files. There is no fix for this, I just worry that providing a show-config target would point users down the wrong path when they're trying to debug a build problem.
The rules for the PRINT.<varname> targets that I use above are not included in Base, but could be added (I use them quite a bit). I define them in my $HOME/configure /RULES_ USER file:
#------ ------- ------- ------- ------- ------- ------- ------- --
# These rules support printing a Makefile variable values.
# Many variables are only set inside an O.<arch> build directory.
# make PRINT.T_A
PRINT_Var = $(@:PRINT.%=%)
PRINT.%:
@echo "$(PRINT_Var) = '$($(PRINT_Var))'"
.PHONY: PRINT PRINT.%