1 ## -----------------------------------------------------------------------
3 ## Copyright 1998-2009 H. Peter Anvin - All Rights Reserved
4 ## Copyright 2009 Intel Corporation; author: H. Peter Anvin
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 include $(topdir)/MCONFIG
19 -include $(topdir)/version.mk
22 # The BTARGET refers to objects that are derived from ldlinux.asm; we
23 # like to keep those uniform for debugging reasons; however, distributors
24 # want to recompile the installers (ITARGET).
26 # BOBJECTS and IOBJECTS are the same thing, except used for
27 # installation, so they include objects that may be in subdirectories
28 # with their own Makefiles. Finally, there is a list of those
32 # List of module objects that should be installed for all derivatives
33 MODULES = memdisk/memdisk memdump/memdump.com modules/*.com \
34 com32/menu/*.c32 com32/modules/*.c32 com32/mboot/*.c32 \
35 com32/hdt/*.c32 com32/rosh/*.c32
37 # syslinux.exe is BTARGET so as to not require everyone to have the
38 # mingw suite installed
39 BTARGET = version.gen version.h version.mk
40 BOBJECTS = $(BTARGET) \
41 mbr/mbr.bin mbr/altmbr.bin mbr/gptmbr.bin \
42 mbr/mbr_c.bin mbr/altmbr_c.bin mbr/gptmbr_c.bin \
43 mbr/mbr_f.bin mbr/altmbr_f.bin mbr/gptmbr_f.bin \
44 core/pxelinux.0 core/isolinux.bin core/isolinux-debug.bin \
45 gpxe/gpxelinux.0 dos/syslinux.com win32/syslinux.exe \
48 # BSUBDIRs build the on-target binary components.
49 # ISUBDIRs build the installer (host) components.
51 # Note: libinstaller is both a BSUBDIR and an ISUBDIR. It contains
52 # files that depend only on the B phase, but may have to be regenerated
53 # for "make installer".
54 BSUBDIRS = codepage com32 lzo core memdisk modules mbr memdump gpxe sample \
55 libinstaller dos win32
57 IOBJECTS = $(ITARGET) dos/copybs.com \
58 utils/gethostip utils/isohybrid utils/mkdiskimage \
59 mtools/syslinux linux/syslinux extlinux/extlinux
60 ISUBDIRS = libinstaller mtools linux extlinux utils
62 # Things to install in /usr/bin
63 INSTALL_BIN = mtools/syslinux
64 # Things to install in /sbin
65 INSTALL_SBIN = extlinux/extlinux
66 # Things to install in /usr/lib/syslinux
67 INSTALL_AUX = core/pxelinux.0 gpxe/gpxelinux.0 core/isolinux.bin \
68 core/isolinux-debug.bin \
69 dos/syslinux.com dos/copybs.com win32/syslinux.exe \
71 INSTALL_AUX_OPT = win32/syslinux.exe
73 # These directories manage their own installables
74 INSTALLSUBDIRS = com32 utils
76 # Things to install in /boot/extlinux
77 EXTBOOTINSTALL = $(MODULES)
79 # Things to install in /tftpboot
80 NETINSTALLABLE = core/pxelinux.0 gpxe/gpxelinux.0 \
85 set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
86 -ls -l $(BOBJECTS) $(IOBJECTS)
88 all-local: $(BTARGET) $(ITARGET)
91 $(MAKE) installer-local
92 set -e ; for i in $(ISUBDIRS); do $(MAKE) -C $$i all ; done
93 -ls -l $(BOBJECTS) $(IOBJECTS)
95 installer-local: $(ITARGET) $(BINFILES)
97 version.gen: version version.pl
98 $(PERL) version.pl $< $@ '%define < @'
99 version.h: version version.pl
100 $(PERL) version.pl $< $@ '#define < @'
101 version.mk: version version.pl
102 $(PERL) version.pl $< $@ '< := @'
104 local-install: installer
105 mkdir -m 755 -p $(INSTALLROOT)$(BINDIR)
106 install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR)
107 mkdir -m 755 -p $(INSTALLROOT)$(SBINDIR)
108 install -m 755 -c $(INSTALL_SBIN) $(INSTALLROOT)$(SBINDIR)
109 mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
110 install -m 644 -c $(INSTALL_AUX) $(INSTALLROOT)$(AUXDIR)
111 -install -m 644 -c $(INSTALL_AUX_OPT) $(INSTALLROOT)$(AUXDIR)
112 mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man1
113 install -m 644 -c man/*.1 $(INSTALLROOT)$(MANDIR)/man1
114 : mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man8
115 : install -m 644 -c man/*.8 $(INSTALLROOT)$(MANDIR)/man8
117 install: local-install
118 set -e ; for i in $(INSTALLSUBDIRS) ; do $(MAKE) -C $$i $@ ; done
120 netinstall: installer
121 mkdir -p $(INSTALLROOT)$(TFTPBOOT)
122 install -m 644 $(NETINSTALLABLE) $(INSTALLROOT)$(TFTPBOOT)
124 extbootinstall: installer
125 mkdir -m 755 -p $(INSTALLROOT)$(EXTLINUXDIR)
126 install -m 644 $(EXTBOOTINSTALL) $(INSTALLROOT)$(EXTLINUXDIR)
128 install-all: install netinstall extbootinstall
131 rm -f *.o *.elf *_bin.c stupid.* patch.offset
132 rm -f *.lsr *.lst *.map *.sec *.tmp
136 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
141 clean: local-tidy local-clean
142 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
145 find . \( -name '*~' -o -name '#*' -o -name core \
146 -o -name '.*.d' -o -name .depend \) -type f -print0 \
149 dist: local-dist local-tidy
150 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
153 rm -f $(BTARGET) .depend *.so.*
155 spotless: local-clean local-dist local-spotless
156 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
158 # Shortcut to build linux/syslinux using klibc
161 $(MAKE) CC=klcc ITARGET= ISUBDIRS='linux extlinux' BSUBDIRS=
163 # Hook to add private Makefile targets for the maintainer.
164 -include Makefile.private