-
Notifications
You must be signed in to change notification settings - Fork 100
/
Make.defaults
64 lines (58 loc) · 2.19 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
NAME = efibootmgr
prefix ?= /usr
libdir ?= $(prefix)/lib64
datadir ?= $(prefix)/share
mandir ?= $(datadir)/man
includedir ?= $(prefix)/include
bindir ?= $(prefix)/bin
sbindir ?= $(prefix)/sbin
localedir ?= $(datadir)/locale/
PCDIR ?= $(libdir)/pkgconfig
DESTDIR ?=
ifneq ($(origin EXTRALIBDIRS),undefined)
override EXTRALIBDIR := $(foreach dir,$(EXTRALIBDIRS),-L$(dir))
endif
ifneq ($(origin EXTRAINCDIRS),undefined)
override EXTRAINCDIR := $(foreach dir,$(EXTRAINCDIRS),-I$(dir))
endif
EFIDIR ?= $(shell x=$$(which --skip-alias --skip-functions git 2>/dev/null) ; [ -n "$$x" ] && git config --get efibootmgr.efidir)
ifeq ($(EFIDIR),)
EFIDIR_ERROR = $(error EFIDIR or .gitconfig efibootmgr.efidir must be set to this distro's reserved EFI System Partition subdirectory name)
endif
EFI_LOADER := grub.efi
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 ?= -O2 -g -flto
AR := $(CROSS_COMPILE)gcc-ar
NM := $(CROSS_COMPILE)gcc-nm
RANLIB := $(CROSS_COMPILE)gcc-ranlib
PKGS =
SUBDIR_CFLAGS ?=
clang_cflags =
gcc_cflags =
cflags = $(EXTRALIBDIR) $(EXTRAINCDIR) $(CFLAGS) $(SUBDIR_CFLAGS) \
-Werror -Wall -Wextra -Wsign-compare -Wstrict-aliasing \
-std=gnu11 -fPIC \
-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DLOCALEDIR=\"$(localedir)\" \
-DEFIBOOTMGR_VERSION="\"$(VERSION)\"" \
-DDEFAULT_LOADER=\"\\\\EFI\\\\$(EFIDIR)\\\\$(EFI_LOADER)\" \
$(if $(findstring clang,$(CC)),$(clang_cflags),) \
$(if $(findstring gcc,$(CC)),$(gcc_cflags),) \
$(call pkg-config-cflags)
clang_ccldflags =
gcc_ccldflags = -fno-merge-constants \
-Wl,--fatal-warnings,--no-allow-shlib-undefined \
-Wl,-O2 -Wl,--no-undefined-version
ccldflags = $(cflags) $(CCLDFLAGS) $(LDFLAGS) \
$(if $(findstring clang,$(CCLD)),$(clang_ccldflags),) \
$(if $(findstring gcc,$(CCLD)),$(gcc_ccldflags),) \
$(call pkg-config-ldflags)
CPPFLAGS?=
SOFLAGS=-shared
LDLIBS=$(foreach lib,$(LIBS),-l$(lib)) $(call pkg-config-ldlibs)
.PHONY: check_efidir_error
check_efidir_error : ; $(EFIDIR_ERROR) $(info Building with EFIDIR as $(EFIDIR))
COMMIT_ID=$(shell git log -1 --pretty=%H 2>/dev/null || echo master)