ldlinux: Dynamically alloc memory for kernel and initrd filenames
[syslinux.git] / Makefile
blob07a1dc3215ba898a45f3c2ee9545a40ed4721d79
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 MODULES = memdisk/memdisk memdump/memdump.com \
34 com32/menu/*.c32 com32/modules/*.c32 com32/mboot/*.c32 \
35 com32/hdt/*.c32 com32/rosh/*.c32 com32/gfxboot/*.c32 \
36 com32/sysdump/*.c32 com32/lua/src/*.c32 com32/chain/*.c32 \
37 com32/lib/*.c32 com32/libutil/*.c32 com32/gpllib/*.c32 \
38 com32/elflink/ldlinux/*.c32 com32/cmenu/libmenu/*.c32
40 # List of module objects that should be installed for all derivatives
41 INSTALLABLE_MODULES = $(MODULES)
43 # syslinux.exe is BTARGET so as to not require everyone to have the
44 # mingw suite installed
45 BTARGET = version.gen version.h version.mk
46 BOBJECTS = $(BTARGET) \
47 mbr/*.bin \
48 core/pxelinux.0 core/isolinux.bin core/isolinux-debug.bin \
49 gpxe/gpxelinux.0 dos/syslinux.com \
50 win32/syslinux.exe win64/syslinux64.exe \
51 dosutil/*.com dosutil/*.sys \
52 $(MODULES)
54 # BSUBDIRs build the on-target binary components.
55 # ISUBDIRs build the installer (host) components.
57 # Note: libinstaller is both a BSUBDIR and an ISUBDIR. It contains
58 # files that depend only on the B phase, but may have to be regenerated
59 # for "make installer".
60 BSUBDIRS = codepage com32 lzo core memdisk mbr memdump gpxe sample \
61 diag libinstaller dos win32 win64 dosutil
62 ITARGET =
63 IOBJECTS = $(ITARGET) \
64 utils/gethostip utils/isohybrid utils/mkdiskimage \
65 mtools/syslinux linux/syslinux extlinux/extlinux
66 ISUBDIRS = libinstaller mtools linux extlinux utils
68 # Things to install in /usr/bin
69 INSTALL_BIN = mtools/syslinux
70 # Things to install in /sbin
71 INSTALL_SBIN = extlinux/extlinux
72 # Things to install in /usr/lib/syslinux
73 INSTALL_AUX = core/pxelinux.0 gpxe/gpxelinux.0 gpxe/gpxelinuxk.0 \
74 core/isolinux.bin core/isolinux-debug.bin \
75 dos/syslinux.com \
76 mbr/*.bin $(INSTALLABLE_MODULES)
77 INSTALL_AUX_OPT = win32/syslinux.exe win64/syslinux64.exe
78 INSTALL_DIAG = diag/mbr/handoff.bin \
79 diag/geodsp/geodsp1s.img.xz diag/geodsp/geodspms.img.xz
81 # These directories manage their own installables
82 INSTALLSUBDIRS = com32 utils dosutil
84 # Things to install in /boot/extlinux
85 EXTBOOTINSTALL = $(INSTALLABLE_MODULES)
87 # Things to install in /tftpboot
88 NETINSTALLABLE = core/pxelinux.0 gpxe/gpxelinux.0 \
89 $(INSTALLABLE_MODULES)
91 all:
92 $(MAKE) all-local
93 set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
94 -ls -l $(BOBJECTS) $(IOBJECTS)
96 all-local: $(BTARGET) $(ITARGET)
98 installer:
99 $(MAKE) installer-local
100 set -e ; for i in $(ISUBDIRS); do $(MAKE) -C $$i all ; done
101 -ls -l $(BOBJECTS) $(IOBJECTS)
103 installer-local: $(ITARGET) $(BINFILES)
105 strip:
106 $(MAKE) strip-local
107 set -e ; for i in $(ISUBDIRS); do $(MAKE) -C $$i strip ; done
108 -ls -l $(BOBJECTS) $(IOBJECTS)
110 strip-local:
112 version.gen: version version.pl
113 $(PERL) version.pl $< $@ '%define < @'
114 version.h: version version.pl
115 $(PERL) version.pl $< $@ '#define < @'
116 version.mk: version version.pl
117 $(PERL) version.pl $< $@ '< := @'
119 local-install: installer
120 mkdir -m 755 -p $(INSTALLROOT)$(BINDIR)
121 install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR)
122 mkdir -m 755 -p $(INSTALLROOT)$(SBINDIR)
123 install -m 755 -c $(INSTALL_SBIN) $(INSTALLROOT)$(SBINDIR)
124 mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
125 install -m 644 -c $(INSTALL_AUX) $(INSTALLROOT)$(AUXDIR)
126 -install -m 644 -c $(INSTALL_AUX_OPT) $(INSTALLROOT)$(AUXDIR)
127 mkdir -m 755 -p $(INSTALLROOT)$(DIAGDIR)
128 install -m 644 -c $(INSTALL_DIAG) $(INSTALLROOT)$(DIAGDIR)
129 mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man1
130 install -m 644 -c man/*.1 $(INSTALLROOT)$(MANDIR)/man1
131 : mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man8
132 : install -m 644 -c man/*.8 $(INSTALLROOT)$(MANDIR)/man8
134 install: local-install
135 set -e ; for i in $(INSTALLSUBDIRS) ; do $(MAKE) -C $$i $@ ; done
137 netinstall: installer
138 mkdir -p $(INSTALLROOT)$(TFTPBOOT)
139 install -m 644 $(NETINSTALLABLE) $(INSTALLROOT)$(TFTPBOOT)
141 extbootinstall: installer
142 mkdir -m 755 -p $(INSTALLROOT)$(EXTLINUXDIR)
143 install -m 644 $(EXTBOOTINSTALL) $(INSTALLROOT)$(EXTLINUXDIR)
145 install-all: install netinstall extbootinstall
147 local-tidy:
148 rm -f *.o *.elf *_bin.c stupid.* patch.offset
149 rm -f *.lsr *.lst *.map *.sec *.tmp
150 rm -f $(OBSOLETE)
152 tidy: local-tidy
153 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
155 local-clean:
156 rm -f $(ITARGET)
158 clean: local-tidy local-clean
159 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
161 local-dist:
162 find . \( -name '*~' -o -name '#*' -o -name core \
163 -o -name '.*.d' -o -name .depend \) -type f -print0 \
164 | xargs -0rt rm -f
166 dist: local-dist local-tidy
167 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
169 local-spotless:
170 rm -f $(BTARGET) .depend *.so.*
172 spotless: local-clean local-dist local-spotless
173 set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
175 # Shortcut to build linux/syslinux using klibc
176 klibc:
177 $(MAKE) clean
178 $(MAKE) CC=klcc ITARGET= ISUBDIRS='linux extlinux' BSUBDIRS=
180 # Hook to add private Makefile targets for the maintainer.
181 -include Makefile.private