Merge ~epics-core/epics-base/+git/fixups:makedebug into ~epics-core/epics-base/+git/epics-base:core/master

Proposed by mdavidsaver
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)
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_TARGET_ARCHS = linux-x86_64-debug RTEMS-mvme3100
> SHARED_LIBRARIES = YES
> STATIC_BUILD = NO
> HOST_OPT = YES
> CROSS_OPT = YES
> USE_POSIX_THREAD_PRIORITY_SCHEDULING = YES
> LINKER_USE_RPATH = YES
> INSTALL_LOCATION = .
> Makefiles used in /home/mdavidsaver/work/timing/mrfioc2:
> Makefile
> configure/CONFIG
> configure/RELEASE
> configure/RELEASE.local
> /home/mdavidsaver/work/epics/base-git/configure/CONFIG
...
> Module search path: (relative to /home/mdavidsaver/work/timing/mrfioc2)
> DEVLIB2 = ./../devlib2
> EPICS_BASE = /home/mdavidsaver/work/epics/base-git
> Run 'make -C someApp/src debug' for more detailed information

To post a comment you must log in.
e1cafb7... by mdavidsaver

minor

Revision history for this message
Andrew Johnson (anj) wrote :

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.%)
show-makefiles: $(SHOW_MAKEFILES)
$(SHOW_MAKEFILES): show-makefile.%:
 @echo " $(@:show-makefile.%=%)"

.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.COMMANDLINE_LIBRARY
COMMANDLINE_LIBRARY = ''
tux% make -C src/tools -s PRINT.COMMANDLINE_LIBRARY
COMMANDLINE_LIBRARY = ''
tux% make -C src/tools/O.linux-x86_64 -s PRINT.COMMANDLINE_LIBRARY
COMMANDLINE_LIBRARY = 'READLINE_NCURSES'
tux% make -C src/tools/O.RTEMS-uC5282 -s PRINT.COMMANDLINE_LIBRARY
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.%

review: Needs Fixing
Revision history for this message
Andrew Johnson (anj) wrote :

Core Meeting: There should be a top-level make target in RULES_TOP that prints various configuration variables to help finding user configuration problems. The PRINT rule and show-makefiles rule should be added.

However the content of this particular merge request is mostly junk.

review: Needs Fixing
Revision history for this message
Andrew Johnson (anj) wrote :

AI on AJ: Add PRINT and show-makefiles rules to Base.

Revision history for this message
Andrew Johnson (anj) wrote :

I added the PRINT.% and show-makefiles targets yesterday in commit 11ba48232cd, which supersede the changes in this branch as agreed by the comment from 2018-05-09. Thus I am closing this Merge Request.

Unmerged commits

e1cafb7... by mdavidsaver

minor

cd44bb8... by mdavidsaver

make debug

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/configure/CONFIG b/configure/CONFIG
2index 580b587..7c08538 100644
3--- a/configure/CONFIG
4+++ b/configure/CONFIG
5@@ -115,3 +115,10 @@ ifdef T_A
6 -include $(HOME)/configure/CONFIG_USER.$(EPICS_HOST_ARCH).$(T_A)
7 endif
8
9+define showentry
10+echo " $(1)";
11+endef
12+
13+define showvariable
14+$(if $($(1)),echo " $(1) = $($(1))";,)
15+endef
16diff --git a/configure/RULES_ARCHS b/configure/RULES_ARCHS
17index dc3fa04..0b8f64c 100644
18--- a/configure/RULES_ARCHS
19+++ b/configure/RULES_ARCHS
20@@ -15,6 +15,7 @@ ACTIONS += build
21 ACTIONS += install
22 ACTIONS += buildInstall
23 ACTIONS += runtests tapfiles clean-tests test-results junitfiles
24+ACTIONS += debug
25
26 actionArchTargets = $(foreach action, $(ACTIONS), \
27 $(addprefix $(action)$(DIVIDER), $(BUILD_ARCHS)))
28diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD
29index 0196400..dcb16a2 100644
30--- a/configure/RULES_BUILD
31+++ b/configure/RULES_BUILD
32@@ -534,5 +534,20 @@ $(INSTALL_TEMPLATES_SUBDIR)/%: %
33 .PHONY: runtests tapfiles clean-tests test-results junitfiles
34 .PHONY: checkRelease warnRelease noCheckRelease FORCE
35
36+
37+DEBUGVARS += $(filter %FLAGS %LIB% %PROD%, $(.VARIABLES))
38+DEBUGVARS += SHARED_LIBRARIES STATIC_BUILD COMMANDLINE_LIBRARY
39+DEBUGVARS += RTEMS_BASE RTEMS_VERSION CMPLR_PREFIX
40+
41+debug: debug-arch
42+
43+debug-arch:
44+ @echo "Select variables:"
45+ @$(foreach var, $(DEBUGVARS), $(call showvariable,$(var)))
46+ @echo "Makefiles used in $$PWD:"
47+ @$(foreach ent, $(MAKEFILE_LIST), $(call showentry,$(ent)))
48+
49+.PHONY: debug debug-arch
50+
51 endif # BASE_RULES_BUILD
52 # EOF RULES_BUILD
53diff --git a/configure/RULES_TOP b/configure/RULES_TOP
54index 838994b..e11e759 100644
55--- a/configure/RULES_TOP
56+++ b/configure/RULES_TOP
57@@ -61,6 +61,7 @@ help:
58 @echo " rebuild - Same as clean install"
59 @echo " archclean - Removes O.<arch> dirs but not O.Common dir"
60 @echo " runtests - Run self-tests, summarize results"
61+ @echo " debug - Print copious information about build configuration"
62 @echo "\"Partial\" build targets supported by Makefiles:"
63 @echo " host - Builds and installs $(EPICS_HOST_ARCH) only."
64 @echo " inc$(DIVIDER)<arch> - Installs <arch> only header files."
65@@ -88,3 +89,21 @@ RELEASE_CFG_TOP_RULES = $(foreach top, $(RELEASE_TOPS), \
66 ifneq ($(RELEASE_CFG_TOP_RULES),)
67 include $(RELEASE_CFG_TOP_RULES)
68 endif
69+
70+# selection from configure/CONFIG_SITE
71+DEBUGVARS += CROSS_COMPILER_TARGET_ARCHS CROSS_COMPILER_HOST_ARCHS CROSS_COMPILER_RUNTEST_ARCHS
72+DEBUGVARS += SHARED_LIBRARIES STATIC_BUILD HOST_OPT CROSS_OPT USE_POSIX_THREAD_PRIORITY_SCHEDULING LINKER_USE_RPATH
73+DEBUGVARS += INSTALL_LOCATION
74+
75+debug-top:
76+ @echo "Select variables:"
77+ @$(foreach var, $(DEBUGVARS), $(call showvariable,$(var)))
78+ @echo "Makefiles used in $$PWD:"
79+ @$(foreach ent, $(MAKEFILE_LIST),$(call showentry,$(ent)))
80+ @echo "Module search path: (relative to $$PWD)"
81+ @$(foreach var, $(RELEASE_TOPS),$(call showvar,$(var)))
82+ @echo "Run 'make -C someApp/src debug' for more detailed information"
83+
84+debug: debug-top
85+
86+.PHONY: debug debug-top

Subscribers

People subscribed via source and target branches