1 ## -----------------------------------------------------------------------
3 ## Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ## Boston MA 02111-1307, USA; either version 2 of the License, or
9 ## (at your option) any later version; incorporated herein by reference.
11 ## -----------------------------------------------------------------------
14 include $(topdir
)/MCONFIG.embedded
15 -include $(topdir
)/version.mk
17 CFLAGS
= $(GCCOPT
) -g
-W
-Wall
-Wno-sign-compare
-DDATE
='"$(DATE)"'
18 SFLAGS
= $(GCCOPT
) -D__ASSEMBLY__
19 LDFLAGS
= $(GCCOPT
) -g
20 INCLUDE
= -I
$(topdir
)/com32
/include
23 NFLAGS
= -dDATE
='"$(DATE)"' -dWITH_EDD
26 SRCS
= $(wildcard *.asm
*.c
*.h
)
28 # The DATE is set on the make command line when building binaries for
29 # official release. Otherwise, substitute a hex string that is pretty much
30 # guaranteed to be unique to be unique from build to build.
32 HEXDATE
:= $(shell $(PERL
) ..
/now.pl
$(SRCS
))
35 DATE
:= $(shell sh ..
/gen-id.sh
$(VERSION
) $(HEXDATE
))
38 # Important: init.o16 must be first!!
39 OBJS16
= init.o16 init32.o
40 OBJS32
= start32.o setup.o msetup.o e820func.o conio.o memcpy.o memset.o \
43 CSRC
= setup.c msetup.c e820func.c conio.c unzip.c
44 SSRC
= start32.S memcpy.S memset.S
45 NASMSRC
= memdisk.asm memdisk16.asm
47 all: memdisk
# e820test
49 # tidy, clean removes everything except the final binary
51 rm -f
*.o
*.s
*.tmp
*.o16
*.s16
*.bin
*.lst
*.elf e820test
55 # spotless also removes the product binary
60 $(NASM
) $(NASMOPT
) $(NFLAGS
) $(NINCLUDE
) -f elf
-l
$*.lst
-o
$@
$<
63 $(CC
) $(SFLAGS
) -c
-o
$@
$<
66 $(CC
) $(INCLUDE
) $(SFLAGS
) -c
-o
$@
$<
69 $(CC
) $(SFLAGS
) -x assembler
-c
-o
$@
$<
72 $(CC
) $(INCLUDE
) $(CFLAGS
) -c
-o
$@
$<
75 echo
'.code16gcc' | cat
- $< > $@
78 $(CC
) $(INCLUDE
) $(SFLAGS
) -E
-o
$@
$<
81 $(CC
) $(INCLUDE
) $(SFLAGS
) -x assembler-with-cpp
-E
-o
$@
$<
84 $(CC
) $(INCLUDE
) $(CFLAGS
) -S
-o
$@
$<
87 $(CC
) $(INCLUDE
) $(CFLAGS
) -E
-o
$@
$<
93 $(NASM
) -f bin
$(NASMOPT
) $(NFLAGS
) $(NINCLUDE
) -o
$@
-l
$*.lst
$<
95 memdisk16.elf
: $(OBJS16
)
96 $(LD
) -Ttext
0 -o
$@
$^
98 memdisk32.elf
: $(OBJS32
)
99 $(LD
) -Ttext
0x100000 -o
$@
$^
102 $(OBJCOPY
) -O binary
$< $@
104 memdisk
: memdisk16.bin memdisk32.bin postprocess.pl
105 $(PERL
) postprocess.pl
$@ memdisk16.bin memdisk32.bin
107 e820test
: e820func.o msetup.o e820test.o memdisk.o
108 $(CC
) $(LDFLAGS
) -o
$@
$^
110 memdisk.o
: memdisk.bin
111 $(LD
) -r
-b binary
-o
$@
$<
115 for csrc in
*.c
; do
$(CC
) $(INCLUDE
) $(CFLAGS
) -MM
$$csrc >> .depend
; done
116 for ssrc in
*.S
; do
$(CC
) $(INCLUDE
) $(SFLAGS
) -MM
$$ssrc >> .depend
; done
117 for nsrc in
$(NASMSRC
) ; do
$(NASM
) -DDEPEND
$(NINCLUDE
) -o
`echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M
$$nsrc >> .depend
; done
123 # This file contains the version number, so add a dependency for it
126 # Include dependencies file