Merge remote-tracking branch 'mfleming/elflink-dot-zero' into elflink
[syslinux.git] / Makefile
blob383f9f57e33bf76636ea2739e34ba3705b930889
1 ## -----------------------------------------------------------------------
2 ##
3 ## Copyright 1998-2009 H. Peter Anvin - All Rights Reserved
4 ## Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
5 ##
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
17 topdir = .
18 MAKEDIR = $(topdir)/mk
19 include $(MAKEDIR)/syslinux.mk
20 -include $(topdir)/version.mk
23 # The BTARGET refers to objects that are derived from ldlinux.asm; we
24 # like to keep those uniform for debugging reasons; however, distributors
25 # want to recompile the installers (ITARGET).
27 # BOBJECTS and IOBJECTS are the same thing, except used for
28 # installation, so they include objects that may be in subdirectories
29 # with their own Makefiles. Finally, there is a list of those
30 # directories.
33 # List of module objects that should be installed for all derivatives
34 MODULES = memdisk/memdisk memdump/memdump.com modules/*.com \
35 com32/menu/*.c32 com32/modules/*.c32 com32/mboot/*.c32 \
36 com32/hdt/*.c32 com32/rosh/*.c32 com32/gfxboot/*.c32 \
37 com32/sysdump/*.c32 com32/lua/src/*.c32 \
38 com32/lib/*.c32 com32/libutil/*.c32 com32/gpllib/*.c32
40 # syslinux.exe is BTARGET so as to not require everyone to have the
41 # mingw suite installed
42 BTARGET = version.gen version.h version.mk
43 BOBJECTS = $(BTARGET) \
44 mbr/*.bin \
45 core/pxelinux.0 core/isolinux.bin core/isolinux-debug.bin \
46 gpxe/gpxelinux.0 dos/syslinux.com \
47 win32/syslinux.exe win64/syslinux64.exe \
48 dosutil/*.com dosutil/*.sys \
49 $(MODULES)
51 # BSUBDIRs build the on-target binary components.
52 # ISUBDIRs build the installer (host) components.
54 # Note: libinstaller is both a BSUBDIR and an ISUBDIR. It contains
55 # files that depend only on the B phase, but may have to be regenerated
56 # for "make installer".
57 BSUBDIRS = codepage com32 lzo core memdisk modules mbr memdump gpxe sample \
58 diag libinstaller dos win32 win64 dosutil
59 ITARGET =
60 IOBJECTS = $(ITARGET) \
61 utils/gethostip utils/isohybrid utils/mkdiskimage \
62 mtools/syslinux linux/syslinux extlinux/extlinux
63 ISUBDIRS = libinstaller mtools linux extlinux utils
65 # Things to install in /usr/bin
66 INSTALL_BIN = mtools/syslinux
67 # Things to install in /sbin
68 INSTALL_SBIN = extlinux/extlinux
69 # Things to install in /usr/lib/syslinux
70 INSTALL_AUX = core/pxelinux.0 gpxe/gpxelinux.0 gpxe/gpxelinuxk.0 \
71 core/isolinux.bin core/isolinux-debug.bin \
72 dos/syslinux.com \
73 mbr/*.bin $(MODULES)
74 INSTALL_AUX_OPT = win32/syslinux.exe win64/syslinux64.exe
75 INSTALL_DIAG = diag/mbr/handoff.bin \
76 diag/geodsp/geodsp1s.img.xz diag/geodsp/geodspms.img.xz
78 # These directories manage their own installables
79 INSTALLSUBDIRS = com32 utils dosutil
81 # Things to install in /boot/extlinux
82 EXTBOOTINSTALL = $(MODULES)
84 # Things to install in /tftpboot
85 NETINSTALLABLE = core/pxelinux.0 gpxe/gpxelinux.0 \
86 com32/elflink/ldlinux/ldlinux.c32 \
87 $(MODULES)
89 all:
90 $(MAKE) all-local
91 set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
92 -ls -l $(BOBJECTS) $(IOBJECTS)
94 all-local: $(BTARGET) $(ITARGET)
96 installer:
97 $(MAKE) installer-local
98 set -e ; for i in $(ISUBDIRS); do $(MAKE) -C $$i all ; done
99 -ls -l $(BOBJECTS) $(IOBJECTS)
101 installer-local: $(ITARGET) $(BINFILES)
103 version.gen: version version.pl
104 $(PERL) version.pl $< $@ '%define < @'
105 version.h: version version.pl
106 $(PERL) version.pl $< $@ '#define < @'
107 version.mk: version version.pl
108 $(PERL) version.pl $< $@ '< := @'
110 local-install: installer
111 mkdir -m 755 -p $(INSTALLROOT)$(BINDIR)
112 install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR)
113 mkdir -m 755 -p $(INSTALLROOT)$(SBINDIR)
114 install -m 755 -c $(INSTALL_SBIN) $(INSTALLROOT)$(SBINDIR)
115 mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
116 install -m 644 -c $(INSTALL_AUX) $(INSTALLROOT)$(AUXDIR)
117 -install -m 644 -c $(INSTALL_AUX_OPT) $(INSTALLROOT)$(AUXDIR)
118 mkdir -m 755 -p $(INSTALLROOT)$(DIAGDIR)
119 install -m 644 -c $(INSTALL_DIAG) $(INSTALLROOT)$(DIAGDIR)
120 mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man1
121 install -m 644 -c man/*.1 $(INSTALLROOT)$(MANDIR)/man1
122 : mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man8
123 : install -m 644 -c man/*.8 $(INSTALLROOT)$(MANDIR)/man8
125 install: local-install
126 set -e ; for i in $(INSTALLSUBDIRS) ; do $(MAKE) -C $$i $@ ; done
128 netinstall: installer
129 mkdir -p $(INSTALLROOT)$(TFTPBOOT)
130 install -m 644 $(NETINSTALLABLE) $(INSTALLROOT)$(TFTPBOOT)
132 extbootinstall: installer
133 mkdir -m 755 -p $(INSTALLROOT)$(EXTLINUXDIR)
134 install -m 644 $(EXTBOOTINSTALL) $(INSTALLROOT)$(EXTLINUXDIR)
136 install-all: install netinstall extbootinstall
138 local-tidy:
139 rm -f *.o *.elf *_bin.c stupid.* patch.offset
140 rm -f *.lsr *.lst *.map *.sec *.tmp
141 rm -f $(OBSOLETE)
143 tidy: local-tidy
144 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
146 local-clean:
147 rm -f $(ITARGET)
149 clean: local-tidy local-clean
150 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
152 local-dist:
153 find . \( -name '*~' -o -name '#*' -o -name core \
154 -o -name '.*.d' -o -name .depend \) -type f -print0 \
155 | xargs -0rt rm -f
157 dist: local-dist local-tidy
158 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
160 local-spotless:
161 rm -f $(BTARGET) .depend *.so.*
163 spotless: local-clean local-dist local-spotless
164 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
166 # Shortcut to build linux/syslinux using klibc
167 klibc:
168 $(MAKE) clean
169 $(MAKE) CC=klcc ITARGET= ISUBDIRS='linux extlinux' BSUBDIRS=
171 # Hook to add private Makefile targets for the maintainer.
172 -include Makefile.private