2010-09-14 14:18:53 +04:00
i n c l u d e $( BUILDDIR ) / . c o n f i g . m k
i f n d e f B O O T L O A D E R
$( warning syslinux feature enabled but BOOTLOADER undefined )
e n d i f
2010-09-18 18:46:32 +04:00
i f n d e f S Y S L I N U X _ U I
2010-09-22 01:58:24 +04:00
$( warning no syslinux ui configured , default is plain text prompt )
2010-09-18 18:46:32 +04:00
SYSLINUX_UI := prompt
2010-09-14 14:18:53 +04:00
e n d i f
2010-09-18 18:46:32 +04:00
# UI is backed by modules in modern syslinux
# (except for built-in text prompt)
SYSLINUX_MODULES := $( SYSLINUX_MODULES) $( SYSLINUX_UI)
# SUBPROFILES are considered SYSLINUX_CFG too;
# 01defaults.cfg is included indefinitely
SYSLINUX_CFG := $( SYSLINUX_CFG) $( SUBPROFILES) defaults
2010-09-14 14:18:53 +04:00
DSTDIR := $( BUILDDIR) /stage1/files/syslinux
CONFIG := $( DSTDIR) /$( BOOTLOADER) .cfg
MODDIR := /usr/lib/syslinux
2010-09-18 18:46:32 +04:00
# we can do SYSLINUX_{CFG,MODULES,FILES}
# CFG have only cfg snippet
# FILES have only filenames (absolute or relative to /usr/lib/syslinux/)
# MODULES must have both cfg snippet and syslinux module filename
# (and get included iff cfg snippet AND module exist)
2010-09-14 14:18:53 +04:00
2010-09-18 18:46:32 +04:00
# syslinux modules come as .com and .c32 files
sysmod = $( wildcard $( addprefix $( MODDIR) /,$( addsuffix .c??,$( 1) ) ) )
cfg = $( wildcard cfg.in/??$( 1) .cfg)
2010-09-14 14:18:53 +04:00
2010-09-18 18:46:32 +04:00
# NB: list position determined by file numbering (*.cfg sorting)
all : prep debug
2010-09-22 01:58:24 +04:00
@cat $( sort \
2010-09-18 18:46:32 +04:00
$( foreach C,$( SYSLINUX_CFG) ,$( call cfg,$( C) ) ) \
$( foreach M,$( SYSLINUX_MODULES) , \
$( shell cp -pLt $( DSTDIR) -- $( call sysmod,$( M) ) && echo $( call cfg,$( M) ) ) ) ) \
/dev/null > $( CONFIG)
2010-09-22 01:58:24 +04:00
@[ -z " $( SYSLINUX_FILES) " ] || { \
2010-09-18 18:46:32 +04:00
cd $( MODDIR) ; \
cp -pLt $( DSTDIR) -- $( SYSLINUX_FILES) ; \
}
# cat's argument gets evaluated before recipe body execution
prep :
2010-09-22 01:58:24 +04:00
@mkdir -p $( DSTDIR)
2010-09-14 14:18:53 +04:00
2010-09-18 18:46:32 +04:00
# for p in $...; do ls ??$p.cfg; done | sort
2010-09-14 14:18:53 +04:00
debug :
@echo " ** BOOTLOADER: $( BOOTLOADER) "
@echo " ** SYSLINUX_UI: $( SYSLINUX_UI) "
2010-09-18 18:46:32 +04:00
@echo " ** SYSLINUX_CFG: $( SYSLINUX_CFG) "
@echo " ** SYSLINUX_FILES: $( SYSLINUX_FILES) "
@echo " ** SYSLINUX_MODULES: $( SYSLINUX_MODULES) "