Clean up embedded Makefile targets; fix build failure
authorH. Peter Anvin <hpa@zytor.com>
Fri, 22 Aug 2008 21:42:40 +0000 (14:42 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 22 Aug 2008 21:42:40 +0000 (14:42 -0700)
Unify common pieces to "embedded" targets (those that produce code
that runs neither in the host nor in a com32 environment); this fixes
the broken sample/ directory Makefile.

MCONFIG
MCONFIG.embedded [new file with mode: 0644]
com32/menu/Makefile
com32/modules/Makefile
dos/Makefile
mbr/Makefile
memdisk/Makefile
memdump/Makefile
sample/Makefile

diff --git a/MCONFIG b/MCONFIG
index 6919ce7..9900ac4 100644 (file)
--- a/MCONFIG
+++ b/MCONFIG
@@ -50,3 +50,5 @@ NM       = nm
 RANLIB   = ranlib
 GZIPPROG = gzip
 PNGTOPNM = pngtopnm
+
+com32    = $(topdir)/com32
diff --git a/MCONFIG.embedded b/MCONFIG.embedded
new file mode 100644 (file)
index 0000000..fee374f
--- /dev/null
@@ -0,0 +1,35 @@
+## -*- makefile -*- ------------------------------------------------------
+##
+##   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.
+##
+## -----------------------------------------------------------------------
+
+##
+## Make configuration for embedded directories
+##
+
+include $(topdir)/MCONFIG
+
+GCCOPT    := $(call gcc_ok,-m32,) \
+            $(call gcc_ok,-ffreestanding,) \
+            $(call gcc_ok,-fno-stack-protector,) \
+            $(call gcc_ok,-falign-functions=0,-malign-functions=0) \
+            $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) \
+            $(call gcc_ok,-falign-loops=0,-malign-loops=0) \
+            -march=i386 -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 \
+            -msoft-float
+
+LIBGCC    := $(shell $(CC) $(GCCOPT) --print-libgcc)
+
+LD        += -m elf_i386
+CFLAGS     = $(GCCOPT) -g -W -Wall $(OPTFLAGS) $(INCLUDES)
+SFLAGS     = $(CFLAGS) -D__ASSEMBLY__
+
+.SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss
+
index 73cf586..cfdea06 100644 (file)
@@ -28,10 +28,10 @@ COMMONOBJS = menumain.o readconfig.o passwd.o printmsg.o colors.o \
 
 all: $(MODULES) $(TESTFILES)
 
-menu.elf : menu.o $(COMMONOBJS) $(LIBS)
+menu.elf : menu.o $(COMMONOBJS) $(LIBS) $(C_LIBS)
        $(LD) $(LDFLAGS) -o $@ $^
 
-vesamenu.elf : vesamenu.o $(COMMONOBJS) $(LIBS)
+vesamenu.elf : vesamenu.o $(COMMONOBJS) $(LIBS) $(C_LIBS)
        $(LD) $(LDFLAGS) -o $@ $^
 
 tidy dist:
index 2f6fb25..691e929 100644 (file)
@@ -25,16 +25,16 @@ TESTFILES =
 
 all: $(MODULES) $(TESTFILES)
 
-pcitest.elf : pcitest.o $(LIBS)
+pcitest.elf : pcitest.o $(LIBS) $(C_LIBS)
        $(LD) $(LDFLAGS) -o $@ $^
 
-cpuidtest.elf : cpuidtest.o cpuid.o $(LIBS)
+cpuidtest.elf : cpuidtest.o cpuid.o $(LIBS) $(C_LIBS)
        $(LD) $(LDFLAGS) -o $@ $^
 
-dmitest.elf : dmitest.o dmi_utils.o dmi.o $(LIBS)
+dmitest.elf : dmitest.o dmi_utils.o dmi.o $(LIBS) $(C_LIBS)
        $(LD) $(LDFLAGS) -o $@ $^
 
-ethersel.elf : ethersel.o $(LIBS)
+ethersel.elf : ethersel.o $(LIBS) $(C_LIBS)
        $(LD) $(LDFLAGS) -o $@ $^
 
 tidy dist:
index 028e833..da73a6d 100644 (file)
 ##
 
 topdir = ..
-include $(topdir)/MCONFIG
+include $(topdir)/MCONFIG.embedded
 
-GCCOPT    := $(call gcc_ok,-m32,) \
-            $(call gcc_ok,-ffreestanding,) \
-            $(call gcc_ok,-fno-stack-protector,) \
-            $(call gcc_ok,-falign-functions=0,-malign-functions=0) \
-            $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) \
-            $(call gcc_ok,-falign-loops=0,-malign-loops=0) \
-            -march=i386 -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 \
-            -msoft-float
-
-LIBGCC  := $(shell $(CC) $(GCCOPT) --print-libgcc)
-
-LDFLAGS         = -m elf_i386 -T com16.ld
+LDFLAGS         = -T com16.ld
 OPTFLAGS = -g
 INCLUDES = -include code16.h -nostdinc -iwithprefix include \
           -I. -I.. -I../libfat -I ../libinstaller
