1 ## -----------------------------------------------------------------------
4 ## Copyright 1998-2001 H. Peter Anvin - All Rights Reserved
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., 675 Mass Ave, Cambridge MA 02139,
9 ## USA; either version 2 of the License, or (at your option) any later
10 ## version; incorporated herein by reference.
12 ## -----------------------------------------------------------------------
15 # Main Makefile for SYSLINUX
20 CFLAGS = -Wall -O2 -fomit-frame-pointer
26 LIBDIR = /usr/lib/syslinux
28 VERSION = $(shell cat version)
31 $(CC) $(INCLUDE) $(CFLAGS) -c $<
34 # The BTARGET refers to objects that are derived from ldlinux.asm; we
35 # like to keep those uniform for debugging reasons; however, distributors
36 # want to recompile the installers (ITARGET).
38 CSRC = syslinux.c gethostip.c
39 NASMSRC = ldlinux.asm syslinux.asm copybs.asm \
40 pxelinux.asm mbr.asm isolinux.asm
41 SOURCES = $(CSRC) $(NASMSRC) *.inc
42 BTARGET = ldlinux.bss ldlinux.sys ldlinux.bin ldlinux.lst \
43 pxelinux.0 mbr.bin isolinux.bin isolinux-debug.bin
44 ITARGET = syslinux.com syslinux copybs.com gethostip
45 DOCS = COPYING NEWS README TODO *.doc sample
46 OTHER = Makefile bin2c.pl now.pl genstupid.pl keytab-lilo.pl version \
47 sys2ansi.pl ppmtolss16 lss16toppm memdisk
48 OBSOLETE = pxelinux.bin
50 # Things to install in /usr/bin
51 INSTALL_BIN = syslinux gethostip ppmtolss16 lss16toppm
52 # Things to install in /usr/lib/syslinux
53 INSTALL_LIB = pxelinux.0 isolinux.bin isolinux-debug.bin \
54 syslinux.com copybs.com memdisk/memdisk
56 # The DATE is set on the make command line when building binaries for
57 # official release. Otherwise, substitute a hex string that is pretty much
58 # guaranteed to be unique to be unique from build to build.
60 HEXDATE := $(shell perl now.pl ldlinux.asm pxelinux.asm isolinux.asm)
66 all: $(BTARGET) $(ITARGET) samples memdisk
67 ls -l $(BTARGET) $(ITARGET) memdisk/memdisk
69 installer: $(ITARGET) samples
70 ls -l $(BTARGET) $(ITARGET)
78 $(MAKE) -C memdisk all
80 ldlinux.bin: ldlinux.asm
81 $(NASM) -f bin -dVERSION="'$(VERSION)'" -dDATE_STR="'$(DATE)'" \
82 -dHEXDATE="$(HEXDATE)" \
83 -l ldlinux.lst -o ldlinux.bin ldlinux.asm
84 perl genstupid.pl < ldlinux.lst
86 pxelinux.0: pxelinux.asm pxe.inc
87 $(NASM) -f bin -dVERSION="'$(VERSION)'" -dDATE_STR="'$(DATE)'" \
88 -dHEXDATE="$(HEXDATE)" \
89 -l pxelinux.lst -o pxelinux.0 pxelinux.asm
91 isolinux.bin: isolinux.asm
92 $(NASM) -f bin -dVERSION="'$(VERSION)'" -dDATE_STR="'$(DATE)'" \
93 -dHEXDATE="$(HEXDATE)" \
94 -l isolinux.lst -o isolinux.bin isolinux.asm
96 # Special verbose version of isolinux.bin
97 isolinux-debug.bin: isolinux.asm
98 $(NASM) -f bin -dVERSION="'$(VERSION)'" -dDATE_STR="'$(DATE)'" \
99 -dHEXDATE="$(HEXDATE)" -dDEBUG_MESSAGES \
100 -l isolinux-debug.lst -o isolinux-debug.bin isolinux.asm
102 ldlinux.bss: ldlinux.bin
103 dd if=ldlinux.bin of=ldlinux.bss bs=512 count=1
105 ldlinux.sys: ldlinux.bin
106 dd if=ldlinux.bin of=ldlinux.sys bs=512 skip=1
109 $(NASM) -f bin -l mbr.lst -o mbr.bin mbr.asm
111 syslinux.com: syslinux.asm ldlinux.bss ldlinux.sys stupid.inc
112 $(NASM) -f bin -l syslinux.lst -o syslinux.com syslinux.asm
114 copybs.com: copybs.asm
115 $(NASM) -f bin -l copybs.lst -o copybs.com copybs.asm
117 bootsect_bin.c: ldlinux.bss bin2c.pl
118 perl bin2c.pl bootsect < ldlinux.bss > bootsect_bin.c
120 ldlinux_bin.c: ldlinux.sys bin2c.pl
121 perl bin2c.pl ldlinux < ldlinux.sys > ldlinux_bin.c
123 syslinux: syslinux.o bootsect_bin.o ldlinux_bin.o stupid.o
124 $(CC) $(LDFLAGS) -o syslinux \
125 syslinux.o bootsect_bin.o ldlinux_bin.o stupid.o
127 ldlinux.lst: ldlinux.bin
128 : Generated by side effect
130 stupid.c: ldlinux.lst genstupid.pl
131 perl genstupid.pl < ldlinux.lst
134 : Generated by side effect
138 gethostip.o: gethostip.c
140 gethostip: gethostip.o
143 mkdir -m 755 -p $(INSTALLROOT)$(BINDIR) $(INSTALLROOT)$(LIBDIR)
144 install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR)
145 install -m 644 -c $(INSTALL_LIB) $(INSTALLROOT)$(LIBDIR)
148 rm -f *.o *_bin.c stupid.*
149 rm -f syslinux.lst copybs.lst pxelinux.lst isolinux*.lst
153 $(MAKE) -C memdisk tidy
158 clean: local-tidy local-clean
159 $(MAKE) -C sample clean
160 $(MAKE) -C memdisk clean
163 for dir in . sample memdisk ; do \
164 ( cd $$dir && rm -f *~ \#* core ) ; \
168 rm -f $(BTARGET) .depend
170 spotless: local-clean dist local-spotless
171 $(MAKE) -C sample spotless
172 $(MAKE) -C memdisk spotless
176 for csrc in $(CSRC) ; do $(CC) $(INCLUDE) -M $$csrc >> .depend ; done
177 for nsrc in $(NASMSRC) ; do $(NASM) -DDEPEND $(NINCLUDE) -o `echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M $$nsrc >> .depend ; done
183 # Hook to add private Makefile targets for the maintainer.
184 -include Makefile.private
186 # Include dependencies file