Now working on version 3.73; update NEWS
[syslinux.git] / Makefile
blobffbc48f1549fe4e521cd1ca932fb2a5facd07a23
1 ## -----------------------------------------------------------------------
2 ##
3 ## Copyright 1998-2008 H. Peter Anvin - All Rights Reserved
4 ##
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
16 topdir = .
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
28 # directories.
31 # List of module objects that should be installed for all derivatives
32 MODULES = memdisk/memdisk memdump/memdump.com \
33 modules/*.com com32/menu/*.c32 com32/modules/*.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 \
43 $(MODULES)
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
53 ITARGET =
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 \
68 $(MODULES)
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 \
79 $(MODULES)
81 all:
82 $(MAKE) all-local
83 set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
84 -ls -l $(BOBJECTS) $(IOBJECTS)
86 all-local: $(BTARGET) $(ITARGET)
88 installer:
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
128 local-tidy:
129 rm -f *.o *.elf *_bin.c stupid.* patch.offset
130 rm -f *.lsr *.lst *.map *.sec *.tmp
131 rm -f $(OBSOLETE)
133 tidy: local-tidy
134 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
136 local-clean:
137 rm -f $(ITARGET)
139 clean: local-tidy local-clean
140 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
142 local-dist:
143 find . \( -name '*~' -o -name '#*' -o -name core \
144 -o -name '.*.d' -o -name .depend \) -type f -print0 \
145 | xargs -0rt rm -f
147 dist: local-dist local-tidy
148 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
150 local-spotless:
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
156 local-depend:
158 depend: local-depend
159 $(MAKE) -C memdisk depend
161 # Shortcut to build linux/syslinux using klibc
162 klibc:
163 $(MAKE) clean
164 $(MAKE) CC=klcc ITARGET= ISUBDIRS='linux extlinux' BSUBDIRS=
166 # Hook to add private Makefile targets for the maintainer.
167 -include Makefile.private