diff --git a/Makefile.config.in b/Makefile.config.in
index d66f55434..20631935f 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -168,6 +168,7 @@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
 
 MAKE_COLOR = @MAKE_COLOR@
 
+LIB_O_NAME = lib.o
 
 ### This is here because Makefile.config is usually the first thing
 ### we get and sometimes the all rule can be implicit, yet we want
diff --git a/Makefile.lib b/Makefile.lib
index 7faa06f09..10b483c4d 100644
--- a/Makefile.lib
+++ b/Makefile.lib
@@ -40,7 +40,7 @@ quiet_cmd_compile = '      [$(CC_COLOR)CC$(END_COLOR)]   $(RELPATH)$@'
 quiet_cmd_ld_objs = "      [$(LD_COLOR)LD$(END_COLOR)]   $(RELPATH)$@"
       cmd_ld_objs = $(LD) -r -o $@ $(filter $(OBJS), $^) \
       		    $(foreach subdir,$(sort $(filter-out src,$(SUBDIRS))), \
-			    `test -e $(subdir)/lib.o && echo $(subdir)/lib.o`)
+			    `test -e $(subdir)/$(LIB_O_NAME) && echo $(subdir)/$(LIB_O_NAME)`)
 
    quiet_cmd_link = '    [$(LINK_COLOR)LINK$(END_COLOR)]   $(RELPATH)$@'
          cmd_link = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
@@ -114,10 +114,10 @@ endif
 
 
 ifdef OBJS
-lib.o: $(sort $(OBJS)) $(foreach subdir,$(sort $(filter-out src,$(SUBDIRS))), $(wildcard $(subdir)/lib.o))
+$(LIB_O_NAME): $(sort $(OBJS)) $(foreach subdir,$(sort $(filter-out src,$(SUBDIRS))), $(wildcard $(subdir)/$(LIB_O_NAME)))
 	$(call cmd,ld_objs)
 
-LIB_O = lib.o
+LIB_O = $(LIB_O_NAME)
 CLEAN += $(OBJS) $(LIB_O)
 endif
 
diff --git a/src/Makefile b/src/Makefile
index d5d672c54..96121af18 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -37,7 +37,7 @@ OBJS = vernum.o
 vernum.o: FORCE
 FORCE:
 
-elinks: lib.o
+elinks: $(LIB_O_NAME)
 	$(call cmd,link)
 
 PROGS = elinks
diff --git a/src/dom/test/Makefile b/src/dom/test/Makefile
index 3b7bd24d5..9625a0fa8 100644
--- a/src/dom/test/Makefile
+++ b/src/dom/test/Makefile
@@ -7,7 +7,7 @@ TEST_PROGS = \
  sgml-parser
 
 TESTDEPS = \
- $(top_builddir)/src/dom/lib.o \
+ $(top_builddir)/src/dom/$(LIB_O_NAME) \
  $(top_builddir)/src/util/error.o \
  $(top_builddir)/src/osdep/stub.o \
  $(top_builddir)/src/util/hash.o \