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
))
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
)
19 LIBGCC
:= $(shell $(CC
) --print-libgcc
)
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
37 -rm -f
*.o
*.i
*.s
*.a .
*.d
*.elf
46 syslinux.elf
: $(OBJS
) libcom.a
47 $(LD
) $(LDFLAGS
) -o
$@
$^
54 syslinux.com
: syslinux.elf
55 $(OBJCOPY
) -O binary
$< $@
58 $(CC
) -Wp
,-MT
,$@
,-MD
,.
$@.d
$(CFLAGS
) -c
-o
$@
$<
60 $(CC
) $(CFLAGS
) -E
-o
$@
$<
62 $(CC
) $(CFLAGS
) -S
-o
$@
$<
64 $(CC
) -Wp
,-MT
,$@
,-MD
,.
$@.d
$(CFLAGS
) -D__ASSEMBLY__
-c
-o
$@
$<
66 $(CC
) $(CFLAGS
) -E
-o
$@
$<