relocs: Move stop to the end
[profile/ivi/syslinux.git] / Makefile
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.
11 ##
12 ## -----------------------------------------------------------------------
13
14 #
15 # Main Makefile for SYSLINUX
16 #
17 topdir = .
18 MAKEDIR = $(topdir)/mk
19 include $(MAKEDIR)/syslinux.mk
20 -include $(topdir)/version.mk
21
22 #
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).
26 #
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.
31 #
32
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 com32/chain/*.c32
38
39 # syslinux.exe is BTARGET so as to not require everyone to have the
40 # mingw suite installed
41 BTARGET  = version.gen version.h version.mk
42 BOBJECTS = $(BTARGET) \
43         mbr/*.bin \
44         core/pxelinux.0 core/isolinux.bin core/isolinux-debug.bin \
45         gpxe/gpxelinux.0 dos/syslinux.com \
46         win32/syslinux.exe win64/syslinux64.exe \
47         dosutil/*.com dosutil/*.sys \
48         $(MODULES)
49
50 # BSUBDIRs build the on-target binary components.
51 # ISUBDIRs build the installer (host) components.
52 #
53 # Note: libinstaller is both a BSUBDIR and an ISUBDIR.  It contains
54 # files that depend only on the B phase, but may have to be regenerated
55 # for "make installer".
56 BSUBDIRS = codepage com32 lzo core memdisk modules mbr memdump gpxe sample \
57            diag libinstaller dos win32 win64 dosutil
58 ITARGET  =
59 IOBJECTS = $(ITARGET) \
60         utils/gethostip utils/isohybrid utils/mkdiskimage \
61         mtools/syslinux linux/syslinux extlinux/extlinux
62 ISUBDIRS = libinstaller mtools linux extlinux utils
63
64 # Things to install in /usr/bin
65 INSTALL_BIN   = mtools/syslinux
66 # Things to install in /sbin
67 INSTALL_SBIN  = extlinux/extlinux
68 # Things to install in /usr/lib/syslinux
69 INSTALL_AUX   = core/pxelinux.0 gpxe/gpxelinux.0 gpxe/gpxelinuxk.0 \
70                 core/isolinux.bin core/isolinux-debug.bin \
71                 dos/syslinux.com \
72                 mbr/*.bin $(MODULES)
73 INSTALL_AUX_OPT = win32/syslinux.exe win64/syslinux64.exe
74 INSTALL_DIAG  = diag/mbr/handoff.bin \
75                 diag/geodsp/geodsp1s.img.xz diag/geodsp/geodspms.img.xz
76
77 # These directories manage their own installables
78 INSTALLSUBDIRS = com32 utils dosutil
79
80 # Things to install in /boot/extlinux
81 EXTBOOTINSTALL = $(MODULES)
82
83 # Things to install in /tftpboot
84 NETINSTALLABLE = core/pxelinux.0 gpxe/gpxelinux.0 \
85                  $(MODULES)
86
87 all:
88         $(MAKE) all-local
89         set -e ; for i in $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
90         -ls -l $(BOBJECTS) $(IOBJECTS)
91
92 all-local: $(BTARGET) $(ITARGET)
93
94 installer:
95         $(MAKE) installer-local
96         set -e ; for i in $(ISUBDIRS); do $(MAKE) -C $$i all ; done
97         -ls -l $(BOBJECTS) $(IOBJECTS)
98
99 installer-local: $(ITARGET) $(BINFILES)
100
101 strip:
102         $(MAKE) strip-local
103         set -e ; for i in $(ISUBDIRS); do $(MAKE) -C $$i strip ; done
104         -ls -l $(BOBJECTS) $(IOBJECTS)
105
106 strip-local:
107
108 version.gen: version version.pl
109         $(PERL) version.pl $< $@ '%define < @'
110 version.h: version version.pl
111         $(PERL) version.pl $< $@ '#define < @'
112 version.mk: version version.pl
113         $(PERL) version.pl $< $@ '< := @'
114
115 local-install: installer
116         mkdir -m 755 -p $(INSTALLROOT)$(BINDIR)
117         install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR)
118         mkdir -m 755 -p $(INSTALLROOT)$(SBINDIR)
119         install -m 755 -c $(INSTALL_SBIN) $(INSTALLROOT)$(SBINDIR)
120         mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)
121         install -m 644 -c $(INSTALL_AUX) $(INSTALLROOT)$(AUXDIR)
122         -install -m 644 -c $(INSTALL_AUX_OPT) $(INSTALLROOT)$(AUXDIR)
123         mkdir -m 755 -p $(INSTALLROOT)$(DIAGDIR)
124         install -m 644 -c $(INSTALL_DIAG) $(INSTALLROOT)$(DIAGDIR)
125         mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man1
126         install -m 644 -c man/*.1 $(INSTALLROOT)$(MANDIR)/man1
127         : mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man8
128         : install -m 644 -c man/*.8 $(INSTALLROOT)$(MANDIR)/man8
129
130 install: local-install
131         set -e ; for i in $(INSTALLSUBDIRS) ; do $(MAKE) -C $$i $@ ; done
132
133 netinstall: installer
134         mkdir -p $(INSTALLROOT)$(TFTPBOOT)
135         install -m 644 $(NETINSTALLABLE) $(INSTALLROOT)$(TFTPBOOT)
136
137 extbootinstall: installer
138         mkdir -m 755 -p $(INSTALLROOT)$(EXTLINUXDIR)
139         install -m 644 $(EXTBOOTINSTALL) $(INSTALLROOT)$(EXTLINUXDIR)
140
141 install-all: install netinstall extbootinstall
142
143 local-tidy:
144         rm -f *.o *.elf *_bin.c stupid.* patch.offset
145         rm -f *.lsr *.lst *.map *.sec *.tmp
146         rm -f $(OBSOLETE)
147
148 tidy: local-tidy
149         set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
150
151 local-clean:
152         rm -f $(ITARGET)
153
154 clean: local-tidy local-clean
155         set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
156
157 local-dist:
158         find . \( -name '*~' -o -name '#*' -o -name core \
159                 -o -name '.*.d' -o -name .depend \) -type f -print0 \
160         | xargs -0rt rm -f
161
162 dist: local-dist local-tidy
163         set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
164
165 local-spotless:
166         rm -f $(BTARGET) .depend *.so.*
167
168 spotless: local-clean local-dist local-spotless
169         set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) $(BSUBDIRS) $(ISUBDIRS) ; do $(MAKE) -C $$i $@ ; done
170
171 # Shortcut to build linux/syslinux using klibc
172 klibc:
173         $(MAKE) clean
174         $(MAKE) CC=klcc ITARGET= ISUBDIRS='linux extlinux' BSUBDIRS=
175
176 # Hook to add private Makefile targets for the maintainer.
177 -include Makefile.private