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
,)
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
)
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
33 -rm -f
*.o
*.i
*.s
*.a .
*.d
*.elf
42 memdump.elf
: $(OBJS
) libcom.a
43 $(LD
) $(LDFLAGS
) -o
$@
$^
50 memdump.com
: memdump.elf
51 $(OBJCOPY
) -O binary
$< $@
54 $(CC
) -Wp
,-MT
,$@
,-MD
,.
$@.d
$(CFLAGS
) -c
-o
$@
$<
56 $(CC
) $(CFLAGS
) -E
-o
$@
$<
58 $(CC
) $(CFLAGS
) -S
-o
$@
$<
60 $(CC
) -Wp
,-MT
,$@
,-MD
,.
$@.d
$(CFLAGS
) -D__ASSEMBLY__
-c
-o
$@
$<
62 $(CC
) $(CFLAGS
) -E
-o
$@
$<