Adding debian version 3.60-1.
[syslinux-debian/hramrach.git] / memdump / Makefile
blob40497028cae1d4af98157141eefa7d925cad5e15
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,) $(call gcc_ok,-fno-stack-protector,)
8 CC = gcc
9 LD = ld -m elf_i386
10 OBJCOPY = objcopy
11 OPTFLAGS = -g -Os -march=i386 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer
12 INCLUDES = -include code16.h -I.
13 CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -msoft-float $(OPTFLAGS) $(INCLUDES)
14 LDFLAGS = -T com16.ld
15 AR = ar
16 RANLIB = ranlib
17 LIBGCC := $(shell $(CC) --print-libgcc)
19 SRCS = main.c serial.c ymsend.c
20 OBJS = crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
21 LIBOBJS = conio.o memcpy.o memset.o skipatou.o strtoul.o \
22 argv.o printf.o __divdi3.o __udivmoddi4.o
24 .SUFFIXES: .c .o .i .s .S .elf .com
26 VPATH = .:..:../libfat
28 TARGETS = memdump.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 memdump.elf: $(OBJS) libcom.a
43 $(LD) $(LDFLAGS) -o $@ $^
45 libcom.a: $(LIBOBJS)
46 -rm -f $@
47 $(AR) cq $@ $^
48 $(RANLIB) $@
50 memdump.com: memdump.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