aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-08-20 15:15:34 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-08-20 15:15:34 -0700
commitbd09a6d828fa492aed4406adde6c412e0e5c640d (patch)
tree660a4813999ba273afb26fd3e137399cb0a57a97 /com32
parent6aa3a1c8380276387430684eb39650e958b0030a (diff)
downloadsyslinux.git-bd09a6d828fa492aed4406adde6c412e0e5c640d.tar.gz
syslinux.git-bd09a6d828fa492aed4406adde6c412e0e5c640d.tar.xz
syslinux.git-bd09a6d828fa492aed4406adde6c412e0e5c640d.zip
Major Makefile cleanups; gcc 4.3.0 compatiblity
Cleanup and centralize the Makefile system even more. Fix a gcc 4.3 incompatibility in memdisk (definition of strlen).
Diffstat (limited to 'com32')
-rw-r--r--com32/MCONFIG68
-rw-r--r--com32/lib/Makefile4
-rw-r--r--com32/libutil/Makefile65
-rw-r--r--com32/menu/Makefile67
-rw-r--r--com32/modules/Makefile70
-rw-r--r--com32/samples/Makefile62
6 files changed, 82 insertions, 254 deletions
diff --git a/com32/MCONFIG b/com32/MCONFIG
new file mode 100644
index 00000000..2b7e018b
--- /dev/null
+++ b/com32/MCONFIG
@@ -0,0 +1,68 @@
+## -*- makefile -*- -------------------------------------------------------
+##
+## Copyright 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., 51 Franklin St, Fifth Floor,
+## Boston MA 02110-1301, USA; either version 2 of the License, or
+## (at your option) any later version; incorporated herein by reference.
+##
+## -----------------------------------------------------------------------
+
+##
+## COM32 common configurables
+##
+
+include $(topdir)/MCONFIG
+
+GCCOPT := $(call gcc_ok,-std=gnu99,) \
+ $(call gcc_ok,-m32,) \
+ $(call gcc_ok,-fno-stack-protector,) \
+ -mregparm=3 -DREGPARM=3 -march=i386 -Os
+
+com32 = $(topdir)/com32
+
+CFLAGS = $(GCCOPT) -W -Wall -march=i386 \
+ -fomit-frame-pointer -D__COM32__ \
+ -nostdinc -iwithprefix include \
+ -I$(com32)/libutil/include -I$(com32)/include
+SFLAGS = $(GCCOPT) -D__COM32__ -march=i386
+LDFLAGS = -m elf_i386 -T $(com32)/lib/com32.ld
+LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
+
+LNXCFLAGS = -I$(com32)/libutil/include -W -Wall -O -g -D_GNU_SOURCE
+LNXSFLAGS = -g
+LNXLDFLAGS = -g
+
+C_LIBS = $(com32)/libutil/libutil_com.a $(com32)/lib/libcom32.a $(LIBGCC)
+C_LNXLIBS = $(com32)/libutil/libutil_lnx.a
+
+.SUFFIXES: .lss .c .lo .o .elf .c32 .lnx
+
+.PRECIOUS: %.o
+%.o: %.S
+ $(CC) $(SFLAGS) -c -o $@ $<
+
+.PRECIOUS: %.o
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.PRECIOUS: %.elf
+%.elf: %.o $(LIBS) $(C_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) $(C_LNXLIBS)
+ $(CC) $(LNXCFLAGS) -o $@ $^
+
+%.c32: %.elf
+ $(OBJCOPY) -O binary $< $@
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index c2b4e3d2..fec93ec7 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -110,8 +110,8 @@ libcom32.a : $(LIBOBJS)
tidy dist:
rm -f sys/vesa/alphatbl.c
- find . -name \*.o -print | xargs -r rm -f
- find . -name .\*.d -print | xargs -r rm -f
+ find . -name \*.o -o -name .\*.d -o -name \*.tmp -print0 | \
+ xargs -0r rm -f
clean: tidy
rm -f *.a
diff --git a/com32/libutil/Makefile b/com32/libutil/Makefile
index 64d78b98..d7967cdb 100644
--- a/com32/libutil/Makefile
+++ b/com32/libutil/Makefile
@@ -29,45 +29,13 @@
## Utility companion library for the COM32 library
##
-TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
-CC = gcc
+topdir = ../..
+include ../MCONFIG
-gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \
- then echo $(1); else echo $(2); fi; rm -f $$tmpf)
-
-GCCOPT := $(call gcc_ok,-std=gnu99,) \
- $(call gcc_ok,-m32,) \
- $(call gcc_ok,-fno-stack-protector,) \
-
-LD = ld -m elf_i386
-AR = ar
-NASM = nasm
-NASMOPT = -O9999
-RANLIB = ranlib
-CFLAGS = $(GCCOPT) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os \
- -fomit-frame-pointer -D__COM32__ \
- -nostdinc -iwithprefix include \
- -I./include -I../include \
- -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d
-SFLAGS = $(M32) -D__COM32__ -march=i386
-LDFLAGS = -T ../lib/com32.ld
-LNXCFLAGS = -I./include -W -Wall -O -g -D_GNU_SOURCE
-LNXSFLAGS = -g
-LNXLDFLAGS = -g
-OBJCOPY = objcopy
LIBOBJS = ansiline.o ansiraw.o get_key.o sha1hash.o unbase64.o \
md5.o crypt-md5.o sha256crypt.o sha512crypt.o base64.o
LNXLIBOBJS = $(patsubst %.o,%.lo,$(LIBOBJS))
-.SUFFIXES: .lss .c .lo .o .elf .c32 .lnx
-
-BINDIR = /usr/bin
-LIBDIR = /usr/lib
-DATADIR = /usr/share
-AUXDIR = $(DATADIR)/syslinux
-INCDIR = /usr/include
-COM32DIR = $(AUXDIR)/com32
-
all: libutil_com.a libutil_lnx.a
libutil_com.a: $(LIBOBJS)
@@ -80,35 +48,8 @@ libutil_lnx.a: $(LNXLIBOBJS)
$(AR) cq $@ $(LNXLIBOBJS)
$(RANLIB) $@
-.PRECIOUS: %.o
-%.o: %.S
- $(CC) $(SFLAGS) -c -o $@ $<
-
-.PRECIOUS: %.o
-%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-.PRECIOUS: %.elf
-%.elf: %.o $(LIB)
- $(LD) $(LDFLAGS) -o $@ $^ $(LIBGCC)
-
-.PRECIOUS: %.lo
-%.lo: %.S
- $(CC) $(LNXSFLAGS) -c -o $@ $<
-
-.PRECIOUS: %.lo
-%.lo: %.c
- $(CC) $(LNXCFLAGS) -c -o $@ $<
-
-.PRECIOUS: %.lnx
-%.lnx: %.lo
- $(CC) $(LNXCFLAGS) -o $@ $^
-
-%.c32: %.elf
- $(OBJCOPY) -O binary $< $@
-
tidy dist:
- rm -f *.o *.lo *.lst *.elf .*.d
+ rm -f *.o *.lo *.lst *.elf .*.d *.tmp
clean: tidy
rm -f *.lss *.a *.c32 *.lnx *.com
diff --git a/com32/menu/Makefile b/com32/menu/Makefile
index 5496c6e6..73cf5867 100644
--- a/com32/menu/Makefile
+++ b/com32/menu/Makefile
@@ -14,46 +14,12 @@
## Simple menu system
##
-TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
-CC = gcc
+topdir = ../..
+include ../MCONFIG
-gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \
- then echo $(1); else echo $(2); fi; rm -f $$tmpf)
-
-GCCOPT := $(call gcc_ok,-std=gnu99,) \
- $(call gcc_ok,-m32,) \
- $(call gcc_ok,-fno-stack-protector,) \
-
-LD = ld -m elf_i386
-AR = ar
-NASM = nasm
-NASMOPT = -O9999
-RANLIB = ranlib
-CFLAGS = $(GCCOPT) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os \
- -fomit-frame-pointer -D__COM32__ \
- -nostdinc -iwithprefix include \
- -I../libutil/include -I../include \
- -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d
-LNXCFLAGS = -W -Wall -O -g -I../libutil/include -D_GNU_SOURCE
-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
-DATADIR = /usr/share
-AUXDIR = $(DATADIR)/syslinux
-INCDIR = /usr/include
-COM32DIR = $(AUXDIR)/com32
-
MODULES = menu.c32 vesamenu.c32
TESTFILES =
@@ -62,33 +28,6 @@ COMMONOBJS = menumain.o readconfig.o passwd.o printmsg.o colors.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 $@ $^
@@ -96,7 +35,7 @@ vesamenu.elf : vesamenu.o $(COMMONOBJS) $(LIBS)
$(LD) $(LDFLAGS) -o $@ $^
tidy dist:
- rm -f *.o *.lo *.a *.lst *.elf .*.d
+ rm -f *.o *.lo *.a *.lst *.elf .*.d *.tmp
clean: tidy
rm -f *.lss *.c32 *.lnx *.com
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index 506f6edd..2f6fb252 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -14,45 +14,8 @@
## COM32 standard modules
##
-TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
-CC = gcc
-
-gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \
- then echo $(1); else echo $(2); fi; rm -f $$tmpf)
-
-GCCOPT := $(call gcc_ok,-std=gnu99,) \
- $(call gcc_ok,-m32,) \
- $(call gcc_ok,-fno-stack-protector,) \
-
-LD = ld -m elf_i386
-AR = ar
-NASM = nasm
-NASMOPT = -O9999
-RANLIB = ranlib
-CFLAGS = $(GCCOPT) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os \
- -fomit-frame-pointer -D__COM32__ \
- -nostdinc -iwithprefix include \
- -I../libutil/include -I../include \
- -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d
-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
-DATADIR = /usr/share
-AUXDIR = $(DATADIR)/syslinux
-INCDIR = /usr/include
-COM32DIR = $(AUXDIR)/com32
+topdir = ../..
+include ../MCONFIG
MODULES = chain.c32 ethersel.c32 mboot.c32 dmitest.c32 cpuidtest.c32 \
pcitest.c32 elf.c32 linux.c32 reboot.c32 pmload.c32 meminfo.c32 \
@@ -62,33 +25,6 @@ TESTFILES =
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 $< $@
-
pcitest.elf : pcitest.o $(LIBS)
$(LD) $(LDFLAGS) -o $@ $^
@@ -102,7 +38,7 @@ ethersel.elf : ethersel.o $(LIBS)
$(LD) $(LDFLAGS) -o $@ $^
tidy dist:
- rm -f *.o *.lo *.a *.lst *.elf .*.d
+ rm -f *.o *.lo *.a *.lst *.elf .*.d *.tmp
clean: tidy
rm -f *.lss *.c32 *.lnx *.com
diff --git a/com32/samples/Makefile b/com32/samples/Makefile
index c06668d9..28260a35 100644
--- a/com32/samples/Makefile
+++ b/com32/samples/Makefile
@@ -14,37 +14,8 @@
## samples for syslinux users
##
-TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
-CC = gcc
-
-gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \
- then echo $(1); else echo $(2); fi; rm -f $$tmpf)
-
-GCCOPT := $(call gcc_ok,-std=gnu99,) \
- $(call gcc_ok,-m32,) \
- $(call gcc_ok,-fno-stack-protector,) \
-
-LD = ld -m elf_i386
-AR = ar
-NASM = nasm
-NASMOPT = -O9999
-RANLIB = ranlib
-CFLAGS = $(GCCOPT) -mregparm=3 -DREGPARM=3 -W -Wall -march=i386 -Os \
- -fomit-frame-pointer -D__COM32__ \
- -nostdinc -iwithprefix include \
- -I../libutil/include -I../include \
- -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d
-LNXCFLAGS = -W -Wall -O -g -I../libutil/include
-LNXSFLAGS = -g
-LNXLDFLAGS = -g
-SFLAGS = -D__COM32__ -march=i386
-LDFLAGS = -T ../lib/com32.ld
-OBJCOPY = objcopy
-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
+topdir = ../..
+include ../MCONFIG
all: hello.c32 cat.c32 resolv.c32 vesainfo.c32 serialinfo.c32 \
localboot.c32 \
@@ -52,35 +23,8 @@ all: hello.c32 cat.c32 resolv.c32 vesainfo.c32 serialinfo.c32 \
keytest.c32 keytest.lnx \
advdump.c32
-.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 dist:
- rm -f *.o *.lo *.a *.lst *.elf .*.d
+ rm -f *.o *.lo *.a *.lst *.elf .*.d *.tmp
clean: tidy
rm -f *.lss *.c32 *.lnx *.com