1 ## -----------------------------------------------------------------------
3 ## Copyright 1998-2005 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
17 OSTYPE
= $(shell uname
-msr
)
20 CFLAGS
= -W
-Wall
-Os
-fomit-frame-pointer
-D_FILE_OFFSET_BITS
=64
31 AUXDIR
= $(LIBDIR
)/syslinux
36 VERSION
= $(shell cat version
)
39 $(CC
) $(INCLUDE
) $(CFLAGS
) -c
$<
42 # The BTARGET refers to objects that are derived from ldlinux.asm; we
43 # like to keep those uniform for debugging reasons; however, distributors
44 # want to recompile the installers (ITARGET).
46 # BOBJECTS and IOBJECTS are the same thing, except used for
47 # installation, so they include objects that may be in subdirectories
48 # with their own Makefiles. Finally, there is a list of those
51 CSRC
= syslxmod.c gethostip.c
52 NASMSRC
= $(wildcard *.asm
)
53 SOURCES
= $(CSRC
) *.h
$(NASMSRC
) *.inc
55 # _bin.c files required by both BTARGET and ITARGET installers
56 BINFILES
= bootsect_bin.c ldlinux_bin.c mbr_bin.c \
57 extlinux_bss_bin.c extlinux_sys_bin.c
59 # syslinux.exe is BTARGET so as to not require everyone to have the
60 # mingw suite installed
61 BTARGET
= kwdhash.gen version.gen version.h \
62 ldlinux.bss ldlinux.sys ldlinux.bin \
63 pxelinux
.0 mbr.bin isolinux.bin isolinux-debug.bin \
64 extlinux.bin extlinux.bss extlinux.sys
65 BOBJECTS
= $(BTARGET
) dos
/syslinux.com win32
/syslinux.exe memdisk
/memdisk
66 BSUBDIRS
= memdisk dos win32
67 ITARGET
= copybs.com gethostip mkdiskimage
68 IOBJECTS
= $(ITARGET
) mtools
/syslinux unix
/syslinux extlinux
/extlinux
69 ISUBDIRS
= mtools unix extlinux sample com32
70 DOCS
= COPYING NEWS README TODO BUGS
*.doc sample menu com32
71 OTHER
= Makefile bin2c.pl now.pl genhash.pl keywords findpatch.pl \
72 keytab-lilo.pl version version.pl sys2ansi.pl \
73 ppmtolss16 lss16toppm memdisk bin2hex.pl mkdiskimage.in
74 OBSOLETE
= pxelinux.bin
76 # Things to install in /usr/bin
77 INSTALL_BIN
= mtools
/syslinux gethostip ppmtolss16 lss16toppm
78 # Things to install in /sbin
79 INSTALL_SBIN
= extlinux
/extlinux
80 # Things to install in /usr/lib/syslinux
81 INSTALL_AUX
= pxelinux
.0 isolinux.bin isolinux-debug.bin \
82 dos
/syslinux.com copybs.com memdisk
/memdisk mbr.bin
83 INSTALL_AUX_OPT
= win32
/syslinux.exe
85 # The DATE is set on the make command line when building binaries for
86 # official release. Otherwise, substitute a hex string that is pretty much
87 # guaranteed to be unique to be unique from build to build.
89 HEXDATE
:= $(shell $(PERL
) now.pl ldlinux.asm pxelinux.asm isolinux.asm
)
94 MAKE
+= DATE
=$(DATE
) HEXDATE
=$(HEXDATE
)
97 # NOTE: If you don't have the mingw compiler suite installed, you probably
98 # want to remove win32 from this list; otherwise you're going to get an
99 # error every time you try to build.
103 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
105 -ls
-l
$(BOBJECTS
) $(IOBJECTS
)
107 all-local
: $(BTARGET
) $(ITARGET
) $(BINFILES
)
109 installer
: installer-local
110 set
-e
; for i in
$(ISUBDIRS
); do
$(MAKE
) -C
$$i all ; done
111 -ls
-l
$(BOBJECTS
) $(IOBJECTS
)
113 installer-local
: $(ITARGET
) $(BINFILES
)
115 version.gen
: version version.pl
116 $(PERL
) version.pl
$< $@
'%define'
118 version.h
: version version.pl
119 $(PERL
) version.pl
$< $@
'#define'
121 kwdhash.gen
: keywords genhash.pl
122 $(PERL
) genhash.pl
< keywords
> kwdhash.gen
124 ldlinux.bin
: ldlinux.asm kwdhash.gen version.gen
125 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
126 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
127 $(PERL
) checkov.pl ldlinux.map
$@
129 pxelinux.bin
: pxelinux.asm kwdhash.gen version.gen
130 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
131 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
132 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
134 isolinux.bin
: isolinux.asm kwdhash.gen version.gen checksumiso.pl
135 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
136 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
137 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
138 $(PERL
) checksumiso.pl
$@
140 # Special verbose version of isolinux.bin
141 isolinux-debug.bin
: isolinux-debug.asm kwdhash.gen version.gen checksumiso.pl
142 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
143 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
144 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
145 $(PERL
) checksumiso.pl
$@
147 extlinux.bin
: extlinux.asm kwdhash.gen version.gen
148 $(NASM
) -f bin
-DDATE_STR
="'$(DATE)'" -DHEXDATE
="$(HEXDATE)" \
149 -DMAP
=$(@
:.bin
=.map
) -l
$(@
:.bin
=.lst
) -o
$@
$<
150 $(PERL
) checkov.pl
$(@
:.bin
=.map
) $@
152 pxelinux
.0: pxelinux.bin
153 cp pxelinux.bin pxelinux
.0
155 ldlinux.bss
: ldlinux.bin
156 dd if
=$< of
=$@ bs
=512 count
=1
158 ldlinux.sys
: ldlinux.bin
159 dd if
=$< of
=$@ bs
=512 skip
=1
161 extlinux.bss
: extlinux.bin
162 dd if
=$< of
=$@ bs
=512 count
=1
164 extlinux.sys
: extlinux.bin
165 dd if
=$< of
=$@ bs
=512 skip
=1
168 $(NASM
) -f bin
-l mbr.lst
-o mbr.bin mbr.asm
170 mbr_bin.c
: mbr.bin bin2c.pl
171 $(PERL
) bin2c.pl syslinux_mbr
< $< > $@
173 copybs.com
: copybs.asm
174 $(NASM
) -f bin
-l copybs.lst
-o copybs.com copybs.asm
176 bootsect_bin.c
: ldlinux.bss bin2c.pl
177 $(PERL
) bin2c.pl syslinux_bootsect
< $< > $@
179 ldlinux_bin.c
: ldlinux.sys bin2c.pl
180 $(PERL
) bin2c.pl syslinux_ldlinux
< $< > $@
182 extlinux_bss_bin.c
: extlinux.bss bin2c.pl
183 $(PERL
) bin2c.pl extlinux_bootsect
< $< > $@
185 extlinux_sys_bin.c
: extlinux.sys bin2c.pl
186 $(PERL
) bin2c.pl extlinux_image
< $< > $@
188 libsyslinux.a
: bootsect_bin.o ldlinux_bin.o mbr_bin.o syslxmod.o
193 $(LIB_SO
): bootsect_bin.o ldlinux_bin.o syslxmod.o
194 $(CC
) $(LDFLAGS
) -shared
-Wl
,-soname
,$(LIB_SONAME
) -o
$@
$^
196 gethostip.o
: gethostip.c
198 gethostip
: gethostip.o
200 mkdiskimage
: mkdiskimage.in mbr.bin bin2hex.pl
201 $(PERL
) bin2hex.pl
< mbr.bin | cat mkdiskimage.in
- > $@
205 mkdir
-m
755 -p
$(INSTALLROOT
)$(BINDIR
)
206 install -m
755 -c
$(INSTALL_BIN
) $(INSTALLROOT
)$(BINDIR
)
207 mkdir
-m
755 -p
$(INSTALLROOT
)$(SBINDIR
)
208 install -m
755 -c
$(INSTALL_SBIN
) $(INSTALLROOT
)$(SBINDIR
)
209 mkdir
-m
755 -p
$(INSTALLROOT
)$(AUXDIR
)
210 install -m
644 -c
$(INSTALL_AUX
) $(INSTALLROOT
)$(AUXDIR
)
211 -install -m
644 -c
$(INSTALL_AUX_OPT
) $(INSTALLROOT
)$(AUXDIR
)
212 $(MAKE
) -C com32
install
214 install-lib
: installer
216 install-all
: install install-lib
219 rm -f
*.o
*_bin.c stupid.
* patch.offset
224 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
229 clean: local-tidy local-clean
230 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
233 for
dir in . sample memdisk
; do \
234 ( cd
$$dir && rm -f
*~ \
#* core ) ; \
238 rm -f
$(BTARGET
) .depend
*.so.
*
240 spotless
: local-clean
dist local-spotless
241 set
-e
; for i in
$(BSUBDIRS
) $(ISUBDIRS
) ; do
$(MAKE
) -C
$$i $@
; done
245 for csrc in
$(CSRC
) ; do
$(CC
) $(INCLUDE
) -MM
$$csrc >> .depend
; done
246 for nsrc in
$(NASMSRC
) ; do
$(NASM
) -DDEPEND
$(NINCLUDE
) -o
`echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M
$$nsrc >> .depend
; done
253 $(MAKE
) -C memdisk depend
255 # Shortcut to build unix/syslinux using klibc
258 $(MAKE
) CC
=klcc ITARGET
= ISUBDIRS
='unix extlinux' BSUBDIRS
=
260 # Hook to add private Makefile targets for the maintainer.
261 -include Makefile.private
263 # Include dependencies file