[syslinux:elflink] elflink: fix dependency problem in cmenu/ Makefile

syslinux-bot for H. Peter Anvin hpa at zytor.com
Fri Jun 29 07:42:05 PDT 2012


Commit-ID:  4678fd92a21e0139b0126bafcccda82c16404d3e
Gitweb:     http://www.syslinux.org/commit/4678fd92a21e0139b0126bafcccda82c16404d3e
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Fri, 29 Jun 2012 07:38:33 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Fri, 29 Jun 2012 07:38:33 -0700

elflink: fix dependency problem in cmenu/Makefile

Instead of adding library dependencies implicitly, make them explicit
and use --as-needed to avoid bogus DT_NEEDED entries from being
generated.

The other Makefiles should be adjusted accordingly as well.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>
Cc: Matt Fleming <matt.fleming at intel.com>

---
 com32/cmenu/Makefile |   19 ++++---------------
 mk/elf.mk            |    4 ++--
 2 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile
index 40a09d1..c6e0cae 100644
--- a/com32/cmenu/Makefile
+++ b/com32/cmenu/Makefile
@@ -17,26 +17,15 @@
 
 NOGPL := 1
 
-# This must be defined before com32.mk is included
-LIBS   = libmenu/libmenu.c32
-
 topdir = ../..
 MAKEDIR = $(topdir)/mk
 include $(MAKEDIR)/elf.mk
 
 CFLAGS	  += -I./libmenu
 
-LDFLAGS_complex.o = $(com32)/cmenu/libmenu/libmenu.c32 \
-		    $(com32)/libutil/libutil_com.c32 \
-		    $(com32)/lib/libcom32.c32
-LDFLAGS_display.o = $(com32)/cmenu/libmenu/libmenu.c32 \
-		$(com32)/libutil/libutil_com.c32 \
-		$(com32)/lib/libcom32.c32
-LDFLAGS_simple.o = $(com32)/cmenu/libmenu/libmenu.c32 \
-		   $(com32)/libutil/libutil_com.c32 \
-		   $(com32)/lib/libcom32.c32
-LDFLAGS_test.o = $(com32)/cmenu/libmenu/libmenu.c32
-LDFLAGS_test2.o = $(com32)/cmenu/libmenu/libmenu.c32
+LIBS  = libmenu/libmenu.c32 \
+        $(com32)/libutil/libutil_com.c32 \
+        $(com32)/lib/libcom32.c32
 
 LIBMENU = libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
 	libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o \
@@ -53,7 +42,7 @@ MENUS = $(LIBS) $(CMENUS) $(IMENUS)
 %.c: %.menu adv_menu.tpl
 	python menugen.py --input=$< --output=$@ --template=adv_menu.tpl
 
-all: menus
+all:	menus
 
 libmenu/libmenu.c32: $(LIBMENU)
 	$(LD) -shared $(LDFLAGS) -o $@ $^
diff --git a/mk/elf.mk b/mk/elf.mk
index ea4344d..bc2948a 100644
--- a/mk/elf.mk
+++ b/mk/elf.mk
@@ -48,7 +48,7 @@ CFLAGS     = $(GCCOPT) -W -Wall -march=i386 \
 	     -I$(com32)/libutil/include -I$(com32)/include $(GPLINCLUDE) \
 	     -I$(core)/include
 SFLAGS     = $(GCCOPT) -D__COM32__ -march=i386
-LDFLAGS    = -m elf_i386 -shared --hash-style=gnu -T $(com32)/lib/elf32.ld
+LDFLAGS    = -m elf_i386 -shared --hash-style=gnu -T $(com32)/lib/elf32.ld --as-needed
 
 LNXCFLAGS  = -I$(com32)/libutil/include -W -Wall -O -g -D_GNU_SOURCE
 LNXSFLAGS  = -g
@@ -81,5 +81,5 @@ C_LNXLIBS  = $(com32)/libutil/libutil_lnx.a \
 %.lnx: %.lo $(LNXLIBS) $(C_LNXLIBS)
 	$(CC) $(LNXCFLAGS) -o $@ $^
 
-%.c32: %.o
+%.c32: %.o $(LIBS)
 	$(LD) $(LDFLAGS_$^) $(LDFLAGS) -o $@ $^


More information about the Syslinux-commits mailing list