Separate modules (intended to be production code used for real stuff)
authorhpa <hpa>
Wed, 8 Dec 2004 19:42:54 +0000 (19:42 +0000)
committerhpa <hpa>
Wed, 8 Dec 2004 19:42:54 +0000 (19:42 +0000)
and samples (demo code).

com32/Makefile
com32/modules/Makefile
com32/samples/Makefile [new file with mode: 0644]
com32/samples/fancyhello.c [moved from com32/modules/fancyhello.c with 100% similarity]
com32/samples/hello.c [moved from com32/modules/hello.c with 100% similarity]
com32/samples/keytest.c [moved from com32/modules/keytest.c with 100% similarity]

index a1fcf5d..5d657ff 100644 (file)
@@ -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
index 971dc95..f194cc9 100644 (file)
@@ -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 (file)
index 0000000..93b7343
--- /dev/null
@@ -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 *~ \#*
similarity index 100%
rename from com32/modules/hello.c
rename to com32/samples/hello.c