ethersel: use library functions
[syslinux.git] / Makefile
blob6b90c09405dcbbff06a25bb7126654c12132673e
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 # syslinux.exe is BTARGET so as to not require everyone to have the
32 # mingw suite installed
33 BTARGET = version.gen version.h version.mk
34 BOBJECTS = $(BTARGET) \
35 mbr/mbr.bin mbr/gptmbr.bin \
36 core/pxelinux.0 core/isolinux.bin core/isolinux-debug.bin \
37 gpxe/gpxelinux.0 dos/syslinux.com win32/syslinux.exe \
38 memdisk/memdisk memdump/memdump.com
40 # BSUBDIRs build the on-target binary components.
41 # ISUBDIRs build the installer (host) components.
43 # Note: libinstaller is both a BSUBDIR and an ISUBDIR. It contains
44 # files that depend only on the B phase, but may have to be regenerated
45 # for "make installer".
46 BSUBDIRS = codepage core memdisk com32 mbr memdump gpxe sample \
47 libinstaller dos win32
48 ITARGET =
49 IOBJECTS = $(ITARGET) dos/copybs.com utils/gethostip utils/mkdiskimage \
50 mtools/syslinux linux/syslinux extlinux/extlinux
51 ISUBDIRS = libinstaller mtools linux extlinux utils
53 # Things to install in /usr/bin
54 INSTALL_BIN = mtools/syslinux
55 # Things to install in /sbin
56 INSTALL_SBIN = extlinux/extlinux
57 # Things to install in /usr/lib/syslinux
58 INSTALL_AUX = core/pxelinux.0 gpxe/gpxelinux.0 core/isolinux.bin \
59 core/isolinux-debug.bin \
60 dos/syslinux.com dos/copybs.com win32/syslinux.exe \
61 memdisk/memdisk memdump/memdump.com \
62 mbr/mbr.bin mbr/gptmbr.bin
63 INSTALL_AUX_OPT = win32/syslinux.exe
65 # These directories manage their own installables
66 INSTALLSUBDIRS = com32 utils
68 # Things to install in /boot/extlinux
69 EXTBOOTINSTALL = memdisk/memdisk memdump/memdump.com \
70 com32/menu/*.c32 com32/modules/*.c32
72 # Things to install in /tftpboot
73 NETINSTALLABLE = core/pxelinux.0 gpxe/gpxelinux.0 memdisk/memdisk \
74 memdump/memdump.com com32/menu/*.c32 com32/modules/*.c32
76 all:
77 $(MAKE) all-local
78 set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
79 -ls -l $(BOBJECTS) $(IOBJECTS)
81 all-local: $(BTARGET) $(ITARGET)
83 installer:
84 $(MAKE) installer-local
85 set -e ; for i in $(ISUBDIRS); do $(MAKE) -C $$i all ; done
86 -ls -l $(BOBJECTS) $(IOBJECTS)
88 installer-local: $(ITARGET) $(BINFILES)
90 version.gen: version version.pl
91 $(PERL) version.pl $< $@ '%define < @'
92 version.h: version version.pl
93 $(PERL) version.pl $< $@ '#define < @'
94 version.mk: version version.pl
95 $(PERL) version.pl $< $@ '< := @'
97 local-install: installer
98 mkdir -m 755 -p $(INSTALLROOT)$(BINDIR)
99 install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR)
100 mkdir -m 755 -p $(INSTALLROOT)$(SBINDIR)
101 install -m 755 -c $(INSTALL_SBIN) $(INSTALLROOT)$(SBINDIR)
102 mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
103 install -m 644 -c $(INSTALL_AUX) $(INSTALLROOT)$(AUXDIR)
104 -install -m 644 -c $(INSTALL_AUX_OPT) $(INSTALLROOT)$(AUXDIR)
105 mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man1
106 install -m 644 -c man/*.1 $(INSTALLROOT)$(MANDIR)/man1
107 : mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man8
108 : install -m 644 -c man/*.8 $(INSTALLROOT)$(MANDIR)/man8
110 install: local-install
111 set -e ; for i in $(INSTALLSUBDIRS) ; do $(MAKE) -C $$i $@ ; done
113 netinstall: installer
114 mkdir -p $(INSTALLROOT)$(TFTPBOOT)
115 install -m 644 $(NETINSTALLABLE) $(INSTALLROOT)$(TFTPBOOT)
117 extbootinstall: installer
118 mkdir -m 755 -p $(INSTALLROOT)$(EXTLINUXDIR)
119 install -m 644 $(EXTBOOTINSTALL) $(INSTALLROOT)$(EXTLINUXDIR)
121 install-all: install netinstall extbootinstall
123 local-tidy:
124 rm -f *.o *.elf *_bin.c stupid.* patch.offset
125 rm -f *.lsr *.lst *.map *.sec
126 rm -f $(OBSOLETE)
128 tidy: local-tidy
129 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
131 local-clean:
132 rm -f $(ITARGET)
134 clean: local-tidy local-clean
135 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
137 local-dist:
138 find . \( -name '*~' -o -name '#*' -o -name core \
139 -o -name '.*.d' -o -name .depend \) -type f -print0 \
140 | xargs -0rt rm -f
142 dist: local-dist local-tidy
143 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
145 local-spotless:
146 rm -f $(BTARGET) .depend *.so.*
148 spotless: local-clean local-dist local-spotless
149 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
151 local-depend:
153 depend: local-depend
154 $(MAKE) -C memdisk depend
156 # Shortcut to build linux/syslinux using klibc
157 klibc:
158 $(MAKE) clean
159 $(MAKE) CC=klcc ITARGET= ISUBDIRS='linux extlinux' BSUBDIRS=
161 # Hook to add private Makefile targets for the maintainer.
162 -include Makefile.private