1 ## -*- makefile -*- -------------------------------------------------------
3 ## Copyright 2008 H. Peter Anvin - All Rights Reserved
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8 ## Boston MA 02110-1301, USA; either version 2 of the License, or
9 ## (at your option) any later version; incorporated herein by reference.
11 ## -----------------------------------------------------------------------
14 ## ELF common configurables
17 include $(MAKEDIR
)/syslinux.mk
19 GCCOPT
:= $(call gcc_ok
,-std
=gnu99
,)
20 GCCOPT
+= $(call gcc_ok
,-m32
,)
21 GCCOPT
+= $(call gcc_ok
,-fno-stack-protector
,)
22 GCCOPT
+= $(call gcc_ok
,-fwrapv
,)
23 GCCOPT
+= $(call gcc_ok
,-freg-struct-return
,)
24 GCCOPT
+= -march
=i386
-Os
-fomit-frame-pointer
-mregparm
=3 -DREGPARM
=3
25 GCCOPT
+= $(call gcc_ok
,-fno-exceptions
,)
26 GCCOPT
+= $(call gcc_ok
,-fno-asynchronous-unwind-tables
,)
27 GCCOPT
+= $(call gcc_ok
,-fPIE
,-fPIC
)
28 GCCOPT
+= $(call gcc_ok
,-falign-functions
=0,-malign-functions
=0)
29 GCCOPT
+= $(call gcc_ok
,-falign-jumps
=0,-malign-jumps
=0)
30 GCCOPT
+= $(call gcc_ok
,-falign-labels
=0,-malign-labels
=0)
31 GCCOPT
+= $(call gcc_ok
,-falign-loops
=0,-malign-loops
=0)
32 GCCOPT
+= $(call gcc_ok
,-mpreferred-stack-boundary
=2,)
34 com32
= $(topdir
)/com32
38 GPLLIB
= $(com32
)/gpllib
/libgpl.c32
39 GPLINCLUDE
= -I
$(com32
)/gplinclude
45 CFLAGS
= $(GCCOPT
) -W
-Wall
-march
=i386 \
46 -fomit-frame-pointer
-D__COM32__
-DDYNAMIC_MODULE \
47 -nostdinc
-iwithprefix
include \
48 -I
$(com32
)/libutil
/include -I
$(com32
)/include $(GPLINCLUDE
) \
50 SFLAGS
= $(GCCOPT
) -D__COM32__
-march
=i386
51 LDFLAGS
= -m elf_i386
-shared
--hash-style
=gnu
-T
$(com32
)/lib
/elf32.
ld --as-needed
53 LNXCFLAGS
= -I
$(com32
)/libutil
/include -W
-Wall
-O
-g
-D_GNU_SOURCE
57 C_LIBS
= $(com32
)/libutil
/libutil.c32
$(GPLLIB
) \
58 $(com32
)/lib
/libcom32.c32
59 C_LNXLIBS
= $(com32
)/libutil
/libutil_lnx.a \
60 $(com32
)/elflink
/ldlinux
/ldlinux_lnx.a
66 $(CC
) $(SFLAGS
) -c
-o
$@
$<
70 $(CC
) $(CFLAGS
) -c
-o
$@
$<
74 $(CC
) $(LNXSFLAGS
) -c
-o
$@
$<
78 $(CC
) $(LNXCFLAGS
) -c
-o
$@
$<
81 %.lnx
: %.lo
$(LNXLIBS
) $(C_LNXLIBS
)
82 $(CC
) $(LNXCFLAGS
) -o
$@
$^
86 $(LD
) $(LDFLAGS
) -o
$@
$^
89 $(OBJCOPY
) --strip-debug
--strip-unneeded
$< $@