aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-02-10 22:26:06 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-02-10 22:26:06 -0800
commit9fd7fad275a23cdfad680f56d1199acab675ef2a (patch)
treef1f70293c6f78c8e4a433cdbe95a3b4f942a4bb6 /com32
parent55bf6f17d1e646580342bda77d15878e293faad7 (diff)
downloadsyslinux-elf-9fd7fad275a23cdfad680f56d1199acab675ef2a.tar.gz
syslinux-elf-9fd7fad275a23cdfad680f56d1199acab675ef2a.tar.xz
syslinux-elf-9fd7fad275a23cdfad680f56d1199acab675ef2a.zip
Simple menu system: move to dedicated subdirectory
Move the simple menu system into its own subdirectory, to make it more obvious which source files are part of it.
Diffstat (limited to 'com32')
-rw-r--r--com32/Makefile2
-rw-r--r--com32/menu/Makefile101
-rw-r--r--com32/menu/menu.c (renamed from com32/modules/menu.c)0
-rw-r--r--com32/menu/menu.h (renamed from com32/modules/menu.h)0
-rw-r--r--com32/menu/menumain.c (renamed from com32/modules/menumain.c)0
-rw-r--r--com32/menu/printmsg.c (renamed from com32/modules/printmsg.c)0
-rw-r--r--com32/menu/readconfig.c (renamed from com32/modules/readconfig.c)0
-rw-r--r--com32/menu/vesamenu.c (renamed from com32/modules/vesamenu.c)0
-rw-r--r--com32/modules/Makefile16
9 files changed, 105 insertions, 14 deletions
diff --git a/com32/Makefile b/com32/Makefile
index 090ea93e..32d73563 100644
--- a/com32/Makefile
+++ b/com32/Makefile
@@ -1,4 +1,4 @@
-SUBDIRS = lib libutil modules samples
+SUBDIRS = lib libutil modules menu samples
all tidy clean spotless install:
set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
diff --git a/com32/menu/Makefile b/com32/menu/Makefile
new file mode 100644
index 00000000..118e196c
--- /dev/null
+++ b/com32/menu/Makefile
@@ -0,0 +1,101 @@
+## -----------------------------------------------------------------------
+##
+## Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+## Boston MA 02111-1307, USA; either version 2 of the License, or
+## (at your option) any later version; incorporated herein by reference.
+##
+## -----------------------------------------------------------------------
+
+##
+## Simple menu system
+##
+
+TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
+
+gcc_ok = $(shell tmpf=$(TMPFILE); if gcc $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \
+ then echo $(1); else echo $(2); fi; rm -f $$tmpf)
+
+M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,)
+
+CC = gcc
+LD = ld -m elf_i386
+AR = ar
+NASM = nasm
+NASMOPT = -O9999
+RANLIB = ranlib
+CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os -fomit-frame-pointer -I../libutil/include -I../include -D__COM32__
+LNXCFLAGS = -W -Wall -O -g -I../libutil/include
+LNXSFLAGS = -g
+LNXLDFLAGS = -g
+SFLAGS = -D__COM32__ -march=i386
+LDFLAGS = -T ../lib/com32.ld
+OBJCOPY = objcopy
+PPMTOLSS16 = ../ppmtolss16
+LIBGCC := $(shell $(CC) --print-libgcc)
+LIBS = ../libutil/libutil_com.a ../lib/libcom32.a $(LIBGCC)
+LNXLIBS = ../libutil/libutil_lnx.a
+
+.SUFFIXES: .lss .c .o .elf .c32 .lnx
+
+BINDIR = /usr/bin
+LIBDIR = /usr/lib
+AUXDIR = $(LIBDIR)/syslinux
+INCDIR = /usr/include
+COM32DIR = $(AUXDIR)/com32
+
+MODULES = menu.c32 vesamenu.c32
+TESTFILES =
+
+COMMONOBJS = menumain.o readconfig.o printmsg.o
+
+all: $(MODULES) $(TESTFILES)
+
+.PRECIOUS: %.o
+%.o: %.S
+ $(CC) $(SFLAGS) -c -o $@ $<
+
+.PRECIOUS: %.o
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.PRECIOUS: %.elf
+%.elf: %.o $(LIBS)
+ $(LD) $(LDFLAGS) -o $@ $^
+
+.PRECIOUS: %.lo
+%.lo: %.S
+ $(CC) $(LNXSFLAGS) -c -o $@ $<
+
+.PRECIOUS: %.lo
+%.lo: %.c
+ $(CC) $(LNXCFLAGS) -c -o $@ $<
+
+.PRECIOUS: %.lnx
+%.lnx: %.lo $(LNXLIBS)
+ $(CC) $(LNXLDFLAGS) -o $@ $^
+
+%.c32: %.elf
+ $(OBJCOPY) -O binary $< $@
+
+menu.elf : menu.o $(COMMONOBJS) $(LIBS)
+ $(LD) $(LDFLAGS) -o $@ $^
+
+vesamenu.elf : vesamenu.o $(COMMONOBJS) $(LIBS)
+ $(LD) $(LDFLAGS) -o $@ $^
+
+tidy:
+ rm -f *.o *.lo *.a *.lst *.elf
+
+clean: tidy
+ rm -f *.lss *.c32 *.lnx *.com
+
+spotless: clean
+ rm -f *~ \#*
+
+install: all
+ mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
+ install -m 644 $(MODULES) $(INSTALLROOT)$(AUXDIR)
diff --git a/com32/modules/menu.c b/com32/menu/menu.c
index acc19f59..acc19f59 100644
--- a/com32/modules/menu.c
+++ b/com32/menu/menu.c
diff --git a/com32/modules/menu.h b/com32/menu/menu.h
index 1c516ef2..1c516ef2 100644
--- a/com32/modules/menu.h
+++ b/com32/menu/menu.h
diff --git a/com32/modules/menumain.c b/com32/menu/menumain.c
index fad49a28..fad49a28 100644
--- a/com32/modules/menumain.c
+++ b/com32/menu/menumain.c
diff --git a/com32/modules/printmsg.c b/com32/menu/printmsg.c
index 128bbc03..128bbc03 100644
--- a/com32/modules/printmsg.c
+++ b/com32/menu/printmsg.c
diff --git a/com32/modules/readconfig.c b/com32/menu/readconfig.c
index 5de9a7da..5de9a7da 100644
--- a/com32/modules/readconfig.c
+++ b/com32/menu/readconfig.c
diff --git a/com32/modules/vesamenu.c b/com32/menu/vesamenu.c
index 495cfb82..495cfb82 100644
--- a/com32/modules/vesamenu.c
+++ b/com32/menu/vesamenu.c
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index 0347c17c..6291a6a4 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -11,7 +11,7 @@
## -----------------------------------------------------------------------
##
-## samples for syslinux users
+## COM32 standard modules
##
TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
@@ -47,9 +47,8 @@ AUXDIR = $(LIBDIR)/syslinux
INCDIR = /usr/include
COM32DIR = $(AUXDIR)/com32
-MODULES = chain.c32 menu.c32 vesamenu.c32 ethersel.c32 mboot.c32 \
- dmitest.c32 cpuidtest.c32 pcitest.c32 elf.c32 linux.c32 \
- reboot.c32 pmload.c32 meminfo.c32
+MODULES = chain.c32 ethersel.c32 mboot.c32 dmitest.c32 cpuidtest.c32 \
+ pcitest.c32 elf.c32 linux.c32 reboot.c32 pmload.c32 meminfo.c32
TESTFILES =
all: $(MODULES) $(TESTFILES)
@@ -90,18 +89,9 @@ cpuidtest.elf : cpuidtest.o cpuid.o $(LIBS)
dmitest.elf : dmitest.o dmi_utils.o dmi.o $(LIBS)
$(LD) $(LDFLAGS) -o $@ $^
-menu.elf : menu.o menumain.o readconfig.o printmsg.o $(LIBS)
- $(LD) $(LDFLAGS) -o $@ $^
-
-vesamenu.elf : vesamenu.o menumain.o readconfig.o printmsg.o $(LIBS)
- $(LD) $(LDFLAGS) -o $@ $^
-
ethersel.elf : ethersel.o $(LIBS)
$(LD) $(LDFLAGS) -o $@ $^
-menu.lnx : menu.lo readconfig.lo $(LNXLIBS)
- $(CC) $(LNXLDFLAGS) -o $@ $^
-
tidy:
rm -f *.o *.lo *.a *.lst *.elf