From 6d9fffcea45d238a0e001d3a53277b6d8ba6b14e Mon Sep 17 00:00:00 2001 From: hpa Date: Wed, 8 Dec 2004 19:42:54 +0000 Subject: [PATCH] Separate modules (intended to be production code used for real stuff) and samples (demo code). --- com32/Makefile | 2 +- com32/modules/Makefile | 5 +-- com32/samples/Makefile | 80 +++++++++++++++++++++++++++++++++ com32/{modules => samples}/fancyhello.c | 0 com32/{modules => samples}/hello.c | 0 com32/{modules => samples}/keytest.c | 0 6 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 com32/samples/Makefile rename com32/{modules => samples}/fancyhello.c (100%) rename com32/{modules => samples}/hello.c (100%) rename com32/{modules => samples}/keytest.c (100%) diff --git a/com32/Makefile b/com32/Makefile index a1fcf5d..5d657ff 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 971dc95..f194cc9 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 0000000..93b7343 --- /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 similarity index 100% rename from com32/modules/fancyhello.c rename to com32/samples/fancyhello.c diff --git a/com32/modules/hello.c b/com32/samples/hello.c similarity index 100% rename from com32/modules/hello.c rename to com32/samples/hello.c diff --git a/com32/modules/keytest.c b/com32/samples/keytest.c similarity index 100% rename from com32/modules/keytest.c rename to com32/samples/keytest.c -- 2.7.4