Skip to content

Commit

Permalink
antimake: split LangObjTarget rule
Browse files Browse the repository at this point in the history
GNU make 4.4 started to show warning:

	warning: pattern recipe did not update peer target '...'

That is because make expects rule in form

	%.o %.lo: %.c

build both targets in one execution, which does happen when
building .lo objects, but not when building .o objects.

But this dependency between .o<>.lo is unnecessary complexity,
as no rule uses both .o and .lo of same object file as input.

Thus is is enough to duplicate the rule for both cases
and let the target pick which one it wants to depend on.
  • Loading branch information
markokr committed Apr 24, 2024
1 parent 46a78d2 commit e80c685
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mk/antimake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,10 @@ endef
# 1-tgt, 2-name, 3-srcext
define LangObjTarget
$(trace3)
$$(OBJDIR)/$(1)/%$(OBJEXT) $$(OBJDIR)/$(1)/%.lo: %$(3)
$$(OBJDIR)/$(1)/%$(OBJEXT): %$(3)
@$$(call MkDir,$$(dir $$@))
$$(AM_LANG_$(2)_COMPILE)
$$(OBJDIR)/$(1)/%.lo: %$(3)
@$$(call MkDir,$$(dir $$@))
$$(AM_LANG_$(2)_COMPILE)
endef
Expand Down

0 comments on commit e80c685

Please sign in to comment.