1 ## -----------------------------------------------------------------------
3 ## Copyright 1998-2009 H. Peter Anvin - All Rights Reserved
4 ## Copyright 2009-2010 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 isolinux.bin isolinux-debug.bin pxelinux.0
39 # All primary source files for the main syslinux files
40 NASMSRC := $(wildcard *.asm)
41 NASMHDR := $(wildcard *.inc)
42 CSRC := $(wildcard *.c */*.c */*/*.c)
43 SSRC := $(wildcard *.S */*.S */*/*.S)
44 CHDR := $(wildcard *.h)
46 ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) $(OTHERSRC)
48 COBJ := $(patsubst %.c,%.o,$(CSRC))
49 SOBJ := $(patsubst %.S,%.o,$(SSRC))
52 LIBS = $(LIB) $(com32)/lib/libcomcore.a $(LIBGCC)
53 LIBOBJS = $(COBJ) $(SOBJ)
55 NASMDEBUG = -g -F dwarf
56 NASMOPT += $(NASMDEBUG)
58 PREPCORE = ../lzo/prepcore
62 # The DATE is set on the make command line when building binaries for
63 # official release. Otherwise, substitute a hex string that is pretty much
64 # guaranteed to be unique to be unique from build to build.
66 HEXDATE := $(shell $(PERL) ../now.pl $(SRCS))
69 DATE := $(shell sh ../gen-id.sh $(VERSION) $(HEXDATE))
74 kwdhash.gen: keywords genhash.pl
75 $(PERL) genhash.pl < keywords > kwdhash.gen
80 $(OBJCOPY) -O binary $< $(@:.bin=.raw)
82 %.bin: %.raw $(PREPCORE)
85 %.o: %.asm kwdhash.gen ../version.gen
86 $(NASM) -f elf $(NASMOPT) -DDATE_STR="'$(DATE)'" \
87 -DHEXDATE="$(HEXDATE)" \
88 -l $(@:.o=.lsr) -o $@ -MP -MD .$@.d $<
90 %.elf: %.o $(LIBS) syslinux.ld
91 $(LD) $(LDFLAGS) -T syslinux.ld -M -o $@ $< \
92 --start-group $(LIBS) --end-group \
94 $(OBJDUMP) -h $@ > $(@:.elf=.sec)
95 $(PERL) lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst)
102 pxelinux.0: pxelinux.bin
105 ldlinux.bss: ldlinux.bin
106 dd if=$< of=$@ bs=512 count=1
108 ldlinux.sys: ldlinux.bin
109 dd if=$< of=$@ bs=512 skip=1
111 codepage.cp: ../codepage/$(CODEPAGE).cp
114 codepage.o: codepage.S codepage.cp
118 install-lib: installer
120 install-all: install install-lib
122 netinstall: installer
125 rm -f codepage.cp *.o *.elf *.a stupid.* patch.offset .depend .*.d
126 rm -f *.elf.tmp *.sym
127 rm -f *.lsr *.lst *.map *.sec *.raw
128 rm -f */*.o */*/*.o */*.lst */*/*.lst */.*.d */*/.*.d
129 rm -f $(OBSOLETE) $(LIB)
134 rm -f $(BTARGET) *.bin *_bin.c
136 # Include dependencies file
137 -include .*.d */.*.d */*/.*.d