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