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
24 LIBDIR = /usr/lib/syslinux
26 VERSION = $(shell cat version)
32 # The BTARGET refers to objects that are derived from ldlinux.asm; we
33 # like to keep those uniform for debugging reasons; however, distributors
34 # want to recompile the installers (ITARGET).
36 SOURCES = ldlinux.asm syslinux.asm syslinux.c copybs.asm \
37 pxelinux.asm pxe.inc mbr.asm gethostip.c \
39 BTARGET = bootsect.bin ldlinux.sys ldlinux.bin ldlinux.lst \
40 pxelinux.0 mbr.bin isolinux.bin isolinux-debug.bin
41 ITARGET = syslinux.com syslinux copybs.com gethostip
42 DOCS = COPYING NEWS README TODO *.doc sample
43 OTHER = Makefile bin2c.pl now.pl genstupid.pl keytab-lilo.pl version \
44 sys2ansi.pl ppmtolss16 lss16toppm memdisk
45 OBSOLETE = pxelinux.bin
47 # Things to install in /usr/bin
48 INSTALL_BIN = syslinux gethostip ppmtolss16 lss16toppm
49 # Things to install in /usr/lib/syslinux
50 INSTALL_LIB = pxelinux.0 isolinux.bin isolinux-debug.bin \
51 syslinux.com copybs.com memdisk/memdisk
53 # The DATE is set on the make command line when building binaries for
54 # official release. Otherwise, substitute a hex string that is pretty much
55 # guaranteed to be unique to be unique from build to build.
57 HEXDATE := $(shell perl now.pl ldlinux.asm pxelinux.asm isolinux.asm)
63 all: $(BTARGET) $(ITARGET) samples memdisk
64 ls -l $(BTARGET) $(ITARGET) memdisk/memdisk
66 installer: $(ITARGET) samples
67 ls -l $(BTARGET) $(ITARGET)
75 $(MAKE) -C memdisk all
77 ldlinux.bin: ldlinux.asm
78 $(NASM) -f bin -dVERSION="'$(VERSION)'" -dDATE_STR="'$(DATE)'" \
79 -dHEXDATE="$(HEXDATE)" \
80 -l ldlinux.lst -o ldlinux.bin ldlinux.asm
81 perl genstupid.pl < ldlinux.lst
83 pxelinux.0: pxelinux.asm pxe.inc
84 $(NASM) -f bin -dVERSION="'$(VERSION)'" -dDATE_STR="'$(DATE)'" \
85 -dHEXDATE="$(HEXDATE)" \
86 -l pxelinux.lst -o pxelinux.0 pxelinux.asm
88 isolinux.bin: isolinux.asm
89 $(NASM) -f bin -dVERSION="'$(VERSION)'" -dDATE_STR="'$(DATE)'" \
90 -dHEXDATE="$(HEXDATE)" \
91 -l isolinux.lst -o isolinux.bin isolinux.asm
93 # Special verbose version of isolinux.bin
94 isolinux-debug.bin: isolinux.asm
95 $(NASM) -f bin -dVERSION="'$(VERSION)'" -dDATE_STR="'$(DATE)'" \
96 -dHEXDATE="$(HEXDATE)" -dDEBUG_MESSAGES \
97 -l isolinux-debug.lst -o isolinux-debug.bin isolinux.asm
99 bootsect.bin: ldlinux.bin
100 dd if=ldlinux.bin of=bootsect.bin bs=512 count=1
102 ldlinux.sys: ldlinux.bin
103 dd if=ldlinux.bin of=ldlinux.sys bs=512 skip=1
106 $(NASM) -f bin -l mbr.lst -o mbr.bin mbr.asm
108 syslinux.com: syslinux.asm bootsect.bin ldlinux.sys stupid.inc
109 $(NASM) -f bin -l syslinux.lst -o syslinux.com syslinux.asm
111 copybs.com: copybs.asm
112 $(NASM) -f bin -l copybs.lst -o copybs.com copybs.asm
114 bootsect_bin.c: bootsect.bin bin2c.pl
115 perl bin2c.pl bootsect < bootsect.bin > bootsect_bin.c
117 ldlinux_bin.c: ldlinux.sys bin2c.pl
118 perl bin2c.pl ldlinux < ldlinux.sys > ldlinux_bin.c
120 syslinux: syslinux.o bootsect_bin.o ldlinux_bin.o stupid.o
121 $(CC) $(LDFLAGS) -o syslinux \
122 syslinux.o bootsect_bin.o ldlinux_bin.o stupid.o
124 ldlinux.lst: ldlinux.bin
125 : Generated by side effect
127 stupid.c: ldlinux.lst genstupid.pl
128 perl genstupid.pl < ldlinux.lst
131 : Generated by side effect
135 gethostip.o: gethostip.c
137 gethostip: gethostip.o
140 mkdir -m 755 -p $(INSTALLROOT)$(BINDIR) $(INSTALLROOT)$(LIBDIR)
141 install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR)
142 install -m 644 -c $(INSTALL_LIB) $(INSTALLROOT)$(LIBDIR)
145 rm -f *.o *_bin.c stupid.*
146 rm -f syslinux.lst copybs.lst pxelinux.lst isolinux*.lst
150 $(MAKE) -C memdisk tidy
155 clean: local-tidy local-clean
156 $(MAKE) -C sample clean
157 $(MAKE) -C memdisk clean
160 for dir in . sample memdisk ; do \
161 ( cd $$dir && rm -f *~ \#* core ) ; \
167 spotless: local-clean dist local-spotless
168 $(MAKE) -C sample spotless
169 $(MAKE) -C memdisk spotless
172 # Hook to add private Makefile targets for the maintainer.
174 -include Makefile.private