lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generate dependency files with Clang (issue 555300044 by address@hid


From: jonas . hahnfeld
Subject: Re: Generate dependency files with Clang (issue 555300044 by address@hidden)
Date: Sun, 16 Feb 2020 23:18:25 -0800

Reviewers: lemzwerg, hanwenn,

Message:
On 2020/02/16 21:24:59, dak wrote:
> It's also the only thing that we needed a C compiler (rather than C++)
for. 
> Well, at least regarding native compilation.  GUB of course needs a C
compiler
> for bootstrapping the cross-building environment.  But that does not
really
> concern the stuff in the LilyPond repository.

Compiling C is already gone since commit 4681522edc ("Issue 5653/3: Drop
support for compiling C files").

On 2020/02/16 21:25:42, hanwenn wrote:
> please, for the love of god, do not use automake. 
> 
> It is slow and arcane, and generally a complete PITA to work with. We
created
> stepmake after fighting with automake for a while.

Do you have concrete numbers for automake being "slow" and are you sure
that it's still the case? At the moment Stepmake is just broken in so
many points (*) and a nightmare to maintain. So IMO it would be ok to
trade off 5% performance during configure (which we can easily offset by
removing outdated checks) with probably the same performance during
builds - maybe even better.

(*) Take this change as one example. Another one that hits my mind
(because I experienced it yesterday) is how our build system reorders
compilation, ie when invoking a serial `make' you don't get the same
order of .cc -> .o files. This is really insane if you work on headers,
want to fix one particular issue in one translation unit and suddenly
get errors + warnings from another file!

Description:
Generate dependency files with Clang

Clang has no support for the DEPENDENCIES_OUTPUT variable. Instead
pass -MMD -MF -MT to achieve the same effect with both GCC and Clang.
This solution even comes with the advantage that passing -MP gives
"a phony target for each dependency" to "work around errors make
gives if you remove header files".

In the long term, we should definitely think about using something
like AutoMake for this purpose so that we don't have to maintain
these details of our build system...

Additionally delete rules for .lo files. As far as I can tell, they
are not used.

Please review this at https://codereview.appspot.com/555300044/

Affected files (+5, -19 lines):
  M stepmake/stepmake/c++-rules.make
  M stepmake/stepmake/c++-vars.make


Index: stepmake/stepmake/c++-rules.make
diff --git a/stepmake/stepmake/c++-rules.make b/stepmake/stepmake/c++-rules.make
index 
c9768b6f855c0cfc6c0c16de13a7ae8ca0892aab..e4e87fdd27cf90b2efbace5744b5e332d75402f8
 100644
--- a/stepmake/stepmake/c++-rules.make
+++ b/stepmake/stepmake/c++-rules.make
@@ -2,19 +2,11 @@
 
 $(outdir)/%.o: %.cc
        $(call ly_progress,Making,$@,< cc)
-       $(DO_O_DEP) $(CXX) -c $(ALL_CXXFLAGS) -o $@ $<
+       $(CXX) -c $(ALL_CXXFLAGS) -o $@ $<
 
 $(outdir)/%.o: $(outdir)/%.cc
        $(call ly_progress,Making,$@,< cc)
-       $(DO_O_DEP) $(CXX) -c $(ALL_CXXFLAGS) -o $@ $<
-
-$(outdir)/%.lo: %.cc
-       $(call ly_progress,Making,$@,< cc)
-       $(DO_LO_DEP) $(CXX) -c $(ALL_CXXFLAGS) $(PIC_FLAGS) -o $@ $<
-
-$(outdir)/%.lo: $(outdir)/%.cc
-       $(call ly_progress,Making,$@,< cc)
-       $(DO_LO_DEP) $(CXX) -c $(ALL_CXXFLAGS) $(PIC_FLAGS) -o $@ $<
+       $(CXX) -c $(ALL_CXXFLAGS) -o $@ $<
 
 $(outdir)/%.cc $(outdir)/%.hh: %.yy
        $(call ly_progress,Making,$@,< yy)
Index: stepmake/stepmake/c++-vars.make
diff --git a/stepmake/stepmake/c++-vars.make b/stepmake/stepmake/c++-vars.make
index 
9a011d3fb9ef8761f200d67ed73ffff58084b810..3b12c4d6e415d980fba03176d38b7e706d62eae2
 100644
--- a/stepmake/stepmake/c++-vars.make
+++ b/stepmake/stepmake/c++-vars.make
@@ -8,16 +8,10 @@ PIC_FLAGS = -fpic -fPIC
 endif
 endif
 
-o-dep-out = $(outdir)/$(subst .o,.dep,$(notdir $@))#
-DO_O_DEP = rm -f $(o-dep-out); DEPENDENCIES_OUTPUT="$(o-dep-out) 
$(outdir)/$(notdir $@)"
-
-lo-dep-out = $(outdir)/$(subst .lo,.dep,$(notdir $@))#
-DO_LO_DEP = rm -f $(lo-dep-out); DEPENDENCIES_OUTPUT="$(lo-dep-out) 
$(outdir)/$(notdir $@)"
-
 EXTRA_CXXFLAGS = -std=c++11 -fno-exceptions -W -Wall -Wconversion 
-Woverloaded-virtual
-#ifeq ($(MY_PATCH_LEVEL),)
-#EXTRA_CXXFLAGS += -Werror
-#endif
+
+o-dep-out = $(outdir)/$(subst .o,.dep,$(notdir $@))#
+EXTRA_CXXFLAGS += -MMD -MP -MF $(o-dep-out) -MT $(outdir)/$(notdir $@)
 
 ALL_CXXPPFLAGS = $(CPPFLAGS) $(CONFIG_CPPFLAGS) $(DEFINES) $(INCLUDES:%=-I%)
 # note: CXXFLAGS last allows user override of prior flags





reply via email to

[Prev in Thread] Current Thread [Next in Thread]