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
,)
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
)
15 LIBGCC
:= $(shell $(CC
) --print-libgcc
)
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
33 -rm -f
*.o
*.i
*.s
*.a .
*.d
*.elf
42 syslinux.elf
: $(OBJS
) libcom.a
43 $(LD
) $(LDFLAGS
) -o
$@
$^
50 syslinux.com
: syslinux.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
$@
$<