1 # Makefile fragment - requires GNU make
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
7 S
:= $(srcdir)/networking
11 all-networking check-networking install-networking clean-networking
:
12 @echo
"*** Please set ARCH in config.mk. ***"
16 networking-lib-srcs
:= $(wildcard $(S
)/*.
[cS
]) $(wildcard $(S
)/$(ARCH
)/*.
[cS
])
17 networking-test-srcs
:= $(wildcard $(S
)/test/*.c
)
19 networking-includes
:= $(patsubst $(S
)/%,build
/%,$(wildcard $(S
)/include/*.h
))
22 build
/lib
/libnetworking.so \
23 build
/lib
/libnetworking.a \
28 networking-lib-objs
:= $(patsubst $(S
)/%,$(B
)/%.o
,$(basename $(networking-lib-srcs
)))
29 networking-test-objs
:= $(patsubst $(S
)/%,$(B
)/%.o
,$(basename $(networking-test-srcs
)))
32 $(networking-lib-objs
) \
33 $(networking-lib-objs
:%.o
=%.os
) \
34 $(networking-test-objs
) \
40 $(networking-includes
) \
42 all-networking
: $(networking-libs
) $(networking-tools
) $(networking-includes
)
44 $(networking-objs
): $(networking-includes
)
45 $(networking-objs
): CFLAGS_ALL
+= $(networking-cflags
)
47 build
/lib
/libnetworking.so
: $(networking-lib-objs
:%.o
=%.os
)
48 $(CC
) $(CFLAGS_ALL
) $(LDFLAGS
) -shared
-o
$@
$^
50 build
/lib
/libnetworkinglib.a
: $(networking-lib-objs
)
55 build
/bin
/test/%: $(B
)/test/%.o build
/lib
/libnetworkinglib.a
56 $(CC
) $(CFLAGS_ALL
) $(LDFLAGS
) -static
-o
$@
$^
$(LDLIBS
)
58 build
/include/%.h
: $(S
)/include/%.h
61 build
/bin
/%.sh
: $(S
)/test/%.sh
64 check-networking
: $(networking-tools
)
65 $(EMULATOR
) build
/bin
/test/chksum
-i simple
66 $(EMULATOR
) build
/bin
/test/chksum
-i scalar
67 $(EMULATOR
) build
/bin
/test/chksum
-i simd || true
# simd is not always available
70 $(networking-libs
:build
/lib
/%=$(DESTDIR
)$(libdir)/%) \
71 $(networking-includes
:build
/include/%=$(DESTDIR
)$(includedir)/%)
74 rm -f
$(networking-files
)
77 .PHONY
: all-networking check-networking install-networking clean-networking