1 ## -----------------------------------------------------------------------
3 ## Copyright 1998-2009 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 include $(topdir)/MCONFIG
18 -include $(topdir)/version.mk
21 # The BTARGET refers to objects that are derived from ldlinux.asm; we
22 # like to keep those uniform for debugging reasons; however, distributors
23 # want to recompile the installers (ITARGET).
25 # BOBJECTS and IOBJECTS are the same thing, except used for
26 # installation, so they include objects that may be in subdirectories
27 # with their own Makefiles. Finally, there is a list of those
31 # List of module objects that should be installed for all derivatives
32 MODULES = memdisk/memdisk memdump/memdump.com modules/*.com \
33 com32/menu/*.c32 com32/modules/*.c32 com32/hdt/*.c32
36 # syslinux.exe is BTARGET so as to not require everyone to have the
37 # mingw suite installed
38 BTARGET = version.gen version.h version.mk
39 BOBJECTS = $(BTARGET) \
40 mbr/mbr.bin mbr/gptmbr.bin \
41 core/pxelinux.0 core/isolinux.bin core/isolinux-debug.bin \
42 gpxe/gpxelinux.0 dos/syslinux.com win32/syslinux.exe \
45 # BSUBDIRs build the on-target binary components.
46 # ISUBDIRs build the installer (host) components.
48 # Note: libinstaller is both a BSUBDIR and an ISUBDIR. It contains
49 # files that depend only on the B phase, but may have to be regenerated
50 # for "make installer".
51 BSUBDIRS = codepage core memdisk modules com32 mbr memdump gpxe sample \
52 libinstaller dos win32
54 IOBJECTS = $(ITARGET) dos/copybs.com \
55 utils/gethostip utils/isohybrid utils/mkdiskimage \
56 mtools/syslinux linux/syslinux extlinux/extlinux
57 ISUBDIRS = libinstaller mtools linux extlinux utils
59 # Things to install in /usr/bin
60 INSTALL_BIN = mtools/syslinux
61 # Things to install in /sbin
62 INSTALL_SBIN = extlinux/extlinux
63 # Things to install in /usr/lib/syslinux
64 INSTALL_AUX = core/pxelinux.0 gpxe/gpxelinux.0 core/isolinux.bin \
65 core/isolinux-debug.bin \
66 dos/syslinux.com dos/copybs.com win32/syslinux.exe \
67 mbr/mbr.bin mbr/gptmbr.bin \
69 INSTALL_AUX_OPT = win32/syslinux.exe
71 # These directories manage their own installables
72 INSTALLSUBDIRS = com32 utils
74 # Things to install in /boot/extlinux
75 EXTBOOTINSTALL = $(MODULES)
77 # Things to install in /tftpboot
78 NETINSTALLABLE = core/pxelinux.0 gpxe/gpxelinux.0 \
83 set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
84 -ls -l $(BOBJECTS) $(IOBJECTS)
86 all-local: $(BTARGET) $(ITARGET)
89 $(MAKE) installer-local
90 set -e ; for i in $(ISUBDIRS); do $(MAKE) -C $$i all ; done
91 -ls -l $(BOBJECTS) $(IOBJECTS)
93 installer-local: $(ITARGET) $(BINFILES)
95 version.gen: version version.pl
96 $(PERL) version.pl $< $@ '%define < @'
97 version.h: version version.pl
98 $(PERL) version.pl $< $@ '#define < @'
99 version.mk: version version.pl
100 $(PERL) version.pl $< $@ '< := @'
102 local-install: installer
103 mkdir -m 755 -p $(INSTALLROOT)$(BINDIR)
104 install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR)
105 mkdir -m 755 -p $(INSTALLROOT)$(SBINDIR)
106 install -m 755 -c $(INSTALL_SBIN) $(INSTALLROOT)$(SBINDIR)
107 mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
108 install -m 644 -c $(INSTALL_AUX) $(INSTALLROOT)$(AUXDIR)
109 -install -m 644 -c $(INSTALL_AUX_OPT) $(INSTALLROOT)$(AUXDIR)
110 mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man1
111 install -m 644 -c man/*.1 $(INSTALLROOT)$(MANDIR)/man1
112 : mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man8
113 : install -m 644 -c man/*.8 $(INSTALLROOT)$(MANDIR)/man8
115 install: local-install
116 set -e ; for i in $(INSTALLSUBDIRS) ; do $(MAKE) -C $$i $@ ; done
118 netinstall: installer
119 mkdir -p $(INSTALLROOT)$(TFTPBOOT)
120 install -m 644 $(NETINSTALLABLE) $(INSTALLROOT)$(TFTPBOOT)
122 extbootinstall: installer
123 mkdir -m 755 -p $(INSTALLROOT)$(EXTLINUXDIR)
124 install -m 644 $(EXTBOOTINSTALL) $(INSTALLROOT)$(EXTLINUXDIR)
126 install-all: install netinstall extbootinstall
129 rm -f *.o *.elf *_bin.c stupid.* patch.offset
130 rm -f *.lsr *.lst *.map *.sec *.tmp
134 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
139 clean: local-tidy local-clean
140 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
143 find . \( -name '*~' -o -name '#*' -o -name core \
144 -o -name '.*.d' -o -name .depend \) -type f -print0 \
147 dist: local-dist local-tidy
148 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
151 rm -f $(BTARGET) .depend *.so.*
153 spotless: local-clean local-dist local-spotless
154 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
159 $(MAKE) -C memdisk depend
161 # Shortcut to build linux/syslinux using klibc
164 $(MAKE) CC=klcc ITARGET= ISUBDIRS='linux extlinux' BSUBDIRS=
166 # Hook to add private Makefile targets for the maintainer.
167 -include Makefile.private