diff --git a/cppflags-iterator.mk b/libof-iterator.mk
similarity index 47%
rename from cppflags-iterator.mk
rename to libof-iterator.mk
index 89a472bd82..31560ce231 100644
--- a/cppflags-iterator.mk
+++ b/libof-iterator.mk
@@ -1,5 +1,6 @@
-# This file is included several times in a row, once
-# for each element of $(lib)-routines and $(lib)-sysdeps_routines.
+# This file is included several times in a row, once for each element
+# $(cpp-src) of $(cpp-srcs-left).  It sets libof-$(cpp-src) to $(lib)
+# for each.

 cpp-src := $(firstword $(cpp-srcs-left))
 cpp-srcs-left := $(filter-out $(cpp-src),$(cpp-srcs-left))
diff --git a/extra-modules.mk b/extra-modules.mk
deleted file mode 100644
index 5f8e693b15..0000000000
--- a/extra-modules.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-# This file is included several times in a row, once
-# for each element of $(modules-names).  $(extra-modules-left)
-# is initialized first to $(modules-names) so that with each
-# inclusion, we advance $(module) to the next name.
-
-module := $(firstword $(extra-modules-left))
-extra-modules-left := $(filter-out $(module),$(extra-modules-left))
-
-libof-$(notdir $(module)) := extramodules
diff --git a/extra-lib.mk b/extra-lib.mk
index 2552049135..72f8d2e1df 100644
--- a/extra-lib.mk
+++ b/extra-lib.mk
@@ -108,5 +108,5 @@ endif
 # This will define `libof-ROUTINE := LIB' for each of the routines.
 cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines)
 ifneq (,$(cpp-srcs-left))
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
 endif
diff --git a/Makerules b/Makerules
index 7f0eef8096..15f46e5f3a 100644
--- a/Makerules
+++ b/Makerules
@@ -794,11 +794,9 @@ endif
 # The makefile may define $(modules-names) to build additional modules.
 # These are built with $(build-module), except any in $(modules-names-nobuild).
 ifdef modules-names
-# extra-lib.mk is included once for each extra lib to define rules
-# to build it, and to add its objects to the various variables.
-# During its evaluation, $(lib) is set to the name of the library.
-extra-modules-left := $(modules-names)
-include $(patsubst %,$(..)extra-modules.mk,$(modules-names))
+cpp-srcs-left := $(modules-names)
+lib = extramodules
+include $(patsubst %,$(..)libof-iterator.mk,$(modules-names))

 extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names))
 $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \
@@ -1327,7 +1325,7 @@ all-nonlib = $(strip $(tests) $(xtests)
$(test-srcs) $(test-extras) $(others))
 ifneq (,$(all-nonlib))
 cpp-srcs-left = $(all-nonlib)
 lib := nonlib
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
 endif


diff --git a/benchtests/Makefile b/benchtests/Makefile
index a96e9533b3..7f5fda5ef4 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -123,7 +123,7 @@ endif
 cpp-srcs-left := $(binaries-benchset:=.c) $(binaries-bench:=.c) \
          $(binaries-bench-malloc:=.c)
 lib := nonlib
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))

 bench-extra-objs = json-lib.o

diff --git a/elf/Makefile b/elf/Makefile
index cc4aeb25b6..baf967821c 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -547,7 +547,7 @@ CFLAGS-rtld.c = $(SYSCONF-FLAGS)

 cpp-srcs-left := $(all-rtld-routines:=.os)
 lib := rtld
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))

 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip
$(modules-names))))
 generated += $(addsuffix .so,$(strip $(modules-names)))
diff --git a/elf/rtld-Rules b/elf/rtld-Rules
index 99b5899f7d..2c7b99828c 100644
--- a/elf/rtld-Rules
+++ b/elf/rtld-Rules
@@ -142,7 +142,7 @@ endif
 # Set libof-* for each routine.
 cpp-srcs-left := $(rtld-modules:%.os=%)
 lib := rtld
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))

 rtld-CFLAGS += $(no-stack-protector)

