summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-05-29 15:11:38 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-05-29 15:11:38 -0700
commitb536209dfb7bd50c37061735fe10d2c19a97d26d (patch)
tree9d8ca6882fc5d9721fb0efea1abfd6dc09886814
parent3ec40a0119587f63411475c76c69f9db24c7598e (diff)
downloadsyslinux-b536209dfb7bd50c37061735fe10d2c19a97d26d.tar.gz
Move files out of root into core, dos, and utils
Move source files out of the root directory; the root is a mess and has become virtually unmaintainable. The Syslinux core now lives in core/; the Linux and generic utilities has moved into utils/, and copybs.com has moved into dos/; it had to go somewhere, and it seemed as good a place as any.
-rw-r--r--.gitignore10
-rw-r--r--Makefile155
-rw-r--r--checkov.pl80
-rw-r--r--com32/Makefile2
-rw-r--r--com32/lib/Makefile2
-rw-r--r--com32/libutil/Makefile2
-rw-r--r--com32/menu/Makefile2
-rw-r--r--com32/modules/Makefile2
-rw-r--r--com32/samples/Makefile2
-rw-r--r--core/Makefile174
-rw-r--r--core/abort.inc (renamed from abort.inc)0
-rw-r--r--core/adv.inc (renamed from adv.inc)0
-rw-r--r--core/bcopy32.inc (renamed from bcopy32.inc)0
-rw-r--r--core/bios.inc (renamed from bios.inc)0
-rw-r--r--core/bootsect.inc (renamed from bootsect.inc)0
-rw-r--r--core/cache.inc (renamed from cache.inc)0
-rwxr-xr-xcore/checksumiso.pl (renamed from checksumiso.pl)0
-rw-r--r--core/cleanup.inc (renamed from cleanup.inc)0
-rw-r--r--core/cmdline.inc (renamed from cmdline.inc)0
-rw-r--r--core/com32.inc (renamed from com32.inc)0
-rw-r--r--core/comboot.inc (renamed from comboot.inc)0
-rw-r--r--core/config.inc (renamed from config.inc)2
-rw-r--r--core/configinit.inc (renamed from configinit.inc)0
-rw-r--r--core/conio.inc (renamed from conio.inc)0
-rw-r--r--core/cpuinit.inc (renamed from cpuinit.inc)0
-rw-r--r--core/dnsresolv.inc (renamed from dnsresolv.inc)0
-rw-r--r--core/ext2_fs.inc (renamed from ext2_fs.inc)0
-rw-r--r--core/extlinux.asm (renamed from extlinux.asm)0
-rw-r--r--core/font.inc (renamed from font.inc)0
-rwxr-xr-xcore/genhash.pl (renamed from genhash.pl)0
-rw-r--r--core/getc.inc (renamed from getc.inc)0
-rw-r--r--core/graphics.inc (renamed from graphics.inc)0
-rw-r--r--core/head.inc (renamed from head.inc)1
-rw-r--r--core/highmem.inc (renamed from highmem.inc)0
-rw-r--r--core/init.inc (renamed from init.inc)0
-rw-r--r--core/isolinux-debug.asm (renamed from isolinux-debug.asm)0
-rw-r--r--core/isolinux.asm (renamed from isolinux.asm)0
-rw-r--r--core/kernel.inc (renamed from kernel.inc)0
-rw-r--r--core/keywords (renamed from keywords)0
-rw-r--r--core/keywords.inc (renamed from keywords.inc)0
-rw-r--r--core/layout.inc (renamed from layout.inc)0
-rw-r--r--core/ldlinux.asm (renamed from ldlinux.asm)0
-rw-r--r--core/loadhigh.inc (renamed from loadhigh.inc)0
-rw-r--r--core/localboot.inc (renamed from localboot.inc)0
-rwxr-xr-xcore/lstadjust.pl (renamed from lstadjust.pl)0
-rw-r--r--core/macros.inc (renamed from macros.inc)0
-rw-r--r--core/now.pl (renamed from now.pl)0
-rw-r--r--core/parsecmd.inc (renamed from parsecmd.inc)0
-rw-r--r--core/parseconfig.inc (renamed from parseconfig.inc)0
-rw-r--r--core/plaincon.inc (renamed from plaincon.inc)0
-rw-r--r--core/pxe.inc (renamed from pxe.inc)0
-rw-r--r--core/pxelinux.asm (renamed from pxelinux.asm)0
-rw-r--r--core/rawcon.inc (renamed from rawcon.inc)0
-rw-r--r--core/regdump.inc (renamed from regdump.inc)0
-rw-r--r--core/rllpack.inc (renamed from rllpack.inc)0
-rw-r--r--core/runkernel.inc (renamed from runkernel.inc)0
-rw-r--r--core/stack.inc (renamed from stack.inc)0
-rw-r--r--core/strcpy.inc (renamed from strcpy.inc)0
-rw-r--r--core/strecpy.inc (renamed from strecpy.inc)0
-rw-r--r--core/syslinux.ld (renamed from syslinux.ld)0
-rw-r--r--core/tracers.inc (renamed from tracers.inc)0
-rw-r--r--core/ui.inc (renamed from ui.inc)0
-rw-r--r--core/writehex.inc (renamed from writehex.inc)0
-rw-r--r--core/writestr.inc (renamed from writestr.inc)0
-rw-r--r--dos/Makefile21
-rw-r--r--dos/copybs.asm (renamed from copybs.asm)0
-rw-r--r--extlinux/Makefile6
-rw-r--r--gpxe/Makefile37
-rw-r--r--gpxe/src/Config2
-rw-r--r--linux/Makefile (renamed from unix/Makefile)6
-rw-r--r--linux/syslinux.c (renamed from unix/syslinux.c)0
-rw-r--r--mbr/Makefile16
-rw-r--r--memdisk/Makefile2
-rw-r--r--memdump/Makefile2
-rw-r--r--menu/Makefile2
-rw-r--r--mtools/Makefile7
-rw-r--r--sample/Makefile4
-rw-r--r--utils/Makefile58
-rw-r--r--[-rwxr-xr-x]utils/bin2hex.pl (renamed from bin2hex.pl)0
-rw-r--r--utils/gethostip.c (renamed from gethostip.c)0
-rwxr-xr-xutils/keytab-lilo (renamed from keytab-lilo.pl)0
-rwxr-xr-xutils/lss16toppm (renamed from lss16toppm)0
-rwxr-xr-xutils/md5pass (renamed from md5pass)0
-rw-r--r--[-rwxr-xr-x]utils/mkdiskimage.in (renamed from mkdiskimage.in)0
-rwxr-xr-xutils/ppmtolss16 (renamed from ppmtolss16)0
-rwxr-xr-xutils/sha1pass (renamed from sha1pass)0
-rwxr-xr-xutils/syslinux2ansi (renamed from syslinux2ansi.pl)0
-rw-r--r--win32/Makefile9
88 files changed, 354 insertions, 252 deletions
diff --git a/.gitignore b/.gitignore
index cd35dd2f..46ed808e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,15 +21,17 @@
*.sys
*_bin.c
*~
+\#*
+.\#*
.depend
com32/lib/sys/vesa/alphatbl.c
extlinux/extlinux
-gethostip
memdisk/memdisk
-mkdiskimage
mtools/syslinux
release
sample/syslogo.lss
-unix/syslinux
-unix/syslinux-nomtools
+linux/syslinux
+linux/syslinux-nomtools
+utils/gethostip
+utils/mkdiskimage
version.h
diff --git a/Makefile b/Makefile
index e1b71917..d522cade 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,8 @@ MAKE += -r
TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
+CC = gcc
+
gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) dummy.c -o $$tmpf 2>/dev/null; \
then echo '$(1)'; else echo '$(2)'; fi; rm -f $$tmpf)
@@ -27,7 +29,6 @@ comma := ,
LDHASH := $(call gcc_ok,-Wl$(comma)--hash-style=both,)
OSTYPE = $(shell uname -msr)
-CC = gcc
INCLUDE =
CFLAGS = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
PIC = -fPIC
@@ -66,71 +67,43 @@ VERSION = $(shell cat version)
# with their own Makefiles. Finally, there is a list of those
# directories.
#
-CSRC = gethostip.c
-NASMSRC = $(wildcard *.asm)
-SOURCES = $(CSRC) *.h $(NASMSRC) *.inc
-
-# _bin.c files required by both BTARGET and ITARGET installers
-BINFILES = bootsect_bin.c ldlinux_bin.c mbr_bin.c \
- extlinux_bss_bin.c extlinux_sys_bin.c
# syslinux.exe is BTARGET so as to not require everyone to have the
# mingw suite installed
-BTARGET = kwdhash.gen version.gen version.h \
- ldlinux.bss ldlinux.sys ldlinux.bin \
- pxelinux.0 gpxelinux.0 isolinux.bin isolinux-debug.bin \
- extlinux.bin extlinux.bss extlinux.sys
-BOBJECTS = $(BTARGET) mbr/mbr.bin dos/syslinux.com win32/syslinux.exe \
+BTARGET = version.gen version.h
+BOBJECTS = $(BTARGET) \
+ mbr/mbr.bin mbr/gptmbr.bin \
+ core/pxelinux.0 core/isolinux.bin core/isolinux-debug.bin \
+ gpxe/gpxelinux.0 dos/syslinux.com win32/syslinux.exe \
memdisk/memdisk memdump/memdump.com
# BESUBDIRS and IESUBDIRS are "early", i.e. before the root; BSUBDIRS
# and ISUBDIRS are "late", after the root.
-BESUBDIRS = mbr
-BSUBDIRS = memdisk memdump dos win32
-ITARGET = copybs.com gethostip mkdiskimage
-IOBJECTS = $(ITARGET) mtools/syslinux unix/syslinux extlinux/extlinux
+BESUBDIRS = mbr core
+BSUBDIRS = memdisk memdump gpxe dos win32
+ITARGET =
+IOBJECTS = $(ITARGET) dos/copybs.com utils/gethostip utils/mkdiskimage \
+ mtools/syslinux linux/syslinux extlinux/extlinux
IESUBDIRS =
-ISUBDIRS = mtools unix extlinux sample com32
-DOCS = COPYING NEWS README TODO BUGS *.doc sample menu com32
-OTHER = Makefile bin2c.pl now.pl genhash.pl keywords findpatch.pl \
- keytab-lilo.pl version version.pl sys2ansi.pl \
- ppmtolss16 lss16toppm memdisk bin2hex.pl mkdiskimage.in \
- sha1pass md5pass
-OBSOLETE = pxelinux.bin
+ISUBDIRS = mtools linux extlinux utils com32 sample
# Things to install in /usr/bin
-INSTALL_BIN = mtools/syslinux gethostip ppmtolss16 lss16toppm \
- sha1pass md5pass
+INSTALL_BIN = mtools/syslinux utils/gethostip utils/ppmtolss16 \
+ utils/lss16toppm utils/sha1pass utils/md5pass
# Things to install in /sbin
INSTALL_SBIN = extlinux/extlinux
# Things to install in /usr/lib/syslinux
-INSTALL_AUX = pxelinux.0 gpxelinux.0 isolinux.bin isolinux-debug.bin \
- dos/syslinux.com copybs.com memdisk/memdisk mbr/mbr.bin
+INSTALL_AUX = core/pxelinux.0 gpxe/gpxelinux.0 core/isolinux.bin \
+ core/isolinux-debug.bin \
+ dos/syslinux.com dos/copybs.com memdisk/memdisk mbr/mbr.bin
INSTALL_AUX_OPT = win32/syslinux.exe
-# The DATE is set on the make command line when building binaries for
-# official release. Otherwise, substitute a hex string that is pretty much
-# guaranteed to be unique to be unique from build to build.
-ifndef HEXDATE
-HEXDATE := $(shell $(PERL) now.pl ldlinux.asm pxelinux.asm isolinux.asm)
-endif
-ifndef DATE
-DATE := $(HEXDATE)
-endif
-MAKE += DATE=$(DATE) HEXDATE=$(HEXDATE)
-
-#
-# NOTE: If you don't have the mingw compiler suite installed, you probably
-# want to remove win32 from this list; otherwise you're going to get an
-# error every time you try to build.
-#
-
all:
set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) ; do $(MAKE) -C $$i $@ ; done
$(MAKE) all-local
set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
-ls -l $(BOBJECTS) $(IOBJECTS)
-all-local: $(BTARGET) $(ITARGET) $(BINFILES)
+all-local: $(BTARGET) $(ITARGET)
installer:
set -e ; for i in $(IESUBDIRS); do $(MAKE) -C $$i all ; done
@@ -146,74 +119,6 @@ version.gen: version version.pl
version.h: version version.pl
$(PERL) version.pl $< $@ '#define'
-kwdhash.gen: keywords genhash.pl
- $(PERL) genhash.pl < keywords > kwdhash.gen
-
-.PRECIOUS: %.elf
-
-# Standard rule for {isolinux,isolinux-debug}.bin
-iso%.bin: iso%.elf
- $(OBJCOPY) -O binary $< $@
- $(PERL) checksumiso.pl $@
-
-# Standard rule for {ldlinux,pxelinux,extlinux}.bin
-%.bin: %.elf
- $(OBJCOPY) -O binary $< $@
-
-%.o: %.asm kwdhash.gen version.gen
- $(NASM) $(NASMOPT) -f elf -F stabs -DDATE_STR="'$(DATE)'" \
- -DHEXDATE="$(HEXDATE)" \
- -l $(@:.o=.lsr) -o $@ $<
-
-%.elf: %.o syslinux.ld
- $(LD) -m elf_i386 -T syslinux.ld -M -o $@ $< > $(@:.elf=.map)
- $(OBJDUMP) -h $@ > $(@:.elf=.sec)
- $(PERL) lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst)
-
-pxelinux.0: pxelinux.bin
- cp -f $< $@
-
-gpxelinux.0: pxelinux.0
- $(MAKE) -C gpxe/src bin/undionly.kpxe
- cp -f gpxe/src/bin/undionly.kpxe $@
-
-ldlinux.bss: ldlinux.bin
- dd if=$< of=$@ bs=512 count=1
-
-ldlinux.sys: ldlinux.bin
- dd if=$< of=$@ bs=512 skip=1
-
-extlinux.bss: extlinux.bin
- dd if=$< of=$@ bs=512 count=1
-
-extlinux.sys: extlinux.bin
- dd if=$< of=$@ bs=512 skip=1
-
-mbr_bin.c: mbr/mbr.bin bin2c.pl
- $(PERL) bin2c.pl syslinux_mbr < $< > $@
-
-copybs.com: copybs.asm
- $(NASM) $(NASMOPT) -f bin -l copybs.lst -o copybs.com copybs.asm
-
-bootsect_bin.c: ldlinux.bss bin2c.pl
- $(PERL) bin2c.pl syslinux_bootsect < $< > $@
-
-ldlinux_bin.c: ldlinux.sys bin2c.pl
- $(PERL) bin2c.pl syslinux_ldlinux < $< > $@
-
-extlinux_bss_bin.c: extlinux.bss bin2c.pl
- $(PERL) bin2c.pl extlinux_bootsect < $< > $@
-
-extlinux_sys_bin.c: extlinux.sys bin2c.pl
- $(PERL) bin2c.pl extlinux_image 512 < $< > $@
-
-gethostip: gethostip.o
- $(CC) $(LDFLAGS) -o $@ $^
-
-mkdiskimage: mkdiskimage.in mbr/mbr.bin bin2hex.pl
- $(PERL) bin2hex.pl < mbr/mbr.bin | cat mkdiskimage.in - > $@
- chmod a+x $@
-
install: installer
mkdir -m 755 -p $(INSTALLROOT)$(BINDIR)
install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR)
@@ -246,7 +151,6 @@ local-tidy:
tidy: local-tidy
set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
- $(MAKE) -C gpxe/src veryclean
local-clean:
rm -f $(ITARGET)
@@ -254,36 +158,29 @@ local-clean:
clean: local-tidy local-clean
set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
-dist: tidy
+local-dist:
find . \( -name '*~' -o -name '#*' -o -name core \
-o -name '.*.d' -o -name .depend \) -type f -print0 \
| xargs -0rt rm -f
+dist: local-dist local-tidy
+ set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
+
local-spotless:
rm -f $(BTARGET) .depend *.so.*
-spotless: local-clean dist local-spotless
+spotless: local-clean local-dist local-spotless
set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
-.depend:
- rm -f .depend
- for csrc in $(CSRC) ; do $(CC) $(INCLUDE) -MM $$csrc >> .depend ; done
- for nsrc in $(NASMSRC) ; do $(NASM) -DDEPEND $(NINCLUDE) -o `echo $$nsrc | sed -e 's/\.asm/\.o/'` -M $$nsrc >> .depend ; done
-
local-depend:
- rm -f .depend
- $(MAKE) .depend
depend: local-depend
$(MAKE) -C memdisk depend
-# Shortcut to build unix/syslinux using klibc
+# Shortcut to build linux/syslinux using klibc
klibc:
$(MAKE) clean
- $(MAKE) CC=klcc ITARGET= ISUBDIRS='unix extlinux' BSUBDIRS=
+ $(MAKE) CC=klcc ITARGET= ISUBDIRS='linux extlinux' BSUBDIRS=
# Hook to add private Makefile targets for the maintainer.
-include Makefile.private
-
-# Include dependencies file
-include .depend
diff --git a/checkov.pl b/checkov.pl
deleted file mode 100644
index c7f018c8..00000000
--- a/checkov.pl
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/perl
-#
-# checkov.pl
-#
-# Check NASM map output for overflow
-#
-# This assumes that a section for which start != vstart, both
-# ranges need to be checked for overflow (true for SYSLINUX)
-#
-
-($in, $target) = @ARGV;
-
-sub overlap($$$$) {
- my($s1,$e1,$s2,$e2) = @_;
-
- return 1 if ( $s2 < $e1 && $e2 > $s1 );
- return 1 if ( $s1 < $e2 && $e1 > $s2 );
-
- return 0;
-}
-
-open(IN, '<', $in) or die "$0: Cannot open input file: $in\n";
-
-$section = undef;
-while ( $line = <IN> ) {
- if ( $line =~ /^-/ ) {
- if ( $line =~ /^\-\-\-\- Section (\S+) / ) {
- $section = $1;
- } else {
- $section = undef;
- }
- } elsif ( defined($section) ) {
- if ( $line =~ /^length\:\s*(\S+)/ ) {
- $length{$section} = hex $1;
- } elsif ( $line =~ /^start\:\s*(\S+)/ ) {
- $start{$section} = hex $1;
- } elsif ( $line =~ /^vstart\:\s*(\S+)/ ) {
- $vstart{$section} = hex $1;
- }
- }
-}
-close(IN);
-
-$err = 0;
-
-foreach $s ( keys(%start) ) {
- $sstart = $start{$s};
- $svstart = $vstart{$s};
- $send = $sstart + $length{$s};
- $svend = $svstart + $length{$s};
-
- if ( $send > 0x10000 || $svend > 0x10000 ) {
- print STDERR "$target: 16-bit overflow on section $s\n";
- $err++;
- }
-
- foreach $o ( keys(%start) ) {
- next if ( $s ge $o );
-
- $ostart = $start{$o};
- $ovstart = $vstart{$o};
- $oend = $ostart + $length{$o};
- $ovend = $ovstart + $length{$o};
-
- if ( overlap($sstart, $send, $ostart, $oend) ||
- overlap($svstart, $svend, $ostart, $oend) ||
- overlap($sstart, $send, $ovstart, $ovend) ||
- overlap($svstart, $svend, $ovstart, $ovend) ) {
- print STDERR "$target: section $s overlaps section $o\n";
- $err++;
- }
- }
-}
-
-if ( $err ) {
- unlink($target);
- exit(1);
-} else {
- exit(0);
-}
diff --git a/com32/Makefile b/com32/Makefile
index 32d73563..bfb8e3a6 100644
--- a/com32/Makefile
+++ b/com32/Makefile
@@ -1,4 +1,4 @@
SUBDIRS = lib libutil modules menu samples
-all tidy clean spotless install:
+all tidy dist clean spotless install:
set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index adc36605..c2c80362 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -107,7 +107,7 @@ libcom32.a : $(LIBOBJS)
$(AR) cq $@ $^
$(RANLIB) $@
-tidy:
+tidy dist:
rm -f sys/vesa/alphatbl.c
find . -name \*.o -print | xargs -r rm -f
find . -name .\*.d -print | xargs -r rm -f
diff --git a/com32/libutil/Makefile b/com32/libutil/Makefile
index 01de06a3..4ae9af48 100644
--- a/com32/libutil/Makefile
+++ b/com32/libutil/Makefile
@@ -104,7 +104,7 @@ libutil_lnx.a: $(LNXLIBOBJS)
%.c32: %.elf
$(OBJCOPY) -O binary $< $@
-tidy:
+tidy dist:
rm -f *.o *.lo *.lst *.elf .*.d
clean: tidy
diff --git a/com32/menu/Makefile b/com32/menu/Makefile
index 8d7b69f4..17d6f5f8 100644
--- a/com32/menu/Makefile
+++ b/com32/menu/Makefile
@@ -92,7 +92,7 @@ menu.elf : menu.o $(COMMONOBJS) $(LIBS)
vesamenu.elf : vesamenu.o $(COMMONOBJS) $(LIBS)
$(LD) $(LDFLAGS) -o $@ $^
-tidy:
+tidy dist:
rm -f *.o *.lo *.a *.lst *.elf .*.d
clean: tidy
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index 9890228f..d67f997d 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -98,7 +98,7 @@ dmitest.elf : dmitest.o dmi_utils.o dmi.o $(LIBS)
ethersel.elf : ethersel.o $(LIBS)
$(LD) $(LDFLAGS) -o $@ $^
-tidy:
+tidy dist:
rm -f *.o *.lo *.a *.lst *.elf .*.d
clean: tidy
diff --git a/com32/samples/Makefile b/com32/samples/Makefile
index 77feb58c..bad0676f 100644
--- a/com32/samples/Makefile
+++ b/com32/samples/Makefile
@@ -78,7 +78,7 @@ all: hello.c32 cat.c32 resolv.c32 vesainfo.c32 serialinfo.c32 \
%.c32: %.elf
$(OBJCOPY) -O binary $< $@
-tidy:
+tidy dist:
rm -f *.o *.lo *.a *.lst *.elf .*.d
clean: tidy
diff --git a/core/Makefile b/core/Makefile
new file mode 100644
index 00000000..de39acad
--- /dev/null
+++ b/core/Makefile
@@ -0,0 +1,174 @@
+## -----------------------------------------------------------------------
+##
+## Copyright 1998-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.
+##
+## -----------------------------------------------------------------------
+
+#
+# Makefile for the SYSLINUX core
+#
+
+# No builtin rules
+MAKEFLAGS += -r
+MAKE += -r
+
+CC = gcc
+
+TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
+gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) dummy.c -o $$tmpf 2>/dev/null; \
+ then echo '$(1)'; else echo '$(2)'; fi; rm -f $$tmpf)
+
+M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) \
+ $(call gcc_ok,-fno-stack-protector,) \
+ $(call gcc_ok,-fno-top-level-reorder,$(call gcc_ok,-fno-unit-at-a-time))
+
+LD = ld
+LDFLAGS = -m elf_i386
+OBJCOPY = objcopy
+OBJDUMP = objdump
+
+OPTFLAGS = -g -Os -march=i386 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer
+INCLUDES =
+CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -msoft-float $(OPTFLAGS) $(INCLUDES)
+
+NASM = nasm
+NASMOPT = -O9999
+NINCLUDE =
+
+PERL = perl
+
+VERSION := $(shell cat ../version)
+
+# _bin.c files required by both BTARGET and ITARGET installers
+BINFILES = bootsect_bin.c ldlinux_bin.c \
+ extlinux_bss_bin.c extlinux_sys_bin.c
+
+# syslinux.exe is BTARGET so as to not require everyone to have the
+# mingw suite installed
+BTARGET = kwdhash.gen \
+ ldlinux.bss ldlinux.sys ldlinux.bin \
+ pxelinux.0 isolinux.bin isolinux-debug.bin \
+ extlinux.bin extlinux.bss extlinux.sys
+ITARGET =
+
+# All primary source files for the main syslinux files
+NASMSRC = $(wildcard *.asm)
+NASMHDR = $(wildcard *.inc)
+CSRC = $(wildcard *.c)
+CHDR = $(wildcard *.h)
+OTHERSRC = keywords
+ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(CHDR) $(OTHERSRC)
+
+# The DATE is set on the make command line when building binaries for
+# official release. Otherwise, substitute a hex string that is pretty much
+# guaranteed to be unique to be unique from build to build.
+ifndef HEXDATE
+HEXDATE := $(shell $(PERL) now.pl $(SRCS))
+endif
+ifndef DATE
+DATE := $(HEXDATE)
+endif
+
+#
+# NOTE: If you don't have the mingw compiler suite installed, you probably
+# want to remove win32 from this list; otherwise you're going to get an
+# error every time you try to build.
+#
+
+all: all-local
+
+all-local: $(BTARGET) $(BINFILES)
+
+installer: installer-local
+
+installer-local: $(ITARGET) $(BINFILES)
+
+kwdhash.gen: keywords genhash.pl
+ $(PERL) genhash.pl < keywords > kwdhash.gen
+
+.PRECIOUS: %.elf
+
+# Standard rule for {isolinux,isolinux-debug}.bin
+iso%.bin: iso%.elf
+ $(OBJCOPY) -O binary $< $@
+ $(PERL) checksumiso.pl $@
+
+# Standard rule for {ldlinux,pxelinux,extlinux}.bin
+%.bin: %.elf
+ $(OBJCOPY) -O binary $< $@
+
+%.o: %.asm kwdhash.gen ../version.gen
+ $(NASM) $(NASMOPT) -f elf -F stabs -DDATE_STR="'$(DATE)'" \
+ -DHEXDATE="$(HEXDATE)" \
+ -l $(@:.o=.lsr) -o $@ $<
+
+%.elf: %.o syslinux.ld
+ $(LD) $(LDFLAGS) -T syslinux.ld -M -o $@ $< > $(@:.elf=.map)
+ $(OBJDUMP) -h $@ > $(@:.elf=.sec)
+ $(PERL) lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst)
+
+pxelinux.0: pxelinux.bin
+ cp -f $< $@
+
+ldlinux.bss: ldlinux.bin
+ dd if=$< of=$@ bs=512 count=1
+
+ldlinux.sys: ldlinux.bin
+ dd if=$< of=$@ bs=512 skip=1
+
+extlinux.bss: extlinux.bin
+ dd if=$< of=$@ bs=512 count=1
+
+extlinux.sys: extlinux.bin
+ dd if=$< of=$@ bs=512 skip=1
+
+bootsect_bin.c: ldlinux.bss ../bin2c.pl
+ $(PERL) ../bin2c.pl syslinux_bootsect < $< > $@
+
+ldlinux_bin.c: ldlinux.sys ../bin2c.pl
+ $(PERL) ../bin2c.pl syslinux_ldlinux < $< > $@
+
+extlinux_bss_bin.c: extlinux.bss ../bin2c.pl
+ $(PERL) ../bin2c.pl extlinux_bootsect < $< > $@
+
+extlinux_sys_bin.c: extlinux.sys ../bin2c.pl
+ $(PERL) ../bin2c.pl extlinux_image 512 < $< > $@
+
+install: installer
+
+install-lib: installer
+
+install-all: install install-lib
+
+netinstall: installer
+
+tidy dist:
+ rm -f *.o *.elf *_bin.c stupid.* patch.offset
+ rm -f *.lsr *.lst *.map *.sec
+ rm -f $(OBSOLETE)
+
+clean: tidy
+ rm -f $(ITARGET)
+
+spotless: clean
+ rm -f $(BTARGET) .depend *.so.*
+
+.depend:
+ rm -f .depend
+ for csrc in $(CSRC) ; do $(CC) $(INCLUDE) -MM $$csrc >> .depend ; done
+ for nsrc in $(NASMSRC) ; do $(NASM) -DDEPEND $(NINCLUDE) -o `echo $$nsrc | sed -e 's/\.asm/\.o/'` -M $$nsrc >> .depend ; done
+
+local-depend:
+ rm -f .depend
+ $(MAKE) .depend
+
+depend: local-depend
+
+# Include dependencies file
+include .depend
diff --git a/abort.inc b/core/abort.inc
index 0f443829..0f443829 100644
--- a/abort.inc
+++ b/core/abort.inc
diff --git a/adv.inc b/core/adv.inc
index c5e8270c..c5e8270c 100644
--- a/adv.inc
+++ b/core/adv.inc
diff --git a/bcopy32.inc b/core/bcopy32.inc
index fd14409f..fd14409f 100644
--- a/bcopy32.inc
+++ b/core/bcopy32.inc
diff --git a/bios.inc b/core/bios.inc
index 987a2166..987a2166 100644
--- a/bios.inc
+++ b/core/bios.inc
diff --git a/bootsect.inc b/core/bootsect.inc
index 7e8f416d..7e8f416d 100644
--- a/bootsect.inc
+++ b/core/bootsect.inc
diff --git a/cache.inc b/core/cache.inc
index 59755576..59755576 100644
--- a/cache.inc
+++ b/core/cache.inc
diff --git a/checksumiso.pl b/core/checksumiso.pl
index b5527428..b5527428 100755
--- a/checksumiso.pl
+++ b/core/checksumiso.pl
diff --git a/cleanup.inc b/core/cleanup.inc
index dca6491a..dca6491a 100644
--- a/cleanup.inc
+++ b/core/cleanup.inc
diff --git a/cmdline.inc b/core/cmdline.inc
index 5d5b3c22..5d5b3c22 100644
--- a/cmdline.inc
+++ b/core/cmdline.inc
diff --git a/com32.inc b/core/com32.inc
index 99954206..99954206 100644
--- a/com32.inc
+++ b/core/com32.inc
diff --git a/comboot.inc b/core/comboot.inc
index df9bb001..df9bb001 100644
--- a/comboot.inc
+++ b/core/comboot.inc
diff --git a/config.inc b/core/config.inc
index f0f59ce4..f696f291 100644
--- a/config.inc
+++ b/core/config.inc
@@ -47,7 +47,7 @@ MAX_FKEYS equ 12 ; Number of F-key help files
; Version number definitinons
;
%ifndef DEPEND ; Generated file
-%include "version.gen"
+%include "../version.gen"
%endif
;
diff --git a/configinit.inc b/core/configinit.inc
index cf6a814c..cf6a814c 100644
--- a/configinit.inc
+++ b/core/configinit.inc
diff --git a/conio.inc b/core/conio.inc
index 47005961..47005961 100644
--- a/conio.inc
+++ b/core/conio.inc
diff --git a/cpuinit.inc b/core/cpuinit.inc
index fd62cc77..fd62cc77 100644
--- a/cpuinit.inc
+++ b/core/cpuinit.inc
diff --git a/dnsresolv.inc b/core/dnsresolv.inc
index f31c578b..f31c578b 100644
--- a/dnsresolv.inc
+++ b/core/dnsresolv.inc
diff --git a/ext2_fs.inc b/core/ext2_fs.inc
index e84efb14..e84efb14 100644
--- a/ext2_fs.inc
+++ b/core/ext2_fs.inc
diff --git a/extlinux.asm b/core/extlinux.asm
index 6c2946c2..6c2946c2 100644
--- a/extlinux.asm
+++ b/core/extlinux.asm
diff --git a/font.inc b/core/font.inc
index be9a365c..be9a365c 100644
--- a/font.inc
+++ b/core/font.inc
diff --git a/genhash.pl b/core/genhash.pl
index c79139fd..c79139fd 100755
--- a/genhash.pl
+++ b/core/genhash.pl
diff --git a/getc.inc b/core/getc.inc
index b36115ca..b36115ca 100644
--- a/getc.inc
+++ b/core/getc.inc
diff --git a/graphics.inc b/core/graphics.inc
index 2b8290fc..2b8290fc 100644
--- a/graphics.inc
+++ b/core/graphics.inc
diff --git a/head.inc b/core/head.inc
index 928f07fb..37f1b36f 100644
--- a/head.inc
+++ b/core/head.inc
@@ -18,6 +18,7 @@
;
%ifndef _HEAD_INC
+%define _HEAD_INC
%include "macros.inc"
%include "config.inc"
diff --git a/highmem.inc b/core/highmem.inc
index 1cd46dd9..1cd46dd9 100644
--- a/highmem.inc
+++ b/core/highmem.inc
diff --git a/init.inc b/core/init.inc
index 0b213ace..0b213ace 100644
--- a/init.inc
+++ b/core/init.inc
diff --git a/isolinux-debug.asm b/core/isolinux-debug.asm
index 9c74b7cd..9c74b7cd 100644
--- a/isolinux-debug.asm
+++ b/core/isolinux-debug.asm
diff --git a/isolinux.asm b/core/isolinux.asm
index 52d426f9..52d426f9 100644
--- a/isolinux.asm
+++ b/core/isolinux.asm
diff --git a/kernel.inc b/core/kernel.inc
index 0da03638..0da03638 100644
--- a/kernel.inc
+++ b/core/kernel.inc
diff --git a/keywords b/core/keywords
index d7d8fa65..d7d8fa65 100644
--- a/keywords
+++ b/core/keywords
diff --git a/keywords.inc b/core/keywords.inc
index b6a701bb..b6a701bb 100644
--- a/keywords.inc
+++ b/core/keywords.inc
diff --git a/layout.inc b/core/layout.inc
index 51460e14..51460e14 100644
--- a/layout.inc
+++ b/core/layout.inc
diff --git a/ldlinux.asm b/core/ldlinux.asm
index 86de4588..86de4588 100644
--- a/ldlinux.asm
+++ b/core/ldlinux.asm
diff --git a/loadhigh.inc b/core/loadhigh.inc
index 63041483..63041483 100644
--- a/loadhigh.inc
+++ b/core/loadhigh.inc
diff --git a/localboot.inc b/core/localboot.inc
index b6b31deb..b6b31deb 100644
--- a/localboot.inc
+++ b/core/localboot.inc
diff --git a/lstadjust.pl b/core/lstadjust.pl
index cec54029..cec54029 100755
--- a/lstadjust.pl
+++ b/core/lstadjust.pl
diff --git a/macros.inc b/core/macros.inc
index f5e2c924..f5e2c924 100644
--- a/macros.inc
+++ b/core/macros.inc
diff --git a/now.pl b/core/now.pl
index a3b5a798..a3b5a798 100644
--- a/now.pl
+++ b/core/now.pl
diff --git a/parsecmd.inc b/core/parsecmd.inc
index 8e648699..8e648699 100644
--- a/parsecmd.inc
+++ b/core/parsecmd.inc
diff --git a/parseconfig.inc b/core/parseconfig.inc
index 2ef9c3a2..2ef9c3a2 100644
--- a/parseconfig.inc
+++ b/core/parseconfig.inc
diff --git a/plaincon.inc b/core/plaincon.inc
index 59b2cbb5..59b2cbb5 100644
--- a/plaincon.inc
+++ b/core/plaincon.inc
diff --git a/pxe.inc b/core/pxe.inc
index 7471c4f0..7471c4f0 100644
--- a/pxe.inc
+++ b/core/pxe.inc
diff --git a/pxelinux.asm b/core/pxelinux.asm
index ce3250bc..ce3250bc 100644
--- a/pxelinux.asm
+++ b/core/pxelinux.asm
diff --git a/rawcon.inc b/core/rawcon.inc
index 10d7a764..10d7a764 100644
--- a/rawcon.inc
+++ b/core/rawcon.inc
diff --git a/regdump.inc b/core/regdump.inc
index 59a48c09..59a48c09 100644
--- a/regdump.inc
+++ b/core/regdump.inc
diff --git a/rllpack.inc b/core/rllpack.inc
index a556e00a..a556e00a 100644
--- a/rllpack.inc
+++ b/core/rllpack.inc
diff --git a/runkernel.inc b/core/runkernel.inc
index abd23782..abd23782 100644
--- a/runkernel.inc
+++ b/core/runkernel.inc
diff --git a/stack.inc b/core/stack.inc
index f670dec0..f670dec0 100644
--- a/stack.inc
+++ b/core/stack.inc
diff --git a/strcpy.inc b/core/strcpy.inc
index 2bafa7fe..2bafa7fe 100644
--- a/strcpy.inc
+++ b/core/strcpy.inc
diff --git a/strecpy.inc b/core/strecpy.inc
index 1fc53e96..1fc53e96 100644
--- a/strecpy.inc
+++ b/core/strecpy.inc
diff --git a/syslinux.ld b/core/syslinux.ld
index 3c55820f..3c55820f 100644
--- a/syslinux.ld
+++ b/core/syslinux.ld
diff --git a/tracers.inc b/core/tracers.inc
index a51209fa..a51209fa 100644
--- a/tracers.inc
+++ b/core/tracers.inc
diff --git a/ui.inc b/core/ui.inc
index 3fc3e639..3fc3e639 100644
--- a/ui.inc
+++ b/core/ui.inc
diff --git a/writehex.inc b/core/writehex.inc
index 1dbe4ab3..1dbe4ab3 100644
--- a/writehex.inc
+++ b/core/writehex.inc
diff --git a/writestr.inc b/core/writestr.inc
index 04ad67a6..04ad67a6 100644
--- a/writestr.inc
+++ b/core/writestr.inc
diff --git a/dos/Makefile b/dos/Makefile
index 04550dab..85df1509 100644
--- a/dos/Makefile
+++ b/dos/Makefile
@@ -9,35 +9,38 @@ M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) \
$(call gcc_ok,-fno-stack-protector,) \
$(call gcc_ok,-fno-top-level-reorder,$(call gcc_ok,-fno-unit-at-a-time))
-LD = ld -m elf_i386
+NASM = nasm
+NASMOPT = -O9999
+
+LD = ld
+LDFLAGS = -m elf_i386 -T com16.ld
OBJCOPY = objcopy
OPTFLAGS = -g -Os -march=i386 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer
INCLUDES = -include code16.h -nostdinc -iwithprefix include \
-I. -I.. -I../libfat -I ../libinstaller
CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -msoft-float $(OPTFLAGS) $(INCLUDES)
-LDFLAGS = -T com16.ld
AR = ar
RANLIB = ranlib
LIBGCC := $(shell $(CC) --print-libgcc)
SRCS = syslinux.c \
../libinstaller/syslxmod.c \
- ../bootsect_bin.c ../ldlinux_bin.c ../mbr_bin.c \
+ ../core/bootsect_bin.c ../core/ldlinux_bin.c ../mbr/mbr_bin.c \
$(wildcard ../libfat/*.c)
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
+.SUFFIXES: .c .o .i .s .S .elf .com .asm .lst
-VPATH = .:..:../libfat:../libinstaller
+VPATH = .:../libfat:../libinstaller:../core:../mbr
-TARGETS = syslinux.com
+TARGETS = syslinux.com copybs.com
all: $(TARGETS)
-tidy:
- -rm -f *.o *.i *.s *.a .*.d *.elf
+tidy dist:
+ -rm -f *.o *.i *.s *.a .*.d *.elf *.lst
clean: tidy
@@ -67,5 +70,7 @@ syslinux.com: syslinux.elf
$(CC) -Wp,-MT,$@,-MD,.$@.d $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
%.s: %.S
$(CC) $(CFLAGS) -E -o $@ $<
+%.com: %.asm
+ $(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
-include .*.d
diff --git a/copybs.asm b/dos/copybs.asm
index 26407148..26407148 100644
--- a/copybs.asm
+++ b/dos/copybs.asm
diff --git a/extlinux/Makefile b/extlinux/Makefile
index 88d4d1a9..dec87396 100644
--- a/extlinux/Makefile
+++ b/extlinux/Makefile
@@ -13,16 +13,16 @@ CFLAGS = -W -Wall -Wno-sign-compare -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUD
LDFLAGS = $(LDHASH) # -s
SRCS = main.c ../libinstaller/setadv.c \
- ../extlinux_bss_bin.c ../extlinux_sys_bin.c
+ ../core/extlinux_bss_bin.c ../core/extlinux_sys_bin.c
OBJS = $(patsubst %.c,%.o,$(notdir $(SRCS)))
.SUFFIXES: .c .o .i .s .S
-VPATH = .:..:../libinstaller
+VPATH = .:../libinstaller:../core
all: installer
-tidy:
+tidy dist:
-rm -f *.o *.i *.s *.a .*.d
clean: tidy
diff --git a/gpxe/Makefile b/gpxe/Makefile
new file mode 100644
index 00000000..2868cbc2
--- /dev/null
+++ b/gpxe/Makefile
@@ -0,0 +1,37 @@
+## -----------------------------------------------------------------------
+##
+## 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.
+##
+## -----------------------------------------------------------------------
+
+#
+# Makefile for gpxe/gpxelinux.0
+#
+# Very simple, really...
+#
+
+TARGETS = gpxelinux.0
+
+all: $(TARGETS)
+
+tidy:
+
+clean: tidy
+ rm -f $(TARGETS)
+
+dist:
+ $(MAKE) -C src veryclean
+
+spotless: clean dist
+
+installer:
+
+gpxelinux.0: ../core/pxelinux.0
+ $(MAKE) -C src EMBEDDED_IMAGE=../$< bin/undionly.kpxe
+ cp -f src/bin/undionly.kpxe $@
diff --git a/gpxe/src/Config b/gpxe/src/Config
index 210718d4..d4ed2348 100644
--- a/gpxe/src/Config
+++ b/gpxe/src/Config
@@ -383,4 +383,4 @@ CFLAGS_wd = -DINCLUDE_WD -DWD_DEFAULT_MEM=0xCC000
#
# SYSLINUX: Local addition to build PXELINUX combined image
#
-EMBEDDED_IMAGE = ../../pxelinux.0
+EMBEDDED_IMAGE = ../core/pxelinux.0
diff --git a/unix/Makefile b/linux/Makefile
index 07f97d67..678dc9be 100644
--- a/unix/Makefile
+++ b/linux/Makefile
@@ -13,16 +13,16 @@ CFLAGS = -W -Wall -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
LDFLAGS = $(LDHASH) -s
SRCS = syslinux.c ../libinstaller/syslxmod.c \
- ../bootsect_bin.c ../ldlinux_bin.c
+ ../core/bootsect_bin.c ../core/ldlinux_bin.c
OBJS = $(patsubst %.c,%.o,$(notdir $(SRCS)))
.SUFFIXES: .c .o .i .s .S
-VPATH = .:..:../libinstaller
+VPATH = .:../libinstaller:../core
all: installer
-tidy:
+tidy dist:
-rm -f *.o *.i *.s *.a .*.d
clean: tidy
diff --git a/unix/syslinux.c b/linux/syslinux.c
index 37a54fd0..37a54fd0 100644
--- a/unix/syslinux.c
+++ b/linux/syslinux.c
diff --git a/mbr/Makefile b/mbr/Makefile
index 76a47e05..7aa56eae 100644
--- a/mbr/Makefile
+++ b/mbr/Makefile
@@ -22,34 +22,40 @@ gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>
M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector)
CC = gcc
-LD = ld -m elf_i386
+LD = ld
+LDFLAGS = -m elf_i386
SFLAGS = $(M32) -march=i386
OBJCOPY = objcopy
PERL = perl
.SUFFIXES: .S .s .o .elf
-all: mbr.bin gptmbr.bin
+all: mbr.bin mbr_bin.c gptmbr.bin gptmbr_bin.c
.PRECIOUS: %.o
%.o: %.S
$(CC) $(SFLAGS) -Wa,-a=$*.lst -c -o $@ $<
+%_bin.c: %.bin ../bin2c.pl
+ $(PERL) ../bin2c.pl syslinux_$* < $< > $@
+
mbr.elf: mbr.o mbr.ld
- $(LD) -T mbr.ld -e _start -o $@ $<
+ $(LD) $(LDFLAGS) -T mbr.ld -e _start -o $@ $<
mbr.bin: mbr.elf checksize.pl
$(OBJCOPY) -O binary $< $@
$(PERL) checksize.pl mbr.bin 440
+mbr_bin.c: mbr.bin
+
gptmbr.elf: gptmbr.o mbr.ld
- $(LD) -T mbr.ld -e _start -o $@ $<
+ $(LD) $(LDFLAGS) -T mbr.ld -e _start -o $@ $<
gptmbr.bin: gptmbr.elf checksize.pl
$(OBJCOPY) -O binary $< $@
$(PERL) checksize.pl gptmbr.bin 424
-tidy:
+tidy dist:
rm -f *.o *.elf *.lst
clean: tidy
diff --git a/memdisk/Makefile b/memdisk/Makefile
index 3c288ca4..d30fe853 100644
--- a/memdisk/Makefile
+++ b/memdisk/Makefile
@@ -49,7 +49,7 @@ NASMSRC = memdisk.asm memdisk16.asm
all: memdisk # e820test
# tidy, clean removes everything except the final binary
-tidy:
+tidy dist:
rm -f *.o *.s *.o16 *.s16 *.bin *.lst *.elf e820test
clean: tidy
diff --git a/memdump/Makefile b/memdump/Makefile
index 60c4229b..3f195336 100644
--- a/memdump/Makefile
+++ b/memdump/Makefile
@@ -30,7 +30,7 @@ TARGETS = memdump.com
all: $(TARGETS)
-tidy:
+tidy dist:
-rm -f *.o *.i *.s *.a .*.d *.elf
clean: tidy
diff --git a/menu/Makefile b/menu/Makefile
index 58c0e2f0..04d2e225 100644
--- a/menu/Makefile
+++ b/menu/Makefile
@@ -74,7 +74,7 @@ libmenu/libmenu.a: $(LIBMENU)
$(AR) cq $@ $^
$(RANLIB) $@
-tidy:
+tidy dist:
rm -f *.o *.lo *.a *.lst *.elf
libclean:
diff --git a/mtools/Makefile b/mtools/Makefile
index a53e378f..d3cdf81e 100644
--- a/mtools/Makefile
+++ b/mtools/Makefile
@@ -12,17 +12,18 @@ INCLUDES = -I. -I.. -I../libfat -I../libinstaller
CFLAGS = -W -Wall -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
LDFLAGS = $(LDHASH) -s
-SRCS = syslinux.c ../syslxmod.c ../bootsect_bin.c ../ldlinux_bin.c \
+SRCS = syslinux.c ../libinstaller/syslxmod.c \
+ ../core/bootsect_bin.c ../core/ldlinux_bin.c \
$(wildcard ../libfat/*.c)
OBJS = $(patsubst %.c,%.o,$(notdir $(SRCS)))
.SUFFIXES: .c .o .i .s .S
-VPATH = .:..:../libfat:../libinstaller
+VPATH = .:../libfat:../libinstaller:../core
all: installer
-tidy:
+tidy dist:
-rm -f *.o *.i *.s *.a .*.d
clean: tidy
diff --git a/sample/Makefile b/sample/Makefile
index d2a00f9b..d10b5ed1 100644
--- a/sample/Makefile
+++ b/sample/Makefile
@@ -32,7 +32,7 @@ CFLAGS = $(M32) -W -Wall -march=i386 -Os -fomit-frame-pointer -I../com32/inc
SFLAGS = $(M32) -march=i386
LDFLAGS = -s
OBJCOPY = objcopy
-PPMTOLSS16 = ../ppmtolss16
+PPMTOLSS16 = ../utils/ppmtolss16
LIB = liboldcom32.a
GZIPPROG = gzip
PNGTOPNM = pngtopnm
@@ -75,7 +75,7 @@ $(LIB): $(LIBOBJS)
%.ppm.gz: %.png
$(PNGTOPNM) $< | gzip -9 > $@
-tidy:
+tidy dist:
rm -f *.o *.a *.lst *.elf
# Don't specify *.com since mdiskchk.com can't be built using Linux tools
diff --git a/utils/Makefile b/utils/Makefile
new file mode 100644
index 00000000..0c5a3636
--- /dev/null
+++ b/utils/Makefile
@@ -0,0 +1,58 @@
+## -----------------------------------------------------------------------
+##
+## Copyright 1998-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.
+##
+## -----------------------------------------------------------------------
+
+#
+# SYSLINUX utilities
+#
+# No builtin rules
+MAKEFLAGS += -r
+MAKE += -r
+
+TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
+
+CC = gcc
+
+gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) dummy.c -o $$tmpf 2>/dev/null; \
+ then echo '$(1)'; else echo '$(2)'; fi; rm -f $$tmpf)
+
+comma := ,
+LDHASH := $(call gcc_ok,-Wl$(comma)--hash-style=both,)
+
+CFLAGS = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
+LDFLAGS = -O2 -s $(LDHASH)
+LD = ld
+PERL = perl
+
+TARGETS = mkdiskimage gethostip
+ASIS = keytab-lilo lss16toppm md5pass ppmtolss16 sha1pass syslinux2ansi
+
+all: mkdiskimage gethostip
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+mkdiskimage: mkdiskimage.in ../mbr/mbr.bin bin2hex.pl
+ $(PERL) bin2hex.pl < ../mbr/mbr.bin | cat mkdiskimage.in - > $@
+ chmod a+x $@
+
+gethostip: gethostip.o
+ $(CC) $(LDFLAGS) -o $@ $^
+
+tidy dist:
+ rm -f *.o
+
+clean: tidy
+ rm -f $(TARGETS)
+
+spotless: clean
+
+installer: all
diff --git a/bin2hex.pl b/utils/bin2hex.pl
index 3c86ec27..3c86ec27 100755..100644
--- a/bin2hex.pl
+++ b/utils/bin2hex.pl
diff --git a/gethostip.c b/utils/gethostip.c
index 2a1e6e65..2a1e6e65 100644
--- a/gethostip.c
+++ b/utils/gethostip.c
diff --git a/keytab-lilo.pl b/utils/keytab-lilo
index 867be7e2..867be7e2 100755
--- a/keytab-lilo.pl
+++ b/utils/keytab-lilo
diff --git a/lss16toppm b/utils/lss16toppm
index 18b7f642..18b7f642 100755
--- a/lss16toppm
+++ b/utils/lss16toppm
diff --git a/md5pass b/utils/md5pass
index 3404f1d6..3404f1d6 100755
--- a/md5pass
+++ b/utils/md5pass
diff --git a/mkdiskimage.in b/utils/mkdiskimage.in
index f66ad7cf..f66ad7cf 100755..100644
--- a/mkdiskimage.in
+++ b/utils/mkdiskimage.in
diff --git a/ppmtolss16 b/utils/ppmtolss16
index 5af90831..5af90831 100755
--- a/ppmtolss16
+++ b/utils/ppmtolss16
diff --git a/sha1pass b/utils/sha1pass
index 3be2dbc1..3be2dbc1 100755
--- a/sha1pass
+++ b/utils/sha1pass
diff --git a/syslinux2ansi.pl b/utils/syslinux2ansi
index 085f6c97..085f6c97 100755
--- a/syslinux2ansi.pl
+++ b/utils/syslinux2ansi
diff --git a/win32/Makefile b/win32/Makefile
index ed0ad0ab..99766151 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -47,11 +47,12 @@ WINCC_IS_GOOD := $(shell $(WINCC) $(WINCFLAGS) $(WINLDFLAGS) -o hello.exe hello.
.SUFFIXES: .c .o .i .s .S
-SRCS = syslinux.c ../syslxmod.c ../bootsect_bin.c ../ldlinux_bin.c \
- ../mbr_bin.c $(wildcard ../libfat/*.c)
+SRCS = syslinux.c ../libinstaller/syslxmod.c \
+ ../core/bootsect_bin.c ../core/ldlinux_bin.c \
+ ../mbr/mbr_bin.c $(wildcard ../libfat/*.c)
OBJS = $(patsubst %.c,%.o,$(notdir $(SRCS)))
-VPATH = .:..:../libfat:../libinstaller
+VPATH = .:../libfat:../libinstaller:../core:../mbr
TARGETS = syslinux.exe
@@ -62,7 +63,7 @@ all:
rm -f $(TARGETS)
endif
-tidy:
+tidy dist:
-rm -f *.o *.i *.s *.a .*.d *_bin.c hello.exe
clean: tidy