Merging upstream version 3.60~pre6.
[syslinux-debian/hramrach.git] / dos / Makefile
blob1bfc51350d3f200cfbbb33d2814022dbe1821052
1 TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
3 gcc_ok = $(shell tmpf=$(TMPFILE); if gcc $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \
4 then echo $(1); else echo $(2); fi; rm -f $$tmpf)
6 M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) \
7 $(call gcc_ok,-fno-stack-protector,) \
8 $(call gcc_ok,-fno-top-level-reorder,$(call gcc_ok,-fno-unit-at-a-time))
10 CC = gcc
11 LD = ld -m elf_i386
12 OBJCOPY = objcopy
13 OPTFLAGS = -g -Os -march=i386 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer
14 INCLUDES = -include code16.h -I. -I.. -I../libfat -I ../libinstaller
15 CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -msoft-float $(OPTFLAGS) $(INCLUDES)
16 LDFLAGS = -T com16.ld
17 AR = ar
18 RANLIB = ranlib
19 LIBGCC := $(shell $(CC) --print-libgcc)
21 SRCS = syslinux.c \
22 ../syslxmod.c ../bootsect_bin.c ../ldlinux_bin.c ../mbr_bin.c \
23 $(wildcard ../libfat/*.c)
24 OBJS = crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
25 LIBOBJS = conio.o memcpy.o memset.o skipatou.o atou.o malloc.o free.o \
26 argv.o printf.o __divdi3.o __udivmoddi4.o
28 .SUFFIXES: .c .o .i .s .S .elf .com
30 VPATH = .:..:../libfat:../libinstaller
32 TARGETS = syslinux.com
34 all: $(TARGETS)
36 tidy:
37 -rm -f *.o *.i *.s *.a .*.d *.elf
39 clean: tidy
41 spotless: clean
42 -rm -f *~ $(TARGETS)
44 installer:
46 syslinux.elf: $(OBJS) libcom.a
47 $(LD) $(LDFLAGS) -o $@ $^
49 libcom.a: $(LIBOBJS)
50 -rm -f $@
51 $(AR) cq $@ $^
52 $(RANLIB) $@
54 syslinux.com: syslinux.elf
55 $(OBJCOPY) -O binary $< $@
57 %.o: %.c
58 $(CC) -Wp,-MT,$@,-MD,.$@.d $(CFLAGS) -c -o $@ $<
59 %.i: %.c
60 $(CC) $(CFLAGS) -E -o $@ $<
61 %.s: %.c
62 $(CC) $(CFLAGS) -S -o $@ $<
63 %.o: %.S
64 $(CC) -Wp,-MT,$@,-MD,.$@.d $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
65 %.s: %.S
66 $(CC) $(CFLAGS) -E -o $@ $<
68 -include .*.d