forked from rhboot/pesign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Make.defaults
82 lines (72 loc) · 2.53 KB
/
Make.defaults
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
NAME = pesign
COMMIT_ID ?= $(shell git log -1 --pretty=%H 2>/dev/null || echo master)
prefix ?= /usr/
prefix := $(abspath $(prefix))/
libdir ?= $(prefix)lib64/
libdatadir ?= $(prefix)lib/
libexecdir ?= $(prefix)libexec/
datadir ?= $(prefix)share/
mandir ?= $(datadir)man/
includedir ?= $(prefix)include/
bindir ?= $(prefix)bin/
pcdir ?= $(libdir)pkgconfig/
docdir ?= $(prefix)share/doc/
DESTDIR ?=
INSTALLROOT = $(DESTDIR)
INSTALL ?= install
CROSS_COMPILE ?=
PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
CC := $(if $(filter default,$(origin CC)),$(CROSS_COMPILE)gcc,$(CC))
CCLD := $(if $(filter undefined,$(origin CCLD)),$(CC),$(CCLD))
CFLAGS ?= -O0 -g3
AS ?= $(CROSS_COMPILE)as
AR ?= $(CROSS_COMPILE)$(if $(filter $(CC),clang),llvm-ar,$(notdir $(CC))-ar)
RANLIB ?= $(CROSS_COMPILE)$(if $(filter $(CC),clang),llvm-ranlib,$(notdir $(CC))-ranlib)
OBJCOPY ?= $(CROSS_COMPILE)objcopy
LD ?= $(CROSS_COMPILE)ld
INSTALL ?= $(CROSS_COMPILE)install
PKGS = efivar nspr nss nss-util uuid
HOSTARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
ARCH := $(shell uname -m | sed s,i[3456789]86,ia32,)
SOFLAGS ?= -shared
clang_cflags =
gcc_cflags = -Wmaybe-uninitialized -grecord-gcc-switches -flto
cflags = $(CFLAGS) $(ARCH3264) \
-Wall -Wextra -Wsign-compare -Wno-unused-result \
-Wno-unused-function -Wno-missing-field-initializers \
-Werror -Wno-error=cpp \
-std=gnu11 -fshort-wchar -fPIC -fno-strict-aliasing \
-D_GNU_SOURCE -DCONFIG_$(ARCH) -I${TOPDIR}/include \
$(if $(filter $(CC),clang),$(clang_cflags), ) \
$(if $(filter $(CC),gcc),$(gcc_cflags), ) \
$(call pkg-config-cflags)
clang_ccldflags =
gcc_ccldflags = -fno-merge-constants \
-fvar-tracking -fvar-tracking-assignments -fkeep-inline-functions \
-Wl,--fatal-warnings,--no-allow-shlib-undefined,--default-symver \
-Wl,-O2 -Wl,--no-undefined-version -Wl,-z,relro,-z,now \
-Wl,--no-add-needed,--no-copy-dt-needed-entries,--as-needed
ccldflags = $(cflags) $(CCLDFLAGS) $(LDFLAGS) \
$(if $(filter $(CCLD),clang),$(clang_ccldflags),) \
$(if $(filter $(CCLD),gcc),$(gcc_ccldflags),) \
$(call pkg-config-ccldflags)
efi_cflags = $(cflags)
ASFLAGS ?= $(ARCH3264)
CPPFLAGS ?=
RANLIBFLAGS ?= $(if $(filter $(CC),gcc),-D)
ARFLAGS ?= $(if $(filter $(CC),gcc),-Dcvqs)$(if $(filter $(CC),clang),-cqvs)
LDLIBS = $(foreach lib,$(LIBS),-l$(lib)) $(call pkg-config-ldlibs)
ifeq ($(ARCH),ia64)
efi_cflags += -mfixed-range=f32-f127
endif
ifeq ($(ARCH), ia32)
ifeq ($(HOSTARCH), x86_64)
ARCH3264 := -m32
endif
endif
ifeq ($(ARCH), x86_64)
efi_cflags += -mno-red-zone
ifeq ($(HOSTARCH), ia32)
ARCH3264 := -m64
endif
endif