1 ## -----------------------------------------------------------------------
3 ## Copyright 1998-2007 H. Peter Anvin - All Rights Reserved
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ## Boston MA 02111-1307, USA; either version 2 of the License, or
9 ## (at your option) any later version; incorporated herein by reference.
11 ## -----------------------------------------------------------------------
14 # Main Makefile for SYSLINUX
20 gcc_ok
= $(shell if gcc
$(1) dummy.c
-o
/dev
/null
2>/dev
/null
; \
21 then echo
'$(1)'; else echo
'$(2)'; fi
)
24 LDHASH
:= $(call gcc_ok
,-Wl
$(comma
)--hash-style
=both
,)
26 OSTYPE
= $(shell uname
-msr
)
29 CFLAGS
= -W
-Wall
-Os
-fomit-frame-pointer
-D_FILE_OFFSET_BITS
=64
31 LDFLAGS
= -O2
-s
$(LDHASH
)
40 AUXDIR
= $(LIBDIR
)/syslinux
45 VERSION
= $(shell cat version
)
48 $(CC
) $(INCLUDE
) $(CFLAGS
) -c
$<
51 # The BTARGET refers to objects that are derived from ldlinux.asm; we
52 # like to keep those uniform for debugging reasons; however, distributors
53 # want to recompile the installers (ITARGET).
55 # BOBJECTS and IOBJECTS are the same thing, except used for
56 # installation, so they include objects that may be in subdirectories
57 # with their own Makefiles. Finally, there is a list of those
60 CSRC
= syslxmod.c gethostip.c
61 NASMSRC
= $(wildcard *.asm
)
62 SOURCES
= $(CSRC
) *.h
$(NASMSRC
) *.inc
64 # _bin.c files required by both BTARGET and ITARGET installers
65 BINFILES
= bootsect_bin.c ldlinux_bin.c mbr_bin.c \
66 extlinux_bss_bin.c extlinux_sys_bin.c
68 # syslinux.exe is BTARGET so as to not require everyone to have the
69 # mingw suite installed
70 BTARGET
= kwdhash.gen version.gen version.h \
71 ldlinux.bss ldlinux.sys ldlinux.bin \
72 pxelinux
.0 isolinux.bin isolinux-debug.bin \
73 extlinux.bin extlinux.bss extlinux.sys
74 BOBJECTS
= $(BTARGET
) mbr
/mbr.bin dos
/syslinux.com win32
/syslinux.exe memdisk
/memdisk
75 # BESUBDIRS and IESUBDIRS are "early", i.e. before the root; BSUBDIRS
76 # and ISUBDIRS are "late", after the root.
78 BSUBDIRS
= memdisk dos win32
79 ITARGET
= copybs.com gethostip mkdiskimage
80 IOBJECTS
= $(ITARGET
) mtools
/syslinux unix
/syslinux extlinux
/extlinux
82 ISUBDIRS
= mtools unix extlinux sample com32
83 DOCS
= COPYING NEWS README TODO BUGS
*.doc sample menu com32
84 OTHER
= Makefile bin2c.pl now.pl genhash.pl keywords findpatch.pl \
85 keytab-lilo.pl version version.pl sys2ansi.pl \
86 ppmtolss16 lss16toppm memdisk bin2hex.pl mkdiskimage.in
87 OBSOLETE
= pxelinux.bin
89 # Things to install in /usr/bin
90 INSTALL_BIN
= mtools
/syslinux gethostip ppmtolss16 lss16toppm
91 # Things to install in /sbin
92 INSTALL_SBIN
= extlinux
/extlinux
93 # Things to install in /usr/lib/syslinux
94 INSTALL_AUX
= pxelinux
.0 isolinux.bin isolinux-debug.bin \
95 dos
/syslinux.com copybs.com memdisk
/memdisk mbr
/mbr.bin
96 INSTALL_AUX_OPT
= win32
/syslinux.exe
98 # The DATE is set on the make command line when building binaries for
99 # official release. Otherwise, substitute a hex string that is pretty much
100 # guaranteed to be unique to be unique from build to build.
102 HEXDATE
:= $(shell $(PERL
) now.pl ldlinux.asm pxelinux.asm isolinux.asm
)
107 MAKE
+= DATE
=$(DATE
) HEXDATE
=$(HEXDATE
)
110 # NOTE: If you don't have the mingw compiler suite installed, you probably
111 # want to remove win32 from this list; otherwise you're going to get an
112 # error every time you try to build.
116 set
-e
; for i in
$(BESUBDIRS
) $(IESUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
118 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
119 -ls
-l
$(BOBJECTS
) $(IOBJECTS
)
121 all-local
: $(BTARGET
) $(ITARGET
) $(BINFILES
)
123 installer
: installer-local
124 set
-e
; for i in
$(ISUBDIRS
); do
$(MAKE
) -C
$$i all ; done
125 -ls
-l
$(BOBJECTS
) $(IOBJECTS
)
127 installer-local
: $(ITARGET
) $(BINFILES
)
129 version.gen
: version version.pl
130 $(PERL
) version.pl
$< $@
'%define'
132 version.h
: version version.pl
133 $(PERL
) version.pl
$< $@
'#define'
135 kwdhash.gen
: keywords genhash.pl
136 $(PERL
) genhash.pl
< keywords
> kwdhash.gen
138 ldlinux.bin
: ldlinux.asm kwdhash.gen version.gen
139 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
140 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
141 $(PERL
) checkov.pl ldlinux.map
$@
143 pxelinux.bin
: pxelinux.asm kwdhash.gen version.gen
144 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
145 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
146 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
148 isolinux.bin
: isolinux.asm kwdhash.gen version.gen checksumiso.pl
149 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
150 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
151 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
152 $(PERL
) checksumiso.pl
$@
154 # Special verbose version of isolinux.bin
155 isolinux-debug.bin
: isolinux-debug.asm kwdhash.gen version.gen checksumiso.pl
156 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
157 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
158 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
159 $(PERL
) checksumiso.pl
$@
161 extlinux.bin
: extlinux.asm kwdhash.gen version.gen
162 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
163 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
164 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
166 pxelinux
.0: pxelinux.bin
167 cp pxelinux.bin pxelinux
.0
169 ldlinux.bss
: ldlinux.bin
170 dd if
=$< of
=$@ bs
=512 count
=1
172 ldlinux.sys
: ldlinux.bin
173 dd if
=$< of
=$@ bs
=512 skip
=1
175 extlinux.bss
: extlinux.bin
176 dd if
=$< of
=$@ bs
=512 count
=1
178 extlinux.sys
: extlinux.bin
179 dd if
=$< of
=$@ bs
=512 skip
=1
181 mbr_bin.c
: mbr
/mbr.bin bin2c.pl
182 $(PERL
) bin2c.pl syslinux_mbr
< $< > $@
184 copybs.com
: copybs.asm
185 $(NASM
) -f bin
-l copybs.lst
-o copybs.com copybs.asm
187 bootsect_bin.c
: ldlinux.bss bin2c.pl
188 $(PERL
) bin2c.pl syslinux_bootsect
< $< > $@
190 ldlinux_bin.c
: ldlinux.sys bin2c.pl
191 $(PERL
) bin2c.pl syslinux_ldlinux
< $< > $@
193 extlinux_bss_bin.c
: extlinux.bss bin2c.pl
194 $(PERL
) bin2c.pl extlinux_bootsect
< $< > $@
196 extlinux_sys_bin.c
: extlinux.sys bin2c.pl
197 $(PERL
) bin2c.pl extlinux_image
< $< > $@
199 libsyslinux.a
: bootsect_bin.o ldlinux_bin.o mbr_bin.o syslxmod.o
204 $(LIB_SO
): bootsect_bin.o ldlinux_bin.o syslxmod.o
205 $(CC
) $(LDFLAGS
) -shared
-Wl
,-soname
,$(LIB_SONAME
) -o
$@
$^
207 gethostip
: gethostip.o
208 $(CC
) $(LDFLAGS
) -o
$@
$^
210 mkdiskimage
: mkdiskimage.in mbr
/mbr.bin bin2hex.pl
211 $(PERL
) bin2hex.pl
< mbr
/mbr.bin | cat mkdiskimage.in
- > $@
215 mkdir
-m
755 -p
$(INSTALLROOT
)$(BINDIR
)
216 install -m
755 -c
$(INSTALL_BIN
) $(INSTALLROOT
)$(BINDIR
)
217 mkdir
-m
755 -p
$(INSTALLROOT
)$(SBINDIR
)
218 install -m
755 -c
$(INSTALL_SBIN
) $(INSTALLROOT
)$(SBINDIR
)
219 mkdir
-m
755 -p
$(INSTALLROOT
)$(AUXDIR
)
220 install -m
644 -c
$(INSTALL_AUX
) $(INSTALLROOT
)$(AUXDIR
)
221 -install -m
644 -c
$(INSTALL_AUX_OPT
) $(INSTALLROOT
)$(AUXDIR
)
222 $(MAKE
) -C com32
install
224 install-lib
: installer
226 install-all
: install install-lib
229 rm -f
*.o
*_bin.c stupid.
* patch.offset
234 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
239 clean: local-tidy local-clean
240 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
243 for
dir in . sample memdisk
; do \
244 ( cd
$$dir && rm -f
*~ \
#* core ) ; \
248 rm -f
$(BTARGET
) .depend
*.so.
*
250 spotless
: local-clean
dist local-spotless
251 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
255 for csrc in
$(CSRC
) ; do
$(CC
) $(INCLUDE
) -MM
$$csrc >> .depend
; done
256 for nsrc in
$(NASMSRC
) ; do
$(NASM
) -DDEPEND
$(NINCLUDE
) -o
`echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M
$$nsrc >> .depend
; done
263 $(MAKE
) -C memdisk depend
265 # Shortcut to build unix/syslinux using klibc
268 $(MAKE
) CC
=klcc ITARGET
= ISUBDIRS
='unix extlinux' BSUBDIRS
=
270 # Hook to add private Makefile targets for the maintainer.
271 -include Makefile.private
273 # Include dependencies file