summaryrefslogtreecommitdiff
path: root/lib/Makefile
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2021-03-09 11:42:34 -0500
committerPeter Jones <pjones@redhat.com>2021-03-10 15:54:20 -0500
commitf033a1da9f4c3acf7e3dfef906d01e348b6fcf42 (patch)
tree1c325b0dd61cb1bd78b585ca870298fb74f857d4 /lib/Makefile
parent758b795a86589994065099d0af02eb30626a3c21 (diff)
downloadefi-boot-shim-f033a1da9f4c3acf7e3dfef906d01e348b6fcf42.tar.gz
efi-boot-shim-f033a1da9f4c3acf7e3dfef906d01e348b6fcf42.zip
Restructure our includes.
This re-structures our includes so we can be sure everything is always including all the system headers in a uniform, predictable way. Temporarily it also adds a bunch of junk at all the places we use variadic functions to specifically pick either the MS (cdecl) or ELF ABIs. I'm not 100% sure that's all correct (see later patch) but it's enough to allow this to build. Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'lib/Makefile')
-rw-r--r--lib/Makefile39
1 files changed, 37 insertions, 2 deletions
diff --git a/lib/Makefile b/lib/Makefile
index d9188c74..63893c3e 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,9 +2,44 @@ TARGET = lib.a
LIBFILES = $(foreach x,$(wildcard *.c),$(patsubst %.c,%.o,$(x)))
+CRYPTDIR = $(TOPDIR)/Cryptlib
+
INCLUDES = $(EFI_INCLUDES) \
- -I$(TOPDIR)/../include \
- -I$(TOPDIR)/CryptLib/Include/openssl/
+ -I$(TOPDIR)/include \
+ -I$(CRYPTDIR)/Include/openssl/ \
+ -I$(CRYPTDIR)/Include/ \
+ -I$(CRYPTDIR) \
+ -I$(TOPDIR) \
+ -isystem $(TOPDIR)/include/system \
+ -isystem $(shell $(CC) -print-file-name=include)
+
+CLANG_BUGS = $(if $(findstring gcc,$(CC)),-maccumulate-outgoing-args,)
+
+ifeq ($(ARCH),x86_64)
+FEATUREFLAGS += -m64 -mno-mmx -mno-sse -mno-red-zone -nostdinc $(CLANG_BUGS)
+DEFINES += -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI \
+ -UNO_BUILTIN_VA_FUNCS -DMDE_CPU_X64
+endif
+ifeq ($(ARCH),ia32)
+FEATUREFLAGS += -m32 -mno-mmx -mno-sse -mno-red-zone -nostdinc $(CLANG_BUGS)
+DEFINES += -DMDE_CPU_IA32
+endif
+ifeq ($(ARCH),aarch64)
+DEFINES += -DMDE_CPU_AARCH64
+endif
+ifeq ($(ARCH),arm)
+DEFINES += -DMDE_CPU_ARM
+endif
+
+LDFLAGS = -nostdlib -znocombreloc
+
+
+CFLAGS = $(FEATUREFLAGS) \
+ $(OPTIMIZATIONS) \
+ $(WARNFLAGS) \
+ $(WERRFLAGS) \
+ $(INCLUDES) \
+ $(DEFINES)
lib.a: $(LIBFILES)
$(AR) rcs lib.a $(LIBFILES)