1 ## -----------------------------------------------------------------------
3 ## Copyright 1998-2009 H. Peter Anvin - All Rights Reserved
4 ## Copyright 2009 Intel Corporation; author: H. Peter Anvin
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 # Makefile for the SYSLINUX core
23 include $(topdir)/MCONFIG.embedded
24 -include $(topdir)/version.mk
27 INCLUDES = -I./include -I$(com32)/include
29 # This is very similar to cp437; technically it's for Norway and Denmark,
30 # but it's unlikely the characters that are different will be used in
31 # filenames by other users.
34 # The targets to build in this directory...
35 BTARGET = kwdhash.gen \
36 ldlinux.bss ldlinux.sys ldlinux.bin \
37 pxelinux.0 isolinux.bin isolinux-debug.bin \
38 extlinux.bin extlinux.bss extlinux.sys
40 # All primary source files for the main syslinux files
41 NASMSRC := $(wildcard *.asm)
42 NASMHDR := $(wildcard *.inc)
43 CSRC := $(wildcard *.c)
44 SSRC := $(wildcard *.S lzo/*.S)
45 CHDR := $(wildcard *.h)
47 ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) $(OTHERSRC)
49 COBJ := $(patsubst %.c,%.o,$(CSRC))
50 SOBJ := $(patsubst %.S,%.o,$(SSRC))
53 LIBS = $(LIB) $(com32)/lib/libcom32.a $(LIBGCC)
54 LIBOBJS = $(COBJ) $(SOBJ)
56 NASMDEBUG = -g -F stabs
57 NASMOPT += $(NASMDEBUG)
59 PREPCORE = ../lzo/prepcore
61 # The DATE is set on the make command line when building binaries for
62 # official release. Otherwise, substitute a hex string that is pretty much
63 # guaranteed to be unique to be unique from build to build.
65 HEXDATE := $(shell $(PERL) ../now.pl $(SRCS))
68 DATE := $(shell sh ../gen-id.sh $(VERSION) $(HEXDATE))
73 kwdhash.gen: keywords genhash.pl
74 $(PERL) genhash.pl < keywords > kwdhash.gen
79 $(OBJCOPY) -O binary $< $(@:.bin=.raw)
81 %.bin: %.raw $(PREPCORE)
84 %.o: %.asm kwdhash.gen ../version.gen
85 ( $(NASM) -f elf $(NASMOPT) -M -DDEPEND $(NINCLUDE) \
86 -o $@ $< ; echo '' ) > .$@.d; true
87 $(NASM) -f elf $(NASMOPT) -DDATE_STR="'$(DATE)'" \
88 -DHEXDATE="$(HEXDATE)" \
89 -l $(@:.o=.lsr) -o $@ $<
91 %.elf: %.o $(LIBS) syslinux.ld
92 $(LD) $(LDFLAGS) -T syslinux.ld -M -o $@ $< $(LIBS) > $(@:.elf=.map)
93 $(OBJDUMP) -h $@ > $(@:.elf=.sec)
94 $(PERL) lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst)
101 pxelinux.0: pxelinux.bin
104 ldlinux.bss: ldlinux.bin
105 dd if=$< of=$@ bs=512 count=1
107 ldlinux.sys: ldlinux.bin
108 dd if=$< of=$@ bs=512 skip=1
110 extlinux.bss: extlinux.bin
111 dd if=$< of=$@ bs=512 count=1
113 extlinux.sys: extlinux.bin
114 dd if=$< of=$@ bs=512 skip=1
116 # NASM prior to 2.03 wouldn't auto-generate this dependency...
117 ldlinux.o: codepage.cp
119 codepage.cp: ../codepage/$(CODEPAGE).cp
124 install-lib: installer
126 install-all: install install-lib
128 netinstall: installer
131 rm -f codepage.cp *.o *.elf *.a stupid.* patch.offset .depend .*.d
132 rm -f *.lsr *.lst *.map *.sec *.raw
133 rm -f */*.o */*.lst */.*.d
139 rm -f $(BTARGET) *.bin *_bin.c
141 # Include dependencies file