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
diff --git a/configure/CONFIG b/configure/CONFIG
index 580b587..7c08538 100644
--- a/configure/CONFIG
+++ b/configure/CONFIG
@@ -115,3 +115,10 @@ ifdef T_A
115 -include $(HOME)/configure/CONFIG_USER.$(EPICS_HOST_ARCH).$(T_A)115 -include $(HOME)/configure/CONFIG_USER.$(EPICS_HOST_ARCH).$(T_A)
116endif116endif
117117
118define showentry
119echo " $(1)";
120endef
121
122define showvariable
123$(if $($(1)),echo " $(1) = $($(1))";,)
124endef
diff --git a/configure/RULES_ARCHS b/configure/RULES_ARCHS
index dc3fa04..0b8f64c 100644
--- a/configure/RULES_ARCHS
+++ b/configure/RULES_ARCHS
@@ -15,6 +15,7 @@ ACTIONS += build
15ACTIONS += install15ACTIONS += install
16ACTIONS += buildInstall16ACTIONS += buildInstall
17ACTIONS += runtests tapfiles clean-tests test-results junitfiles17ACTIONS += runtests tapfiles clean-tests test-results junitfiles
18ACTIONS += debug
1819
19actionArchTargets = $(foreach action, $(ACTIONS), \20actionArchTargets = $(foreach action, $(ACTIONS), \
20 $(addprefix $(action)$(DIVIDER), $(BUILD_ARCHS)))21 $(addprefix $(action)$(DIVIDER), $(BUILD_ARCHS)))
diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD
index 0196400..dcb16a2 100644
--- a/configure/RULES_BUILD
+++ b/configure/RULES_BUILD
@@ -534,5 +534,20 @@ $(INSTALL_TEMPLATES_SUBDIR)/%: %
534.PHONY: runtests tapfiles clean-tests test-results junitfiles534.PHONY: runtests tapfiles clean-tests test-results junitfiles
535.PHONY: checkRelease warnRelease noCheckRelease FORCE535.PHONY: checkRelease warnRelease noCheckRelease FORCE
536536
537
538DEBUGVARS += $(filter %FLAGS %LIB% %PROD%, $(.VARIABLES))
539DEBUGVARS += SHARED_LIBRARIES STATIC_BUILD COMMANDLINE_LIBRARY
540DEBUGVARS += RTEMS_BASE RTEMS_VERSION CMPLR_PREFIX
541
542debug: debug-arch
543
544debug-arch:
545 @echo "Select variables:"
546 @$(foreach var, $(DEBUGVARS), $(call showvariable,$(var)))
547 @echo "Makefiles used in $$PWD:"
548 @$(foreach ent, $(MAKEFILE_LIST), $(call showentry,$(ent)))
549
550.PHONY: debug debug-arch
551
537endif # BASE_RULES_BUILD552endif # BASE_RULES_BUILD
538# EOF RULES_BUILD553# EOF RULES_BUILD
diff --git a/configure/RULES_TOP b/configure/RULES_TOP
index 838994b..e11e759 100644
--- a/configure/RULES_TOP
+++ b/configure/RULES_TOP
@@ -61,6 +61,7 @@ help:
61 @echo " rebuild - Same as clean install"61 @echo " rebuild - Same as clean install"
62 @echo " archclean - Removes O.<arch> dirs but not O.Common dir"62 @echo " archclean - Removes O.<arch> dirs but not O.Common dir"
63 @echo " runtests - Run self-tests, summarize results"63 @echo " runtests - Run self-tests, summarize results"
64 @echo " debug - Print copious information about build configuration"
64 @echo "\"Partial\" build targets supported by Makefiles:"65 @echo "\"Partial\" build targets supported by Makefiles:"
65 @echo " host - Builds and installs $(EPICS_HOST_ARCH) only."66 @echo " host - Builds and installs $(EPICS_HOST_ARCH) only."
66 @echo " inc$(DIVIDER)<arch> - Installs <arch> only header files."67 @echo " inc$(DIVIDER)<arch> - Installs <arch> only header files."
@@ -88,3 +89,21 @@ RELEASE_CFG_TOP_RULES = $(foreach top, $(RELEASE_TOPS), \
88ifneq ($(RELEASE_CFG_TOP_RULES),)89ifneq ($(RELEASE_CFG_TOP_RULES),)
89 include $(RELEASE_CFG_TOP_RULES)90 include $(RELEASE_CFG_TOP_RULES)
90endif91endif
92
93# selection from configure/CONFIG_SITE
94DEBUGVARS += CROSS_COMPILER_TARGET_ARCHS CROSS_COMPILER_HOST_ARCHS CROSS_COMPILER_RUNTEST_ARCHS
95DEBUGVARS += SHARED_LIBRARIES STATIC_BUILD HOST_OPT CROSS_OPT USE_POSIX_THREAD_PRIORITY_SCHEDULING LINKER_USE_RPATH
96DEBUGVARS += INSTALL_LOCATION
97
98debug-top:
99 @echo "Select variables:"
100 @$(foreach var, $(DEBUGVARS), $(call showvariable,$(var)))
101 @echo "Makefiles used in $$PWD:"
102 @$(foreach ent, $(MAKEFILE_LIST),$(call showentry,$(ent)))
103 @echo "Module search path: (relative to $$PWD)"
104 @$(foreach var, $(RELEASE_TOPS),$(call showvar,$(var)))
105 @echo "Run 'make -C someApp/src debug' for more detailed information"
106
107debug: debug-top
108
109.PHONY: debug debug-top

Subscribers

People subscribed via source and target branches