-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
75 lines (59 loc) · 1.71 KB
/
Makefile
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
#
# stubby makefile
#
# Copyright (c) 2020 Cisco Systems, Inc. <pmoore2@cisco.com>
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
include make.conf
STUBBY_OBJS = \
util.o \
disk.o \
pe.o \
linux.o \
stub.o \
stra.o \
kcmdline.o \
TEST_EXES = test-cmdline test-get-cmdline
TEST_OBJS = linux_efilib-lt.o kcmdline-lt.o stra-lt.o
.PHONY: all
all: build test
.PHONY: build
build: stubby.efi $(TEST_EXES)
stubby.so: ${STUBBY_OBJS}
${LD} ${LDFLAGS} $^ -o $@ -lefi -lgnuefi
%.efi: %.so
objcopy -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc \
--target=efi-app-${ARCH} $^ $@
.PHONY: test
test: $(TEST_EXES)
@for t in $(TEST_EXES); do echo -- $$t --; ./$$t || exit; done
LINUX_TEST_CFLAGS := -DLINUX_TEST $(filter-out -fshort-wchar,$(CFLAGS))
%-lt.o: %.c
$(CC) $(LINUX_TEST_CFLAGS) -c -o $@ $^
test-%: test-%-lt.o $(TEST_OBJS)
$(CC) $(LINUX_TEST_CFLAGS) -o $@ $^
.PHONY: show-version
show-version:
@echo $(VERSION)
.PHONY: clean
tarball:
@[ -s git-version ] || echo $(VERSION)
./tools/make-tarball
.PHONY: clean
clean:
${RM} -rf *.efi *.so *.o $(TEST_EXES)
# kate: syntax Makefile;