3 include $(MAKEDIR
)/syslinux.mk
5 # Support IA32 and x86_64 platforms with one build
6 # Set up architecture specifics; for cross compilation, set ARCH as apt
7 GCCOPT
:= $(call gcc_ok
,-std
=gnu99
,)
9 GCCOPT
+= $(call gcc_ok
,-m32
,)
10 GCCOPT
+= $(call gcc_ok
,-mpreferred-stack-boundary
=2,)
14 GCCOPT
+= $(call gcc_ok
,-m64
,)
15 #let preferred-stack-boundary be default(=4)
18 GCCOPT
+= $(call gcc_ok
,-fno-stack-protector
,)
19 GCCOPT
+= $(call gcc_ok
,-fwrapv
,)
20 GCCOPT
+= $(call gcc_ok
,-freg-struct-return
,)
21 # Note -fPIE does not work with ld on x86_64, try -fPIC instead
22 # Does BIOS build require -fPIE?
23 GCCOPT
+= $(call gcc_ok
,-fPIC
)
24 GCCOPT
+= $(call gcc_ok
,-fno-exceptions
,)
25 GCCOPT
+= $(call gcc_ok
,-fno-asynchronous-unwind-tables
,)
26 GCCOPT
+= $(call gcc_ok
,-fno-strict-aliasing
,)
27 GCCOPT
+= $(call gcc_ok
,-falign-functions
=0,-malign-functions
=0)
28 GCCOPT
+= $(call gcc_ok
,-falign-jumps
=0,-malign-jumps
=0)
29 GCCOPT
+= $(call gcc_ok
,-falign-labels
=0,-malign-labels
=0)
30 GCCOPT
+= $(call gcc_ok
,-falign-loops
=0,-malign-loops
=0)
33 STRIP
= strip --strip-all
-R .comment
-R .note
35 # zlib and libpng configuration flags
36 LIBFLAGS
= -DDYNAMIC_CRC_TABLE
-DPNG_NO_CONSOLE_IO \
37 -DPNG_NO_WRITE_SUPPORTED \
38 -DPNG_NO_MNG_FEATURES \
39 -DPNG_NO_READ_tIME
-DPNG_NO_WRITE_tIME
41 # We need some features in libpng which apparently aren't available in the
42 # fixed-point versions. It's OK, because we have to have a non-graphical
43 # fallback anyway, just use that on old machines...
44 # LIBFLAGS += -DPNG_NO_FLOATING_POINT_SUPPORTED
46 REQFLAGS
= $(GCCOPT
) -g
-D__COM32__ \
47 -nostdinc
-iwithprefix
include -I.
-I
$(SRC
)/sys \
48 -I
$(SRC
)/..
/include -I
$(com32
)/include/sys \
49 -I
$(topdir
)/core
/include -I
$(com32
)/lib
/ \
50 -I
$(com32
)/lib
/sys
/module
-I
$(OBJ
)/..
/..
51 OPTFLAGS
= -Os
-march
=$(MARCH
) -falign-functions
=0 -falign-jumps
=0 \
52 -falign-labels
=0 -ffast-math
-fomit-frame-pointer
53 WARNFLAGS
= $(GCCWARN
) -Wpointer-arith
-Wwrite-strings
-Wstrict-prototypes
-Winline
55 CFLAGS
= $(OPTFLAGS
) $(REQFLAGS
) $(WARNFLAGS
) $(LIBFLAGS
)
58 CFLAGS
+= -mregparm
=3 -DREGPARM
=3
63 atoi.o atol.o atoll.o calloc.o creat.o \
64 fgets.o fprintf.o fputc.o \
66 getopt.o getopt_long.o \
67 lrand48.o stack.o memccpy.o memchr.o \
68 mempcpy.o memmem.o memmove.o memswap.o \
69 perror.o qsort.o seed48.o \
71 strerror.o errlist.o \
75 strntoimax.o strsep.o strspn.o strstr.o \
76 strtoimax.o strtok.o strtol.o strtoll.o strtoull.o \
77 strtoumax.o vprintf.o vsprintf.o \
78 asprintf.o vasprintf.o \
83 inet.o dhcppack.o dhcpunpack.o \
89 getcwd.o fdopendir.o \
92 sys
/colortable.o sys
/screensize.o \
94 sys
/stdcon_read.o sys
/stdcon_write.o sys
/rawcon_read.o \
96 sys
/null_read.o sys
/null_write.o sys
/serial_write.o \
102 sys
/ansicon_write.o sys
/ansiserial_write.o \
104 pci
/cfgtype.o pci
/scan.o pci
/bios.o \
105 pci
/readb.o pci
/readw.o pci
/readl.o \
106 pci
/writeb.o pci
/writew.o pci
/writel.o \
108 sys
/x86_init_fpu.o math
/pow.o math
/strtod.o \
111 syslinux
/setup_data.o
113 ## CORE OBJECTS, INCLUDED IN THE ROOT COM32 MODULE
115 sys
/intcall.o sys
/farcall.o sys
/cfarcall.o sys
/zeroregs.o \
116 sys
/argv.o sys
/sleep.o \
117 sys
/fileinfo.o sys
/opendev.o sys
/read.o sys
/write.o sys
/ftell.o \
118 sys
/close.o sys
/open.o sys
/fileread.o sys
/fileclose.o \
120 sys
/isatty.o sys
/fstat.o \
122 dprintf.o vdprintf.o \
129 libgcc
/__ashldi3.o libgcc
/__udivdi3.o \
130 libgcc
/__negdi2.o libgcc
/__ashrdi3.o libgcc
/__lshrdi3.o \
131 libgcc
/__muldi3.o libgcc
/__udivmoddi4.o libgcc
/__umoddi3.o \
132 libgcc
/__divdi3.o libgcc
/__moddi3.o
136 sys
/openconsole.o sys
/line_input.o \
137 sys
/colortable.o sys
/screensize.o \
139 sys
/stdcon_read.o sys
/rawcon_read.o \
141 sys
/null_write.o sys
/serial_write.o \
143 sys
/xserial_write.o \
147 sys
/ansicon_write.o sys
/ansiserial_write.o \
152 syslinux
/addlist.o syslinux
/freelist.o syslinux
/memmap.o \
153 syslinux
/movebits.o syslinux
/shuffle.o syslinux
/shuffle_pm.o \
154 syslinux
/shuffle_rm.o syslinux
/zonelist.o \
155 syslinux
/dump_mmap.o syslinux
/dump_movelist.o \
157 syslinux
/run_default.o syslinux
/run_command.o \
158 syslinux
/cleanup.o syslinux
/localboot.o syslinux
/runimage.o \
160 syslinux
/loadfile.o syslinux
/floadfile.o syslinux
/zloadfile.o \
162 syslinux
/load_linux.o syslinux
/initramfs.o \
163 syslinux
/initramfs_file.o syslinux
/initramfs_loadfile.o \
164 syslinux
/initramfs_archive.o
167 sys
/module
/common.o sys
/module
/$(ARCH
)/elf_module.o \
168 sys
/module
/elfutils.o \
169 sys
/module
/exec.o sys
/module
/elf_module.o
171 # ZIP library object files
173 zlib
/adler32.o zlib
/compress.o zlib
/crc32.o \
174 zlib
/uncompr.o zlib
/deflate.o zlib
/trees.o zlib
/zutil.o \
175 zlib
/inflate.o zlib
/infback.o zlib
/inftrees.o zlib
/inffast.o \
176 sys
/zfile.o sys
/zfopen.o
179 $(addprefix $(OBJ
)/,syslinux
/ipappend.o \
189 memcpy.o memset.o memcmp.o printf.o strncmp.o vfprintf.o \
190 strlen.o vsnprintf.o snprintf.o stpcpy.o strcmp.o strdup.o \
191 strcpy.o strncpy.o setjmp.o fopen.o fread.o fread2.o puts.o \
192 strtoul.o strntoumax.o strcasecmp.o \
193 sprintf.o strlcat.o strchr.o strlcpy.o strncasecmp.o ctypes.o \
194 fputs.o fwrite2.o fwrite.o fgetc.o fclose.o lmalloc.o \
195 sys
/err_read.o sys
/err_write.o sys
/null_read.o \
197 syslinux
/memscan.o strrchr.o strcat.o \
198 libgcc
/__ashldi3.o libgcc
/__udivdi3.o \
199 libgcc
/__negdi2.o libgcc
/__ashrdi3.o libgcc
/__lshrdi3.o \
200 libgcc
/__muldi3.o libgcc
/__udivmoddi4.o libgcc
/__umoddi3.o \
201 libgcc
/__divdi3.o libgcc
/__moddi3.o \
206 LDFLAGS
= -m elf_
$(ARCH
) --hash-style
=gnu
-T
$(com32
)/lib
/$(ARCH
)/elf.
ld
208 .SUFFIXES
: .c .o .a .so .lo .i .S .s .ls .ss .lss
210 % : %.c
# Cancel default rule
215 $(CC
) $(MAKEDEPS
) $(CFLAGS
) -c
-o
$@
$<
218 $(CC
) $(MAKEDEPS
) $(CFLAGS
) -E
-o
$@
$<
221 $(CC
) $(MAKEDEPS
) $(CFLAGS
) -S
-o
$@
$<
224 $(CC
) $(MAKEDEPS
) $(CFLAGS
) -D__ASSEMBLY__
-c
-o
$@
$<
227 $(CC
) $(MAKEDEPS
) $(CFLAGS
) -D__ASSEMBLY__
-E
-o
$@
$<
230 $(CC
) $(MAKEDEPS
) $(CFLAGS
) $(SOFLAGS
) -D__ASSEMBLY__
-c
-o
$@
$<
233 $(CC
) $(MAKEDEPS
) $(CFLAGS
) $(SOFLAGS
) -D__ASSEMBLY__
-E
-o
$@
$<
235 %(OBJ
)/%.o
: $(SRC
)/%.s
236 $(CC
) $(MAKEDEPS
) $(CFLAGS
) -x assembler
-c
-o
$@
$<
239 $(CC
) $(MAKEDEPS
) $(CFLAGS
) $(SOFLAGS
) -x assembler
-c
-o
$@
$<
242 $(CC
) $(MAKEDEPS
) $(CFLAGS
) $(SOFLAGS
) -c
-o
$@
$<
245 $(CC
) $(MAKEDEPS
) $(CFLAGS
) $(SOFLAGS
) -S
-o
$@
$<
248 $(OBJCOPY
) --strip-debug
--strip-unneeded
$< $@