~helen-fornazier/shim/trunk

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Mathieu Trudel-Lapierre
  • Date: 2016-09-22 00:29:42 UTC
  • mto: This revision was merged to the branch mainline in revision 107.
  • Revision ID: mathieu.trudel-lapierre@canonical.com-20160922002942-volexao40gxxs0qs
Tags: upstream-0.9+1474479173.6c180c6
ImportĀ upstreamĀ versionĀ 0.9+1474479173.6c180c6

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
OBJCOPY         = $(CROSS_COMPILE)objcopy
10
10
 
11
11
ARCH            = $(shell $(CC) -dumpmachine | cut -f1 -d- | sed s,i[3456789]86,ia32,)
12
 
OBJCOPY_GTE224  = $(shell expr `$(OBJCOPY) --version |grep ^"GNU objcopy" | sed 's/^.version //g' | cut -f1-2 -d.` \>= 2.24)
 
12
OBJCOPY_GTE224  = $(shell expr `$(OBJCOPY) --version |grep ^"GNU objcopy" | sed 's/^.*\((.*)\|version\) //g' | cut -f1-2 -d.` \>= 2.24)
13
13
 
14
14
SUBDIRS         = Cryptlib lib
15
15
 
16
 
LIB_PATH        = /usr/lib64
17
 
 
18
16
EFI_INCLUDE     := /usr/include/efi
19
17
EFI_INCLUDES    = -nostdinc -ICryptlib -ICryptlib/Include -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol -I$(shell pwd)/include
20
 
EFI_PATH        := /usr/lib64/gnuefi
21
18
 
22
19
LIB_GCC         = $(shell $(CC) -print-libgcc-file-name)
23
20
EFI_LIBS        = -lefi -lgnuefi --start-group Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a --end-group $(LIB_GCC) 
33
30
                  "-DDEFAULT_LOADER=L\"$(DEFAULT_LOADER)\"" \
34
31
                  "-DDEFAULT_LOADER_CHAR=\"$(DEFAULT_LOADER)\"" \
35
32
                  $(EFI_INCLUDES)
 
33
SHIMNAME        = shim
 
34
MMNAME          = MokManager
 
35
FBNAME          = fallback
36
36
 
37
37
ifneq ($(origin OVERRIDE_SECURITY_POLICY), undefined)
38
38
        CFLAGS  += -DOVERRIDE_SECURITY_POLICY
39
39
endif
40
40
 
 
41
ifneq ($(origin ENABLE_HTTPBOOT), undefined)
 
42
        CFLAGS  += -DENABLE_HTTPBOOT
 
43
endif
 
44
 
41
45
ifeq ($(ARCH),x86_64)
42
46
        CFLAGS  += -mno-mmx -mno-sse -mno-red-zone -nostdinc \
43
47
                -maccumulate-outgoing-args \
44
48
                -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI \
45
49
                -DNO_BUILTIN_VA_FUNCS \
46
 
                "-DEFI_ARCH=L\"x64\"" \
 
50
                -DMDE_CPU_X64 "-DEFI_ARCH=L\"x64\"" -DPAGE_SIZE=4096 \
47
51
                "-DDEBUGDIR=L\"/usr/lib/debug/usr/share/shim/x64-$(VERSION)$(RELEASE)/\""
 
52
        MMNAME  = mmx64
 
53
        FBNAME  = fbx64
 
54
        SHIMNAME= shimx64
 
55
        EFI_PATH:=/usr/lib64/gnuefi
 
56
        LIB_PATH:=/usr/lib64
 
57
 
48
58
endif
49
59
ifeq ($(ARCH),ia32)
50
60
        CFLAGS  += -mno-mmx -mno-sse -mno-red-zone -nostdinc \
51
61
                -maccumulate-outgoing-args -m32 \
52
 
                "-DEFI_ARCH=L\"ia32\"" \
 
