aboutsummaryrefslogtreecommitdiffstats
path: root/menu
diff options
context:
space:
mode:
authorhpa <hpa>2004-02-02 08:58:35 +0000
committerhpa <hpa>2004-02-02 08:58:35 +0000
commitdda2dffd01825eab5c6fc9e59c150d31dd16ccdf (patch)
tree366412cd2f2fc1754e4eedbaeebc31310be2593f /menu
parentcb4c2a2a6fc0bc6451a3bd5a5c544ba297946eaa (diff)
downloadsyslinux-elf-dda2dffd01825eab5c6fc9e59c150d31dd16ccdf.tar.gz
syslinux-elf-dda2dffd01825eab5c6fc9e59c150d31dd16ccdf.tar.xz
syslinux-elf-dda2dffd01825eab5c6fc9e59c150d31dd16ccdf.zip
Allow multiple mains in the makefile by building as a librarysyslinux-2.09-pre3
Diffstat (limited to 'menu')
-rw-r--r--menu/Makefile94
-rw-r--r--menu/README8
2 files changed, 55 insertions, 47 deletions
diff --git a/menu/Makefile b/menu/Makefile
index 4c35dbb2..e782a4c2 100644
--- a/menu/Makefile
+++ b/menu/Makefile
@@ -1,44 +1,50 @@
-gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \
- then echo $(1); else echo $(2); fi)
-
-M32 := $(call gcc_ok,-m32,)
-ALIGN := $(call gcc_ok,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
-
-CC = gcc $(M32) -funsigned-char
-CFLAGS = -g -W -Wall -march=i386 $(ALIGN) -Os
-AS = as
-LD = ld -m elf_i386
-OBJCOPY = objcopy
-
-.SUFFIXES: .c .s .s16 .o16 .elf .com
-
-.c.s:
- $(CC) $(CFLAGS) -S -o $@ $<
-
-.s.s16:
- echo '.code16gcc' | cat - $< > $@
-
-.s16.o16:
- $(AS) -o $@ $<
-
-.elf.com:
- $(OBJCOPY) -O binary $< $@
-
-
-all : menu.com
-
-menu.elf: startup.o16 main.o16 biosio.o16 string.o16 menu.o16 syslinux.o16
- $(LD) -T com16.ld -o $@ $^
-
-startup.s16: startup.S16
- $(CC) $(CFLAGS) -x assembler-with-cpp -E -o $@ $<
-
-clean:
- -rm -f *.s *.s16 *.o16 *.elf *.com
-
-spotless: clean
- -rm -f *~ \#*
-
-distclean: spotless
- -rm -f main.c
-
+gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \
+ then echo $(1); else echo $(2); fi)
+
+M32 := $(call gcc_ok,-m32,)
+ALIGN := $(call gcc_ok,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
+
+CC = gcc $(M32) -funsigned-char
+CFLAGS = -g -W -Wall -march=i386 $(ALIGN) -Os
+AR = ar
+AS = as
+LD = ld -m elf_i386
+OBJCOPY = objcopy
+RANLIB = ranlib
+
+LIBMENU = biosio.o16 string.o16 menu.o16 syslinux.o16
+
+MENUS = simple.com complex.com
+
+.SUFFIXES: .c .s .s16 .o16 .elf .com
+
+.c.s:
+ $(CC) $(CFLAGS) -S -o $@ $<
+
+.s.s16:
+ echo '.code16gcc' | cat - $< > $@
+
+.s16.o16:
+ $(AS) -o $@ $<
+
+.elf.com:
+ $(OBJCOPY) -O binary $< $@
+
+%.elf: %.o16 startup.o16 com16.ld libmenu.a
+ $(LD) -T com16.ld -o $@ startup.o16 $< libmenu.a
+
+all : $(MENUS)
+
+startup.s16: startup.S16
+ $(CC) $(CFLAGS) -x assembler-with-cpp -E -o $@ $<
+
+libmenu.a: $(LIBMENU)
+ -rm -f $@
+ $(AR) cq $@ $^
+ $(RANLIB) $@
+
+clean:
+ -rm -f *.s *.s16 *.o16 *.elf *.com *.a
+
+spotless: clean
+ -rm -f *~ \#*
diff --git a/menu/README b/menu/README
index 50149782..6f7110d0 100644
--- a/menu/README
+++ b/menu/README
@@ -4,9 +4,11 @@
This is a menu system written by Murali Krishnan Ganapathy and ported
from OpenWatcom to gcc by HPA.
-To configure the menus, you need to set up main.c to have the menu
-items you desire, then build the menu system using make. You can use
-either simple.c or complex.c as a starting point for your own main.c.
+To configure the menus, you need to set up a menu configuration file
+to have the menu items you desire, then build the menu system using
+make. You can use either simple.c or complex.c as a starting point
+for your own menu configuration file; then add the name with a .com
+extension to the MENUS list in the Makefile.
The resulting code runs both under DOS as well as SYSLINUX.
Currently, menu items, submenus and checkboxes are supported.