2 ## -----------------------------------------------------------------------
4 ## Copyright 1998-2005 H. Peter Anvin - All Rights Reserved
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 ## Boston MA 02111-1307, USA; either version 2 of the License, or
10 ## (at your option) any later version; incorporated herein by reference.
12 ## -----------------------------------------------------------------------
15 # Main Makefile for SYSLINUX
18 OSTYPE
= $(shell uname
-msr
)
21 CFLAGS
= -W
-Wall
-Os
-fomit-frame-pointer
-D_FILE_OFFSET_BITS
=64
32 AUXDIR
= $(LIBDIR
)/syslinux
37 VERSION
= $(shell cat version
)
40 $(CC
) $(INCLUDE
) $(CFLAGS
) -c
$<
43 # The BTARGET refers to objects that are derived from ldlinux.asm; we
44 # like to keep those uniform for debugging reasons; however, distributors
45 # want to recompile the installers (ITARGET).
47 # BOBJECTS and IOBJECTS are the same thing, except used for
48 # installation, so they include objects that may be in subdirectories
49 # with their own Makefiles. Finally, there is a list of those
52 CSRC
= syslxmod.c gethostip.c
53 NASMSRC
= $(wildcard *.asm
)
54 SOURCES
= $(CSRC
) *.h
$(NASMSRC
) *.inc
56 # _bin.c files required by both BTARGET and ITARGET installers
57 BINFILES
= bootsect_bin.c ldlinux_bin.c mbr_bin.c \
58 extlinux_bss_bin.c extlinux_sys_bin.c
60 # syslinux.exe is BTARGET so as to not require everyone to have the
61 # mingw suite installed
62 BTARGET
= kwdhash.gen version.gen version.h \
63 ldlinux.bss ldlinux.sys ldlinux.bin \
64 pxelinux
.0 mbr.bin isolinux.bin isolinux-debug.bin \
65 extlinux.bin extlinux.bss extlinux.sys
66 BOBJECTS
= $(BTARGET
) dos
/syslinux.com win32
/syslinux.exe memdisk
/memdisk
67 BSUBDIRS
= memdisk dos win32
68 ITARGET
= copybs.com gethostip mkdiskimage
69 IOBJECTS
= $(ITARGET
) mtools
/syslinux unix
/syslinux extlinux
/extlinux
70 ISUBDIRS
= mtools unix extlinux sample com32
71 DOCS
= COPYING NEWS README TODO BUGS
*.doc sample menu com32
72 OTHER
= Makefile bin2c.pl now.pl genhash.pl keywords findpatch.pl \
73 keytab-lilo.pl version version.pl sys2ansi.pl \
74 ppmtolss16 lss16toppm memdisk bin2hex.pl mkdiskimage.in
75 OBSOLETE
= pxelinux.bin
77 # Things to install in /usr/bin
78 INSTALL_BIN
= mtools
/syslinux gethostip ppmtolss16 lss16toppm
79 # Things to install in /sbin
80 INSTALL_SBIN
= extlinux
/extlinux
81 # Things to install in /usr/lib/syslinux
82 INSTALL_AUX
= pxelinux
.0 isolinux.bin isolinux-debug.bin \
83 dos
/syslinux.com copybs.com memdisk
/memdisk mbr.bin
84 INSTALL_AUX_OPT
= win32
/syslinux.exe
86 # The DATE is set on the make command line when building binaries for
87 # official release. Otherwise, substitute a hex string that is pretty much
88 # guaranteed to be unique to be unique from build to build.
90 HEXDATE
:= $(shell $(PERL
) now.pl ldlinux.asm pxelinux.asm isolinux.asm
)
95 MAKE
+= DATE
=$(DATE
) HEXDATE
=$(HEXDATE
)
98 # NOTE: If you don't have the mingw compiler suite installed, you probably
99 # want to remove win32 from this list; otherwise you're going to get an
100 # error every time you try to build.
104 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
106 -ls
-l
$(BOBJECTS
) $(IOBJECTS
)
108 all-local
: $(BTARGET
) $(ITARGET
) $(BINFILES
)
110 installer
: installer-local
111 set
-e
; for i in
$(ISUBDIRS
); do
$(MAKE
) -C
$$i all ; done
112 -ls
-l
$(BOBJECTS
) $(IOBJECTS
)
114 installer-local
: $(ITARGET
) $(BINFILES
)
116 version.gen
: version version.pl
117 $(PERL
) version.pl
$< $@
'%define'
119 version.h
: version version.pl
120 $(PERL
) version.pl
$< $@
'#define'
122 kwdhash.gen
: keywords genhash.pl
123 $(PERL
) genhash.pl
< keywords
> kwdhash.gen
125 ldlinux.bin
: ldlinux.asm kwdhash.gen version.gen
126 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
127 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
128 $(PERL
) checkov.pl ldlinux.map
$@
130 pxelinux.bin
: pxelinux.asm kwdhash.gen version.gen
131 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
132 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
133 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
135 isolinux.bin
: isolinux.asm kwdhash.gen version.gen checksumiso.pl
136 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
137 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
138 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
139 $(PERL
) checksumiso.pl
$@
141 # Special verbose version of isolinux.bin
142 isolinux-debug.bin
: isolinux-debug.asm kwdhash.gen version.gen checksumiso.pl
143 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
144 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
145 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
146 $(PERL
) checksumiso.pl
$@
148 extlinux.bin
: extlinux.asm kwdhash.gen version.gen
149 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
150 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
151 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
153 pxelinux
.0: pxelinux.bin
154 cp pxelinux.bin pxelinux
.0
156 ldlinux.bss
: ldlinux.bin
157 dd if
=$< of
=$@ bs
=512 count
=1
159 ldlinux.sys
: ldlinux.bin
160 dd if
=$< of
=$@ bs
=512 skip
=1
162 extlinux.bss
: extlinux.bin
163 dd if
=$< of
=$@ bs
=512 count
=1
165 extlinux.sys
: extlinux.bin
166 dd if
=$< of
=$@ bs
=512 skip
=1
169 $(NASM
) -f bin
-l mbr.lst
-o mbr.bin mbr.asm
171 mbr_bin.c
: mbr.bin bin2c.pl
172 $(PERL
) bin2c.pl syslinux_mbr
< $< > $@
174 copybs.com
: copybs.asm
175 $(NASM
) -f bin
-l copybs.lst
-o copybs.com copybs.asm
177 bootsect_bin.c
: ldlinux.bss bin2c.pl
178 $(PERL
) bin2c.pl syslinux_bootsect
< $< > $@
180 ldlinux_bin.c
: ldlinux.sys bin2c.pl
181 $(PERL
) bin2c.pl syslinux_ldlinux
< $< > $@
183 extlinux_bss_bin.c
: extlinux.bss bin2c.pl
184 $(PERL
) bin2c.pl extlinux_bootsect
< $< > $@
186 extlinux_sys_bin.c
: extlinux.sys bin2c.pl
187 $(PERL
) bin2c.pl extlinux_image
< $< > $@
189 libsyslinux.a
: bootsect_bin.o ldlinux_bin.o mbr_bin.o syslxmod.o
194 $(LIB_SO
): bootsect_bin.o ldlinux_bin.o syslxmod.o
195 $(CC
) $(LDFLAGS
) -shared
-Wl
,-soname
,$(LIB_SONAME
) -o
$@
$^
197 gethostip.o
: gethostip.c
199 gethostip
: gethostip.o
201 mkdiskimage
: mkdiskimage.in mbr.bin bin2hex.pl
202 $(PERL
) bin2hex.pl
< mbr.bin | cat mkdiskimage.in
- > $@
206 mkdir
-m
755 -p
$(INSTALLROOT
)$(BINDIR
)
207 install -m
755 -c
$(INSTALL_BIN
) $(INSTALLROOT
)$(BINDIR
)
208 mkdir
-m
755 -p
$(INSTALLROOT
)$(SBINDIR
)
209 install -m
755 -c
$(INSTALL_SBIN
) $(INSTALLROOT
)$(SBINDIR
)
210 mkdir
-m
755 -p
$(INSTALLROOT
)$(AUXDIR
)
211 install -m
644 -c
$(INSTALL_AUX
) $(INSTALLROOT
)$(AUXDIR
)
212 -install -m
644 -c
$(INSTALL_AUX_OPT
) $(INSTALLROOT
)$(AUXDIR
)
213 $(MAKE
) -C com32
install
215 install-lib
: installer
217 install-all
: install install-lib
220 rm -f
*.o
*_bin.c stupid.
* patch.offset
225 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
230 clean: local-tidy local-clean
231 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
234 for
dir in . sample memdisk
; do \
235 ( cd
$$dir && rm -f
*~ \
#* core ) ; \
239 rm -f
$(BTARGET
) .depend
*.so.
*
241 spotless
: local-clean
dist local-spotless
242 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
246 for csrc in
$(CSRC
) ; do
$(CC
) $(INCLUDE
) -MM
$$csrc >> .depend
; done
247 for nsrc in
$(NASMSRC
) ; do
$(NASM
) -DDEPEND
$(NINCLUDE
) -o
`echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M
$$nsrc >> .depend
; done
254 $(MAKE
) -C memdisk depend
256 # Shortcut to build unix/syslinux using klibc
259 $(MAKE
) CC
=klcc ITARGET
= ISUBDIRS
=unix BSUBDIRS
=
261 # Hook to add private Makefile targets for the maintainer.
262 -include Makefile.private
264 # Include dependencies file