aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhpa <hpa>2004-12-08 19:42:54 +0000
committerhpa <hpa>2004-12-08 19:42:54 +0000
commit6d9fffcea45d238a0e001d3a53277b6d8ba6b14e (patch)
treef801567dd914f805249b6935dc94cc0231b23618
parent9d8d831238b6b9b0cd3fcec17b0fe8ea1d7db5c7 (diff)
downloadsyslinux.git-6d9fffcea45d238a0e001d3a53277b6d8ba6b14e.tar.gz
syslinux.git-6d9fffcea45d238a0e001d3a53277b6d8ba6b14e.tar.xz
syslinux.git-6d9fffcea45d238a0e001d3a53277b6d8ba6b14e.zip
Separate modules (intended to be production code used for real stuff)
and samples (demo code).
-rw-r--r--com32/Makefile2
-rw-r--r--com32/modules/Makefile5
-rw-r--r--com32/samples/Makefile80
-rw-r--r--com32/samples/fancyhello.c (renamed from com32/modules/fancyhello.c)0
-rw-r--r--com32/samples/hello.c (renamed from com32/modules/hello.c)0
-rw-r--r--com32/samples/keytest.c (renamed from com32/modules/keytest.c)0
6 files changed, 82 insertions, 5 deletions
diff --git a/com32/Makefile b/com32/Makefile
index a1fcf5d8..5d657ff4 100644
--- a/com32/Makefile
+++ b/com32/Makefile
@@ -1,4 +1,4 @@
-SUBDIRS = lib libutil modules
+SUBDIRS = lib libutil modules samples
all tidy clean spotless:
for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index 971dc95c..f194cc93 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -39,10 +39,7 @@ LNXLIBS = ../libutil/libutil_lnx.a
.SUFFIXES: .lss .c .o .elf .c32 .lnx
-all: hello.c32 \
- fancyhello.c32 fancyhello.lnx \
- keytest.c32 keytest.lnx \
- chain.c32
+all: chain.c32
.PRECIOUS: %.o
%.o: %.S
diff --git a/com32/samples/Makefile b/com32/samples/Makefile
new file mode 100644
index 00000000..93b7343a
--- /dev/null
+++ b/com32/samples/Makefile
@@ -0,0 +1,80 @@
+#ident "$Id$"
+## -----------------------------------------------------------------------
+##
+## Copyright 2001-2004 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., 675 Mass Ave, Cambridge MA 02139,
+## USA; either version 2 of the License, or (at your option) any later
+## version; incorporated herein by reference.
+##
+## -----------------------------------------------------------------------
+
+##
+## samples for syslinux users
+##
+
+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,)
+
+CC = gcc $(M32)
+LD = ld -m elf_i386
+AR = ar
+NASM = nasm
+RANLIB = ranlib
+CFLAGS = -W -Wall -march=i386 -Os -fomit-frame-pointer -I../libutil/include -I../include -D__COM32__
+LNXCFLAGS = -W -Wall -march=i386 -Os -g -I../libutil/include
+LNXSFLAGS = -march=i386
+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
+
+all: hello.c32 \
+ fancyhello.c32 fancyhello.lnx \
+ keytest.c32 keytest.lnx
+
+.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 $< $@
+
+tidy:
+ rm -f *.o *.lo *.a *.lst *.elf
+
+clean: tidy
+ rm -f *.lss *.c32 *.lnx *.com
+
+spotless: clean
+ rm -f *~ \#*
diff --git a/com32/modules/fancyhello.c b/com32/samples/fancyhello.c
index cf255fbc..cf255fbc 100644
--- a/com32/modules/fancyhello.c
+++ b/com32/samples/fancyhello.c
diff --git a/com32/modules/hello.c b/com32/samples/hello.c
index 7d0504bc..7d0504bc 100644
--- a/com32/modules/hello.c
+++ b/com32/samples/hello.c
diff --git a/com32/modules/keytest.c b/com32/samples/keytest.c
index e9af9ac6..e9af9ac6 100644
--- a/com32/modules/keytest.c
+++ b/com32/samples/keytest.c