Adding debian version 3.40~pre9-1.
[syslinux-debian/hramrach.git] / dos / Makefile
blob5fd52d1bfc6f617e4f35a8b86c40f5fc01a8c1a6
1 gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \
2 then echo $(1); else echo $(2); fi)
4 M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector,)
6 CC = gcc
7 LD = ld -m elf_i386
8 OBJCOPY = objcopy
9 OPTFLAGS = -g -Os -march=i386 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer
10 INCLUDES = -include code16.h -I. -I.. -I../libfat
11 CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -msoft-float $(OPTFLAGS) $(INCLUDES)
12 LDFLAGS = -T com16.ld
13 AR = ar
14 RANLIB = ranlib
15 LIBGCC := $(shell $(CC) --print-libgcc)
17 SRCS = syslinux.c \
18 ../syslxmod.c ../bootsect_bin.c ../ldlinux_bin.c ../mbr_bin.c \
19 $(wildcard ../libfat/*.c)
20 OBJS = crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
21 LIBOBJS = conio.o memcpy.o memset.o skipatou.o atou.o malloc.o free.o \
22 argv.o printf.o __divdi3.o __udivmoddi4.o
24 .SUFFIXES: .c .o .i .s .S .elf .com
26 VPATH = .:..:../libfat
28 TARGETS = syslinux.com
30 all: $(TARGETS)
32 tidy:
33 -rm -f *.o *.i *.s *.a .*.d *.elf
35 clean: tidy
37 spotless: clean
38 -rm -f *~ $(TARGETS)
40 installer:
42 syslinux.elf: $(OBJS) libcom.a
43 $(LD) $(LDFLAGS) -o $@ $^
45 libcom.a: $(LIBOBJS)
46 -rm -f $@
47 $(AR) cq $@ $^
48 $(RANLIB) $@
50 syslinux.com: syslinux.elf
51 $(OBJCOPY) -O binary $< $@
53 %.o: %.c
54 $(CC) -Wp,-MT,$@,-MD,.$@.d $(CFLAGS) -c -o $@ $<
55 %.i: %.c
56 $(CC) $(CFLAGS) -E -o $@ $<
57 %.s: %.c
58 $(CC) $(CFLAGS) -S -o $@ $<
59 %.o: %.S
60 $(CC) -Wp,-MT,$@,-MD,.$@.d $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
61 %.s: %.S
62 $(CC) $(CFLAGS) -E -o $@ $<
64 -include .*.d