aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-06-13 09:23:13 +0100
committerMatt Fleming <matt.fleming@intel.com>2012-06-20 16:34:42 +0100
commitfb543aa635ff117187c73ce0ae3dccf8ffe32161 (patch)
tree7be11edbcccb5e44ac621fe4f8bf54a1dbf3bb56
parent3e7446afe578dcad987076fdd340740d2c2f53d2 (diff)
downloadsyslinux-fb543aa635ff117187c73ce0ae3dccf8ffe32161.tar.gz
syslinux-fb543aa635ff117187c73ce0ae3dccf8ffe32161.tar.xz
syslinux-fb543aa635ff117187c73ce0ae3dccf8ffe32161.zip
com32: Per-object file LDFLAGS
Some object files need to link against the ELF libraries. Allow them to be specified with the following syntax in the Makefiles, LDFLAGS_$(object_file) = $(LIBS) By adding libraries in this way DT_NEEDED entries are created in the ELF modules and the required library dependencies are automatically loaded before running the module. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--com32/cmenu/Makefile17
-rw-r--r--com32/hdt/Makefile3
-rw-r--r--com32/modules/Makefile15
-rw-r--r--com32/rosh/Makefile2
-rw-r--r--com32/samples/Makefile3
-rw-r--r--mk/elf.mk2
6 files changed, 39 insertions, 3 deletions
diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile
index 00825b46..40a09d1f 100644
--- a/com32/cmenu/Makefile
+++ b/com32/cmenu/Makefile
@@ -26,13 +26,26 @@ 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
+
LIBMENU = libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
- libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o
+ libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o \
+ $(com32)/libutil/libutil_com.c32 $(com32)/lib/libcom32.c32
CMENUS = $(patsubst %.c,%.c32,$(wildcard *.c))
IMENUS = $(patsubst %.menu,%.c32,$(wildcard *.menu))
-MENUS = $(CMENUS) $(IMENUS) $(LIBS)
+MENUS = $(LIBS) $(CMENUS) $(IMENUS)
.SUFFIXES: .S .c .o .elf .c32 .menu
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index 36206cd5..ff0fa2e2 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -20,6 +20,9 @@ MAKEDIR = $(topdir)/mk
include $(MAKEDIR)/elf.mk
LIBS = ../libupload/libcom32upload.a
+C_LIBS += $(com32)/cmenu/libmenu/libmenu.c32 \
+ $(com32)/libutil/libutil_com.c32 \
+ $(com32)/lib/libcom32.c32 $(com32)/gpllib/libcom32gpl.c32
CFLAGS += -I$(com32)/cmenu/libmenu -I$(com32)
MODULES = hdt.c32
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index 017d6db0..8d94cfec 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -28,6 +28,21 @@ MODULES = config.c32 ethersel.c32 dmitest.c32 cpuidtest.c32 \
TESTFILES =
+LDFLAGS_cpuidtest.o = $(com32)/gpllib/libcom32gpl.c32
+LDFLAGS_disk.o = $(com32)/gpllib/libcom32gpl.c32
+LDFLAGS_ethersel.o = $(com32)/lib/libcom32.c32
+LDFLAGS_gpxecmd.o = $(com32)/lib/libcom32.c32
+LDFLAGS_host.o = $(com32)/lib/libcom32.c32
+LDFLAGS_ifcpu.o = $(com32)/libutil/libutil_com.c32 \
+ $(com32)/gpllib/libcom32gpl.c32
+LDFLAGS_kbdmap.o = $(com32)/lib/libcom32.c32
+LDFLAGS_linux.o = $(com32)/lib/libcom32.c32
+LDFLAGS_pxechn.o = $(com32)/lib/libcom32.c32 \
+ $(com32)/libutil/libutil_com.c32
+LDFLAGS_sanboot.o = $(com32)/lib/libcom32.c32
+LDFLAGS_vpdtest.o = $(com32)/gpllib/libcom32gpl.c32
+LDFLAGS_zzjson.o = $(com32)/gpllib/libcom32gpl.c32
+
all: $(MODULES) $(TESTFILES)
.PRECIOUS: %.o
diff --git a/com32/rosh/Makefile b/com32/rosh/Makefile
index 766f68d5..f3283952 100644
--- a/com32/rosh/Makefile
+++ b/com32/rosh/Makefile
@@ -34,6 +34,8 @@ endif
CFLAGS += -DDATE='"$(DATE)"'
LNXCFLAGS += -DDATE='"$(DATE)"'
+LDFLAGS_rosh.o = $(com32)/libutil/libutil_com.c32 $(com32)/lib/libcom32.c32
+
rosh.o: rosh.h
rosh.lo: rosh.h
diff --git a/com32/samples/Makefile b/com32/samples/Makefile
index 167c638c..bca197ed 100644
--- a/com32/samples/Makefile
+++ b/com32/samples/Makefile
@@ -18,6 +18,9 @@ topdir = ../..
MAKEDIR = $(topdir)/mk
include $(MAKEDIR)/elf.mk
+LDFLAGS_fancyhello.o = $(com32)/libutil/libutil_com.c32
+LDFLAGS_keytest.o = $(com32)/libutil/libutil_com.c32
+
all: hello.c32 resolv.c32 serialinfo.c32 \
localboot.c32 \
fancyhello.c32 fancyhello.lnx \
diff --git a/mk/elf.mk b/mk/elf.mk
index 5242b2da..ea4344d7 100644
--- a/mk/elf.mk
+++ b/mk/elf.mk
@@ -82,4 +82,4 @@ C_LNXLIBS = $(com32)/libutil/libutil_lnx.a \
$(CC) $(LNXCFLAGS) -o $@ $^
%.c32: %.o
- $(LD) $(LDFLAGS) -o $@ $^
+ $(LD) $(LDFLAGS_$^) $(LDFLAGS) -o $@ $^