1 ## -----------------------------------------------------------------------
3 ## Copyright 2001-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 MAKEDIR
= $(topdir
)/mk
16 include $(MAKEDIR
)/embedded.mk
17 -include $(topdir
)/version.mk
19 INCLUDES
= -I
$(topdir
)/com32
/include
20 CFLAGS
+= -D__MEMDISK__
-DDATE
='"$(DATE)"'
21 LDFLAGS
= $(GCCOPT
) -g
24 NFLAGS
= -dDATE
='"$(DATE)"'
27 SRCS
= $(wildcard *.asm
*.c
*.h
)
29 # The DATE is set on the make command line when building binaries for
30 # official release. Otherwise, substitute a hex string that is pretty much
31 # guaranteed to be unique to be unique from build to build.
33 HEXDATE
:= $(shell $(PERL
) ..
/now.pl
$(SRCS
))
36 DATE
:= $(shell sh ..
/gen-id.sh
$(VERSION
) $(HEXDATE
))
39 # Important: init.o16 must be first!!
40 OBJS16
= init.o16 init32.o
41 OBJS32
= start32.o setup.o msetup.o e820func.o conio.o memcpy.o memset.o \
42 memmove.o unzip.o dskprobe.o eltorito.o \
43 ctypes.o strntoumax.o strtoull.o suffix_number.o \
44 memdisk_chs_512.o memdisk_edd_512.o \
45 memdisk_iso_512.o memdisk_iso_2048.o
47 CSRC
= setup.c msetup.c e820func.c conio.c unzip.c dskprobe.c eltorito.c \
48 ctypes.c strntoumax.c strtoull.c suffix_number.c
49 SSRC
= start32.S memcpy.S memset.S memmove.S
50 NASMSRC
= memdisk_chs_512.asm memdisk_edd_512.asm \
51 memdisk_iso_512.asm memdisk_iso_2048.asm \
54 all: memdisk
# e820test
56 # tidy, clean removes everything except the final binary
58 rm -f
*.o
*.s
*.tmp
*.o16
*.s16
*.bin
*.lst
*.elf e820test .
*.d
63 # spotless also removes the product binary
67 memdisk16.o
: memdisk16.asm
72 memdisk16.o
: memdisk16.asm
73 ( $(NASM
) -M
-DDEPEND
$(NFLAGS
) $(NINCLUDE
) -o
$@
$< ; echo
'' ) > .
$@.d
; true
74 $(NASM
) -f elf
$(NASMOPT
) $(NFLAGS
) $(NINCLUDE
) -o
$@
-l
$*.lst
$<
78 ( $(NASM
) -M
-DDEPEND
$(NFLAGS
) $(NINCLUDE
) -o
$@
$< ; echo
'' ) > .
$@.d
; true
79 $(NASM
) -f bin
$(NASMOPT
) $(NFLAGS
) $(NINCLUDE
) -o
$@
-l
$*.lst
$<
81 memdisk_
%.o
: memdisk_
%.bin
82 $(LD
) -r
-b binary
-o
$@
$<
84 memdisk16.elf
: $(OBJS16
)
85 $(LD
) -Ttext
0 -o
$@
$^
87 memdisk32.elf
: memdisk.
ld $(OBJS32
)
91 $(OBJCOPY
) -O binary
$< $@
93 memdisk
: memdisk16.bin memdisk32.bin postprocess.pl
94 $(PERL
) postprocess.pl
$@ memdisk16.bin memdisk32.bin
96 e820test
: e820test.c e820func.c msetup.c
97 $(CC
) -m32
-g
$(GCCWARN
) -DTEST
-o
$@
$^
99 # This file contains the version number, so add a dependency for it
102 # Include dependencies file