Merge remote branch 'erwan/master_new'
[profile/ivi/syslinux.git] / dos / Makefile
1 ## -----------------------------------------------------------------------
2 ##
3 ##   Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
4 ##
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.
10 ##
11 ## -----------------------------------------------------------------------
12
13 ##
14 ## MS-DOS FAT installer
15 ##
16
17 topdir = ..
18 include $(topdir)/MCONFIG.embedded
19
20 CFLAGS  += -D__MSDOS__
21 # CFLAGS  += -DDEBUG
22
23 LDFLAGS  = -T dosexe.ld
24 OPTFLAGS = -g
25 INCLUDES = -include code16.h -nostdinc -iwithprefix include \
26            -I. -I.. -I../libfat -I ../libinstaller
27
28 SRCS     = syslinux.c \
29            ../libinstaller/fat.c \
30            ../libinstaller/syslxmod.c \
31            ../libinstaller/setadv.c \
32            ../libinstaller/bootsect_bin.c \
33            ../libinstaller/ldlinux_bin.c \
34            ../libinstaller/mbr_bin.c \
35            $(wildcard ../libfat/*.c)
36 OBJS     = header.o crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
37 LIBOBJS  = int2526.o conio.o memcpy.o memset.o memmove.o skipatou.o atou.o \
38            malloc.o free.o getsetsl.o \
39            argv.o printf.o __divdi3.o __udivmoddi4.o
40
41 VPATH = .:../libfat:../libinstaller
42
43 TARGETS = syslinux.com
44
45 all: $(TARGETS)
46
47 tidy dist:
48         -rm -f *.o *.i *.s *.a .*.d *.tmp *.elf *.lst
49
50 clean: tidy
51
52 spotless: clean
53         -rm -f *~ $(TARGETS)
54
55 installer:
56
57 syslinux.elf: $(OBJS) dosexe.ld libcom.a
58         $(LD) $(LDFLAGS) -o $@ $(OBJS) libcom.a
59
60 libcom.a: $(LIBOBJS)
61         -rm -f $@
62         $(AR) cq $@ $^
63         $(RANLIB) $@
64
65 syslinux.com: syslinux.elf
66         $(OBJCOPY) -O binary $< $@
67         $(UPX) --lzma --ultra-brute $@ || \
68                 $(UPX) --ultra-brute $@ || \
69                 true
70
71 %.com: %.asm
72         $(NASM) $(NASMOPT) -f bin -o $@ -MP -MD .$@.d -l $*.lst $<
73
74 -include .*.d *.tmp