memdisk/setup: int15maxres: Use 1 const; comment out printf()
[profile/ivi/syslinux.git] / memdisk / Makefile
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.
11 ##
12 ## -----------------------------------------------------------------------
13
14 topdir = ..
15 include $(topdir)/MCONFIG.embedded
16 -include $(topdir)/version.mk
17
18 INCLUDES = -I$(topdir)/com32/include
19 CFLAGS  += -D__MEMDISK__ -DDATE='"$(DATE)"'
20 LDFLAGS  = $(GCCOPT) -g
21 NASM     = nasm
22 NASMOPT  = -O9999
23 NFLAGS   = -dDATE='"$(DATE)"'
24 NINCLUDE =
25
26 SRCS     = $(wildcard *.asm *.c *.h)
27
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) ../now.pl $(SRCS))
33 endif
34 ifndef DATE
35 DATE    := $(shell sh ../gen-id.sh $(VERSION) $(HEXDATE))
36 endif
37
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            memdisk_chs_512.o memdisk_edd_512.o \
43            memdisk_iso_512.o memdisk_iso_2048.o
44
45 CSRC     = setup.c msetup.c e820func.c conio.c unzip.c dskprobe.c eltorito.c
46 SSRC     = start32.S memcpy.S memset.S memmove.S
47 NASMSRC  = memdisk_chs_512.asm memdisk_edd_512.asm \
48            memdisk_iso_512.asm memdisk_iso_2048.asm \
49            memdisk16.asm
50
51 all: memdisk # e820test
52
53 # tidy, clean removes everything except the final binary
54 tidy dist:
55         rm -f *.o *.s *.tmp *.o16 *.s16 *.bin *.lst *.elf e820test .*.d
56         rm -f *.map
57
58 clean: tidy
59
60 # spotless also removes the product binary
61 spotless: clean
62         rm -f memdisk .depend
63
64 memdisk16.o: memdisk16.asm
65
66 # Cancel rule
67 %.o: %.asm
68
69 memdisk16.o: memdisk16.asm
70         ( $(NASM) -M -DDEPEND $(NFLAGS) $(NINCLUDE) -o $@ $< ; echo '' ) > .$@.d ; true
71         $(NASM) -f elf $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $<
72
73 .PRECIOUS: %.bin
74 %.bin: %.asm
75         ( $(NASM) -M -DDEPEND $(NFLAGS) $(NINCLUDE) -o $@ $< ; echo '' ) > .$@.d ; true
76         $(NASM) -f bin $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $<
77
78 memdisk_%.o: memdisk_%.bin
79         $(LD) -r -b binary -o $@ $<
80
81 memdisk16.elf: $(OBJS16)
82         $(LD) -Ttext 0 -o $@ $^
83
84 memdisk32.elf: memdisk.ld $(OBJS32)
85         $(LD) -o $@ -T $^
86
87 %.bin: %.elf
88         $(OBJCOPY) -O binary $< $@
89
90 memdisk: memdisk16.bin memdisk32.bin postprocess.pl
91         $(PERL) postprocess.pl $@ memdisk16.bin memdisk32.bin
92
93 e820test: e820test.c e820func.c msetup.c
94         $(CC) -m32 -g $(GCCWARN) -DTEST -o $@ $^
95
96 # This file contains the version number, so add a dependency for it
97 setup.s: ../version
98
99 # Include dependencies file
100 -include .*.d