llvm-project

Форк
0
101 строка · 2.6 Кб
1
# Makefile fragment - requires GNU make
2
#
3
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
# See https://llvm.org/LICENSE.txt for license information.
5
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6

7
S := $(srcdir)/string
8
B := build/string
9

10
ifeq ($(ARCH),)
11
all-string check-string install-string clean-string:
12
	@echo "*** Please set ARCH in config.mk. ***"
13
	@exit 1
14
else
15

16
string-lib-srcs := $(wildcard $(S)/$(ARCH)/*.[cS])
17
string-test-srcs := $(wildcard $(S)/test/*.c)
18

19
string-includes := $(patsubst $(S)/%,build/%,$(wildcard $(S)/include/*.h))
20

21
string-libs := \
22
	build/lib/libstringlib.so \
23
	build/lib/libstringlib.a \
24

25
string-tools := \
26
	build/bin/test/memcpy \
27
	build/bin/test/memmove \
28
	build/bin/test/memset \
29
	build/bin/test/memchr \
30
	build/bin/test/memcmp \
31
	build/bin/test/strcpy \
32
	build/bin/test/stpcpy \
33
	build/bin/test/strcmp \
34
	build/bin/test/strchr \
35
	build/bin/test/strrchr \
36
	build/bin/test/strchrnul \
37
	build/bin/test/strlen \
38
	build/bin/test/strnlen \
39
	build/bin/test/strncmp
40

41
string-lib-objs := $(patsubst $(S)/%,$(B)/%.o,$(basename $(string-lib-srcs)))
42
string-test-objs := $(patsubst $(S)/%,$(B)/%.o,$(basename $(string-test-srcs)))
43

44
string-objs := \
45
	$(string-lib-objs) \
46
	$(string-lib-objs:%.o=%.os) \
47
	$(string-test-objs) \
48

49
string-files := \
50
	$(string-objs) \
51
	$(string-libs) \
52
	$(string-tools) \
53
	$(string-includes) \
54

55
all-string: $(string-libs) $(string-tools) $(string-includes)
56

57
$(string-objs): $(string-includes)
58
$(string-objs): CFLAGS_ALL += $(string-cflags)
59

60
build/lib/libstringlib.so: $(string-lib-objs:%.o=%.os)
61
	$(CC) $(CFLAGS_ALL) $(LDFLAGS) -shared -o $@ $^
62

63
build/lib/libstringlib.a: $(string-lib-objs)
64
	rm -f $@
65
	$(AR) rc $@ $^
66
	$(RANLIB) $@
67

68
build/bin/test/%: $(B)/test/%.o build/lib/libstringlib.a
69
	$(CC) $(CFLAGS_ALL) $(LDFLAGS) -static -o $@ $^ $(LDLIBS)
70

71
build/include/%.h: $(S)/include/%.h
72
	cp $< $@
73

74
build/bin/%.sh: $(S)/test/%.sh
75
	cp $< $@
76

77
check-string: $(string-tools)
78
	$(EMULATOR) build/bin/test/memcpy
79
	$(EMULATOR) build/bin/test/memmove
80
	$(EMULATOR) build/bin/test/memset
81
	$(EMULATOR) build/bin/test/memchr
82
	$(EMULATOR) build/bin/test/memcmp
83
	$(EMULATOR) build/bin/test/strcpy
84
	$(EMULATOR) build/bin/test/stpcpy
85
	$(EMULATOR) build/bin/test/strcmp
86
	$(EMULATOR) build/bin/test/strchr
87
	$(EMULATOR) build/bin/test/strrchr
88
	$(EMULATOR) build/bin/test/strchrnul
89
	$(EMULATOR) build/bin/test/strlen
90
	$(EMULATOR) build/bin/test/strnlen
91
	$(EMULATOR) build/bin/test/strncmp
92

93
install-string: \
94
 $(string-libs:build/lib/%=$(DESTDIR)$(libdir)/%) \
95
 $(string-includes:build/include/%=$(DESTDIR)$(includedir)/%)
96

97
clean-string:
98
	rm -f $(string-files)
99
endif
100

101
.PHONY: all-string check-string install-string clean-string
102

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.