Adding upstream version 6.02~pre8+dfsg.
[syslinux-debian/hramrach.git] / memdisk / Makefile
blobe6557d87ac8c28c3b126cb382ad558c4cd45ec48
1 ## -----------------------------------------------------------------------
2 ##
3 ## Copyright 2001-2009 H. Peter Anvin - All Rights Reserved
4 ## Copyright 2009 Intel Corporation; author: H. Peter Anvin
5 ##
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 ## -----------------------------------------------------------------------
14 include $(MAKEDIR)/embedded.mk
15 -include $(topdir)/version.mk
17 INCLUDES = -I$(topdir)/com32/include -I$(objdir)
18 CFLAGS += -D__MEMDISK__ -DDATE='"$(DATE)"' -mregparm=3 -DREGPARM=3
19 LDFLAGS = $(GCCOPT) -g
20 NASM = nasm
21 NASMOPT = -Ox
22 NFLAGS = -dDATE='"$(DATE)"'
23 NINCLUDE = -I$(SRC)/
25 VPATH = $(SRC)
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.
31 ifndef HEXDATE
32 HEXDATE := $(shell $(PERL) $(SRC)/../now.pl $(SRCS))
33 endif
34 ifndef DATE
35 DATE := $(shell sh $(SRC)/../gen-id.sh $(VERSION) $(HEXDATE))
36 endif
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 \
41 memmove.o unzip.o dskprobe.o eltorito.o \
42 ctypes.o strntoumax.o strtoull.o suffix_number.o \
43 memdisk_chs_512.o memdisk_edd_512.o \
44 memdisk_iso_512.o memdisk_iso_2048.o
46 CSRC = setup.c msetup.c e820func.c conio.c unzip.c dskprobe.c eltorito.c \
47 ctypes.c strntoumax.c strtoull.c suffix_number.c
48 SSRC = start32.S memcpy.S memset.S memmove.S
49 NASMSRC = memdisk_chs_512.asm memdisk_edd_512.asm \
50 memdisk_iso_512.asm memdisk_iso_2048.asm \
51 memdisk16.asm
53 all: memdisk # e820test
55 # tidy, clean removes everything except the final binary
56 tidy dist:
57 rm -f *.o *.s *.tmp *.o16 *.s16 *.bin *.lst *.elf e820test .*.d
58 rm -f *.map
60 clean: tidy
62 # spotless also removes the product binary
63 spotless: clean
64 rm -f memdisk .depend
66 memdisk16.o: memdisk16.asm
68 # Cancel rule
69 %.o: %.asm
71 memdisk16.o: memdisk16.asm
72 ( $(NASM) -M -DDEPEND $(NFLAGS) $(NINCLUDE) -o $@ $< ; echo '' ) > .$@.d ; true
73 $(NASM) -f elf $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $<
75 .PRECIOUS: %.bin
76 %.bin: %.asm
77 ( $(NASM) -M -DDEPEND $(NFLAGS) $(NINCLUDE) -o $@ $< ; echo '' ) > .$@.d ; true
78 $(NASM) -f bin $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $<
80 memdisk_%.o: memdisk_%.bin
81 $(LD) -r -b binary -o $@ $<
83 memdisk16.elf: $(OBJS16)
84 $(LD) -Ttext 0 -o $@ $^
86 #memdisk32.elf: memdisk.ld $(OBJS32)
87 memdisk32.elf: $(ARCH)/memdisk.ld $(OBJS32)
88 $(LD) -o $@ -T $^
90 %.bin: %.elf
91 $(OBJCOPY) -O binary $< $@
93 memdisk: memdisk16.bin memdisk32.bin postprocess.pl
94 $(PERL) $(SRC)/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
100 setup.s: ../version
102 # Include dependencies file
103 -include .*.d