-CFLAGS  = $(GCCOPT) -W -Wall -msoft-float $(OPTFLAGS) $(INCLUDES)
 
 SRCS     = syslinux.c \
           ../libinstaller/syslxmod.c \
@@ -44,8 +32,6 @@ OBJS   = crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
 LIBOBJS         = conio.o memcpy.o memset.o  skipatou.o atou.o malloc.o free.o \
           argv.o printf.o __divdi3.o __udivmoddi4.o
 
-.SUFFIXES: .c .o .i .s .S .elf .com .asm .lst
-
 VPATH = .:../libfat:../libinstaller
 
 TARGETS = syslinux.com copybs.com
index 6ae6371..7952e60 100644 (file)
 #
 
 topdir = ..
-include $(topdir)/MCONFIG
-
-GCCOPT    := $(call gcc_ok,-m32,) \
-            $(call gcc_ok,-ffreestanding,) \
-            $(call gcc_ok,-fno-stack-protector) \
-            -march=i386 -Os
-
-LDFLAGS           = -m elf_i386
-SFLAGS    = $(GCCOPT)
-
-.SUFFIXES: .S .s .o .elf
+include $(topdir)/MCONFIG.embedded
 
 all:   mbr.bin gptmbr.bin
 
index 66a6e51..d3023a0 100644 (file)
 ## -----------------------------------------------------------------------
 
 topdir = ..
-include $(topdir)/MCONFIG
+include $(topdir)/MCONFIG.embedded
 -include $(topdir)/version.mk
 
-GCCOPT    := $(call gcc_ok,-m32,) \
-            $(call gcc_ok,-ffreestanding,) \
-            $(call gcc_ok,-fno-stack-protector) \
-            $(call gcc_ok,-falign-functions=0,-malign-functions=0) \
-            $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) \
-            $(call gcc_ok,-falign-loops=0,-malign-loops=0) \
-            -march=i386 -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3
-
 CFLAGS   = $(GCCOPT) -g -W -Wall -Wno-sign-compare -DDATE='"$(DATE)"'
 SFLAGS  = $(GCCOPT) -D__ASSEMBLY__
 LDFLAGS  = $(GCCOPT) -g
 INCLUDE  = -I$(topdir)/com32/include
-LD     += -m elf_i386
 NASM     = nasm
 NASMOPT  = -O9999
 NFLAGS   = -dDATE='"$(DATE)"' -dWITH_EDD
 NINCLUDE =
-OBJCOPY  = objcopy
-PERL     = perl
 
 SRCS    = $(wildcard *.asm *.c *.h)
 
index 4467723..6696020 100644 (file)
 ##
 
 topdir = ..
-include $(topdir)/MCONFIG
-
-GCCOPT    := $(call gcc_ok,-m32,) \
-            $(call gcc_ok,-ffreestanding,) \
-            $(call gcc_ok,-fno-stack-protector,) \
-            $(call gcc_ok,-falign-functions=0,-malign-functions=0) \
-            $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) \
-            $(call gcc_ok,-falign-loops=0,-malign-loops=0) \
-            -march=i386 -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 \
-            -msoft-float
-
-LD      += -m elf_i386
-OPTFLAGS = -g
+include $(topdir)/MCONFIG.embedded
+
+OPTFLAGS = 
 INCLUDES = -include code16.h -I.
-CFLAGS  = $(GCCOPT) -W -Wall $(OPTFLAGS) $(INCLUDES)
 LDFLAGS         = -T com16.ld
 
 SRCS     = main.c serial.c ymsend.c
index d9df458..8560b3e 100644 (file)
 ##
 
 topdir = ..
-include $(topdir)/MCONFIG
+include $(topdir)/MCONFIG.embedded
+
+INCLUDES   = -I$(com32)/include
 
-LD        += -m elf_i386
-CFLAGS     = $(GCCOPT) -W -Wall -I$(topdir)/com32/include
-SFLAGS     = $(GCCOPT)
-LDFLAGS    = -s
 PPMTOLSS16 = $(topdir)/utils/ppmtolss16
 LIB       = liboldcom32.a
 
 LIBOBJS           = conio.o atou.o skipatou.o printf.o c32exit.o
 
-.SUFFIXES: .lss .c .o .elf .c32
-
 all: syslogo.lss comecho.com hello.c32 hello2.c32 filetest.c32 c32echo.c32 \
      fd.c32 $(LIB)