diff --git a/iconv/Makefile b/iconv/Makefile
index 2b2bc8e303..b2fead0479 100644
--- a/iconv/Makefile
+++ b/iconv/Makefile
@@ -55,7 +55,7 @@ CFLAGS-iconvconfig.c = -DGCONV_PATH='"$(gconvdir)"'
-DGCONV_DIR='"$(gconvdir)"'
 # Set libof-* for each routine.
 cpp-srcs-left := $(iconv_prog-modules) $(iconvconfig-modules)
 lib := iconvprogs
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))

 ifeq ($(run-built-tests),yes)
 xtests-special += $(objpfx)test-iconvconfig.out
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index e4845871f5..a0e297e4de 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -290,7 +290,7 @@ cpp-srcs-left := $(modules) $(generated-modules)
$(libJIS-routines) \
          $(libKSC-routines) $(libGB-routines) $(libCNS-routines) \
          $(libISOIR165-routines) $(libJISX0213-routines)
 lib := iconvdata
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))

 tst-loading-ENV = MALLOC_TRACE=$(objpfx)tst-loading.mtrace
 $(objpfx)mtrace-tst-loading.out: $(objpfx)tst-loading.out
diff --git a/locale/Makefile b/locale/Makefile
index 29a34b1f26..d9ef48fe93 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -101,4 +101,4 @@ CFLAGS-charmap-dir.c = -Wno-write-strings
 cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \
          $(lib-modules)
 lib := locale-programs
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
diff --git a/malloc/Makefile b/malloc/Makefile
index e93b83b57d..e380e9629b 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -126,7 +126,7 @@ memusagestat-modules = memusagestat

 cpp-srcs-left := $(memusagestat-modules)
 lib := memusagestat
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))

 $(objpfx)memusagestat: $(memusagestat-modules:%=$(objpfx)%.o)
     $(LINK.o) -o $@ $^ $(libgd-LDFLAGS) -lgd -lpng -lz -lm
diff --git a/nscd/Makefile b/nscd/Makefile
index 0385a370f0..4126996887 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -92,7 +92,7 @@ endif
 # Set libof-nscd.
 cpp-srcs-left := $(nscd-modules)
 lib := nscd
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))

 $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)

diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index a5177fffdc..08bb9c6822 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -183,7 +183,7 @@ $(objpfx)cross-rpcgen: $(cross-rpcgen-objs)
 # This makes sure -DIN_MODULE is passed for all these modules.
 cpp-srcs-left := $(rpcgen-objs:.o=.c)
 lib := nonlib
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))

 # How we run rpcgen to generate sources and headers in the rules below.
 # Setting CPP tells it how to run the C preprocessor correctly.  Note
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
index d50836579f..8a54f88cd7 100644
--- a/sysdeps/s390/Makefile
+++ b/sysdeps/s390/Makefile
@@ -18,7 +18,7 @@ include extra-module.mk

 cpp-srcs-left := $(foreach mod,$(s390x-iconv-modules),$($(mod)-routines))
 lib := iconvdata
-include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))

 extra-objs      += $(addsuffix .so, $(s390x-iconv-modules))
 install-others  += $(patsubst %, $(inst_gconvdir)/%.so, $(s390x-iconv-modules))
diff --git a/benchtests/strcoll-inputs/filelist#en_US.UTF-8
b/benchtests/strcoll-inputs/filelist#en_US.UTF-8
index b7b38017d8..6cee2374f4 100644
--- a/benchtests/strcoll-inputs/filelist#en_US.UTF-8
+++ b/benchtests/strcoll-inputs/filelist#en_US.UTF-8
@@ -9667,7 +9667,6 @@ hr.po
 libc.pot
 ko.po
 ru.po
-extra-modules.mk
 intl
 tst-gettext4-fr.po
 tstcodeset.po
@@ -13252,7 +13251,6 @@ sigset.h
 atomic.h
 utmp.h
 stdlib-bsearch.h
-cppflags-iterator.mk
 iconvdata
 MISSING
 ibm1164.h
@@ -15245,3 +15243,4 @@ w_exp2l.c
 bug-nexttoward.c
 w_dreml.c
 s_nanf.c
+libof-iterator.mk
