# Main Makefile for SYSLINUX
#
-NASM = nasm
-CC = gcc
-CFLAGS = -Wall -O2 -fomit-frame-pointer
-LDFLAGS = -O2 -s
+CC = gcc
+INCLUDE =
+CFLAGS = -Wall -O2 -fomit-frame-pointer
+LDFLAGS = -O2 -s
-BINDIR = /usr/bin
-LIBDIR = /usr/lib/syslinux
+NASM = nasm
+NINCLUDE =
+BINDIR = /usr/bin
+LIBDIR = /usr/lib/syslinux
-VERSION = $(shell cat version)
+VERSION = $(shell cat version)
.c.o:
- $(CC) $(CFLAGS) -c $<
+ $(CC) $(INCLUDE) $(CFLAGS) -c $<
#
# The BTARGET refers to objects that are derived from ldlinux.asm; we
# like to keep those uniform for debugging reasons; however, distributors
# want to recompile the installers (ITARGET).
#
-SOURCES = ldlinux.asm syslinux.asm syslinux.c copybs.asm \
- pxelinux.asm pxe.inc mbr.asm gethostip.c \
- isolinux.asm
+CSRC = syslinux.c gethostip.c
+NASMSRC = ldlinux.asm syslinux.asm copybs.asm \
+ pxelinux.asm mbr.asm isolinux.asm
+SOURCES = $(CSRC) $(NASMSRC) *.inc
BTARGET = ldlinux.bss ldlinux.sys ldlinux.bin ldlinux.lst \
pxelinux.0 mbr.bin isolinux.bin isolinux-debug.bin
ITARGET = syslinux.com syslinux copybs.com gethostip
done
local-spotless:
- rm -f $(BTARGET)
+ rm -f $(BTARGET) .depend
spotless: local-clean dist local-spotless
$(MAKE) -C sample spotless
$(MAKE) -C memdisk spotless
-#
+.depend:
+ rm -f .depend
+ for csrc in $(CSRC) ; do $(CC) $(INCLUDE) -M $$csrc >> .depend ; done
+ for nsrc in $(NASMSRC) ; do $(NASM) -DDEPEND $(NINCLUDE) -o `echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M $$nsrc >> .depend ; done
+
# Hook to add private Makefile targets for the maintainer.
-#
-include Makefile.private
+
+# Include dependencies file
+-include .depend
vk_end: equ $ ; Should be <= vk_size
endstruc
+%ifndef DEPEND
%if (vk_end > vk_size) || (vk_size*max_vk > 65536)
%error "Too many vkernels defined, reduce vk_power"
%endif
+%endif
;
; Segment assignments in the bottom 640K
file_left resd 1 ; Number of sectors left
endstruc
+%ifndef DEPEND
%if (open_file_t_size & (open_file_t_size-1))
%error "open_file_t is not a power of 2"
%endif
+%endif
;
; For our convenience: define macros for jump-over-unconditinal jumps
rl_checkpt equ $ ; Must be <= 800h
rl_checkpt_off equ ($-$$)
+%ifndef DEPEND
%if rl_checkpt_off > 0x800
%error "Sector 0 overflow"
%endif
+%endif
; ----------------------------------------------------------------------------
; End of code and data that have to be in the first sector
BufSafeSec dw trackbufsize/SECTORSIZE ; = how many sectors?
BufSafeBytes dw trackbufsize ; = how many bytes?
EndOfGetCBuf dw getcbuf+trackbufsize ; = getcbuf+BufSafeBytes
+%ifndef DEPEND
%if ( trackbufsize % SECTORSIZE ) != 0
%error trackbufsize must be a multiple of SECTORSIZE
%endif
+%endif
;
; Stuff for the command line; we do some trickery here with equ to avoid
vgafontbuf equ 0E000h
; This is a compile-time assert that we didn't run out of space
+%ifndef DEPEND
%if (getcbuf+trackbufsize) > vgafontbuf
%error "Out of memory, better reorganize something..."
%endif
+%endif
vk_end: equ $ ; Should be <= vk_size
endstruc
+%ifndef DEPEND
%if (vk_end > vk_size) || (vk_size*max_vk > 65536)
%error "Too many vkernels defined, reduce vk_power"
%endif
+%endif
;
; Segment assignments in the bottom 640K
bs_checkpt equ $ ; Must be <= 7DEFh
bs_checkpt_off equ ($-$$)
+%ifndef DEPEND
%if bs_checkpt_off > 1EFh
%error "Boot sector overflow"
%endif
+%endif
zb 1EFh-($-$$)
bs_magic equ $ ; From here to the magic_len equ
rl_checkpt equ $ ; Must be <= 8000h
rl_checkpt_off equ ($-$$)
+%ifndef DEPEND
%if rl_checkpt_off > 400h
%error "Sector 1 overflow"
%endif
+%endif
; ----------------------------------------------------------------------------
; End of code and data that have to be in the first sector
vgafontbuf equ 0E000h
; This is a compile-time assert that we didn't run out of space
+%ifndef DEPEND
%if (getcbuf+trackbufsize) > vgafontbuf
%error "Out of memory, better reorganize something..."
%endif
+%endif
VERSION := $(shell cat ../version)
-CC = gcc
-CFLAGS = -Wall -O2 -fomit-frame-pointer -march=i386 \
- -malign-functions=0 -malign-jumps=0 -malign-loops=0 \
- -DVERSION='"$(VERSION)"' -DDATE='"$(DATE)"'
-LDFLAGS =
-AS = as
-LD = ld
-NASM = nasm
-OBJCOPY = objcopy
-PERL = perl
+CC = gcc
+CFLAGS = -Wall -O2 -fomit-frame-pointer -march=i386 \
+ -malign-functions=0 -malign-jumps=0 -malign-loops=0 \
+ -DVERSION='"$(VERSION)"' -DDATE='"$(DATE)"'
+LDFLAGS =
+INCLUDE =
+AS = as
+LD = ld
+NASM = nasm
+NINCLUDE =
+OBJCOPY = objcopy
+PERL = perl
# Important: init.o16 must be first!!
-OBJS = init.o16 setup.o16 msetup.o16 e820func.o16 conio.o16 memdisk.o
+OBJS = init.o16 setup.o16 msetup.o16 e820func.o16 conio.o16 memdisk.o
+
+CSRC = setup.c msetup.c e820func.c conio.c
+SSRC = init.S16
+NASMSRC = memdisk.asm
all: memdisk e820test
# spotless also removes the product binary
spotless: clean
- rm -f memdisk
+ rm -f memdisk .depend
%.o16: %.s16
$(AS) -o $@ $<
echo '.code16gcc' | cat - $< > $@
%.s: %.S
- $(CC) -x c $(CFLAGS) -traditional -E -o $@ $<
+ $(CC) -x c $(INCLUDE) $(CFLAGS) -traditional -E -o $@ $<
%.s16: %.S16
- $(CC) -x c $(CFLAGS) -traditional -E -o $@ $<
+ $(CC) -x c $(INCLUDE) $(CFLAGS) -traditional -E -o $@ $<
%.s: %.c
- $(CC) $(CFLAGS) -S -o $@ $<
+ $(CC) $(INCLUDE) $(CFLAGS) -S -o $@ $<
%.i: %.c
- $(CC) $(CFLAGS) -E -o $@ $<
+ $(CC) $(INCLUDE) $(CFLAGS) -E -o $@ $<
%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $<
%.bin: %.asm
- $(NASM) -f bin -o $@ -l $*.lst $<
+ $(NASM) -f bin $(NINCLUDE) -o $@ -l $*.lst $<
memdisk.elf: $(OBJS)
$(LD) -Ttext 0 -o $@ $^
memdisk.o: memdisk.bin
$(LD) -r -b binary -o $@ $<
+
+.depend:
+ rm -f .depend
+ for csrc in $(CSRC) ; do $(CC) $(INCLUDE) -M $$csrc >> .depend ; done
+ for ssrc in $(SSRC) ; do $(CC) $(INCLUDE) -x c -traditional -M $$ssrc | sed -e 's/\.S16\.o/\.o16/' >> .depend ; done
+ for nsrc in $(NASMSRC) ; do $(NASM) -DDEPEND $(NINCLUDE) -o `echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M $$nsrc >> .depend ; done
+
+# Include dependencies file
+include .depend
vk_end: equ $ ; Should be <= vk_size
endstruc
+%ifndef DEPEND
%if (vk_end > vk_size) || (vk_size*max_vk > 65536)
%error "Too many vkernels defined, reduce vk_power"
%endif
+%endif
;
; Segment assignments in the bottom 640K
tftp_filesize resd 1 ; Total file size
endstruc
+%ifndef DEPEND
%if (tftp_port_t_size & (tftp_port_t_size-1))
%error "tftp_port_t is not a power of 2"
%endif
+%endif
;
; For our convenience: define macros for jump-over-unconditinal jumps
BufSafeSec dw trackbufsize/512 ; = how many sectors?
BufSafeBytes dw trackbufsize ; = how many bytes?
EndOfGetCBuf dw getcbuf+trackbufsize ; = getcbuf+BufSafeBytes
+%ifndef DEPEND
%if ( trackbufsize % TFTP_BLOCKSIZE ) != 0
%error trackbufsize must be a multiple of TFTP_BLOCKSIZE
%endif
+%endif
IPAppend db 0 ; Default IPAPPEND option
DHCPMagic db 0 ; DHCP site-specific option info
vgafontbuf equ 0E000h
; This is a compile-time assert that we didn't run out of space
+%ifndef DEPEND
%if (getcbuf+trackbufsize) > vgafontbuf
%error "Out of memory, better reorganize something..."
%endif
+%endif
; DOS installer for SYSLINUX
;
- absolute 0
+ absolute 0
pspInt20: resw 1
pspNextParagraph: resw 1
resb 1 ; reserved
; This includes a small subroutine make_stupid to patch up the boot sector
; in case we give the -s (stupid) option
;
- %include "stupid.inc"
+%ifndef DEPEND ; Generated file
+%include "stupid.inc"
+%endif
- section .data
+ section .data
msg_error_sp: db 'ERROR $'
msg_colon: db ': $'
msg_error: db 'ERROR: $'