62
                -DMDE_CPU_IA32 "-DEFI_ARCH=L\"ia32\"" -DPAGE_SIZE=4096 \
53
63
                "-DDEBUGDIR=L\"/usr/lib/debug/usr/share/shim/ia32-$(VERSION)$(RELEASE)/\""
 
64
        MMNAME  = mmia32
 
65
        FBNAME  = fbia32
 
66
        SHIMNAME= shimia32
 
67
        EFI_PATH:=/usr/lib/gnuefi
 
68
        LIB_PATH:=/usr/lib
54
69
endif
55
70
ifeq ($(ARCH),aarch64)
56
 
        CFLAGS += "-DEFI_ARCH=L\"aa64\"" \
 
71
        CFLAGS += -DMDE_CPU_AARCH64 "-DEFI_ARCH=L\"aa64\"" -DPAGE_SIZE=4096 \
57
72
                "-DDEBUGDIR=L\"/usr/lib/debug/usr/share/shim/aa64-$(VERSION)$(RELEASE)/\""
 
73
        MMNAME  = mmaa64
 
74
        FBNAME  = fbaa64
 
75
        SHIMNAME= shimaa64
 
76
        EFI_PATH:=/usr/lib64/gnuefi
 
77
        LIB_PATH:=/usr/lib64
58
78
endif
59
79
 
60
80
ifneq ($(origin VENDOR_CERT_FILE), undefined)
66
86
 
67
87
LDFLAGS         = --hash-style=sysv -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic -L$(EFI_PATH) -L$(LIB_PATH) -LCryptlib -LCryptlib/OpenSSL $(EFI_CRT_OBJS) --build-id=sha1
68
88
 
69
 
TARGET  = shim.efi MokManager.efi.signed fallback.efi.signed
 
89
TARGET  = $(SHIMNAME).efi $(MMNAME).efi.signed $(FBNAME).efi.signed
70
90
OBJS    = shim.o netboot.o cert.o replacements.o tpm.o version.o
71
91
KEYS    = shim_cert.h ocsp.* ca.* shim.crt shim.csr shim.p12 shim.pem shim.key shim.cer
72
92
SOURCES = shim.c shim.h netboot.c include/PeImage.h include/wincert.h include/console.h replacements.c replacements.h tpm.c tpm.h version.c version.h
75
95
FALLBACK_OBJS = fallback.o
76
96
FALLBACK_SRCS = fallback.c
77
97
 
 
98
ifneq ($(origin ENABLE_HTTPBOOT), undefined)
 
99
        OBJS += httpboot.o
 
100
        SOURCES += httpboot.c httpboot.h
 
101
endif
 
102
 
78
103
all: $(TARGET)
79
104
 
80
105
shim.crt:
105
130
cert.o : cert.S
106
131
        $(CC) $(CFLAGS) -c -o $@ $<
107
132
 
108
 
shim.so: $(OBJS) Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a lib/lib.a
 
133
$(SHIMNAME).so: $(OBJS) Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a lib/lib.a
109
134
        $(LD) -o $@ $(LDFLAGS) $^ $(EFI_LIBS)
110
135
 
111
136
fallback.o: $(FALLBACK_SRCS)
112
137
 
113
 
fallback.so: $(FALLBACK_OBJS) Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a lib/lib.a
 
138
$(FBNAME).so: $(FALLBACK_OBJS) Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a lib/lib.a
114
139
        $(LD) -o $@ $(LDFLAGS) $^ $(EFI_LIBS)
115
140
 
116
141
MokManager.o: $(MOK_SOURCES)
117
142
 
118
 
MokManager.so: $(MOK_OBJS) Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a lib/lib.a
 
143
$(MMNAME).so: $(MOK_OBJS) Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a lib/lib.a
119
144
        $(LD) -o $@ $(LDFLAGS) $^ $(EFI_LIBS) lib/lib.a
120
145
 
121
146
Cryptlib/libcryptlib.a: