forked from Xilinx-CNS/tcpdirect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (60 loc) · 1.78 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
76
77
78
79
80
81
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: (c) 2015-2024 Advanced Micro Devices, Inc.
.SUFFIXES:
.PHONY: all clean
.DEFAULT_GOAL := all
TOP := $(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
include Makefile.onload
include Makefile-top.inc
# Use Onload's build-tree structure, unless overridden.
ZF_BUILD_ROOT ?= build/$(ONLOAD_UL_BUILD_NAME)
SRC_ROOT := src
LIB_ROOT = $(ZF_BUILD_ROOT)/lib
BIN_ROOT = $(ZF_BUILD_ROOT)/bin
OBJ_ROOT = $(ZF_BUILD_ROOT)/obj
# These paths are evaulated each time they are referenced so are always
# relative to the current makefile
SRC_CURRENT = $(dir $(lastword $(MAKEFILE_LIST)))
OBJ_CURRENT = $(SRC_CURRENT:$(SRC_ROOT)/%=$(OBJ_ROOT)/%)
ifndef CC
CC := gcc
endif
ifndef CLINK
CLINK := $(CC)
endif
ifndef OBJCOPY
export OBJCOPY := $(shell $(CC) -print-prog-name=objcopy)
endif
ZF_CFLAGS_TOP = \
-Isrc/include \
-MD
ifeq ($(NDEBUG),1)
ZF_CFLAGS_TOP += -DNDEBUG=1
else
ZF_CFLAGS_TOP += -g
endif
# Generic rule to build most object files
$(OBJ_ROOT)/%.o: $(SRC_ROOT)/%.c
@mkdir -p $(dir $@)
$(CC) $(ZF_CFLAGS_COMPONENT) $(CFLAGS) $(ZF_CFLAGS_TOP) -c $< -o $@
ifeq ($(ZF_DEVEL),1)
ZF_CFLAGS_TOP += -DZF_DEVEL
endif
include src/lib/zf/Makefile.inc
ifeq ($(ZF_DEVEL),1)
include src/lib/zf/shim/Makefile.inc
include src/tests/zf_unit/Makefile.inc
endif
include src/tests/trade_sim/Makefile.inc
include src/tools/zf/Makefile.inc
include src/tests/zf_apps/Makefile.inc
include src/tests/zf_internal/Makefile.inc
# We use packetdrill for some tests, but can cope without it if not present
ifneq ("$(wildcard ../packetdrill-tcpdirect/Makefile.inc)", "")
include ../packetdrill-tcpdirect/Makefile.inc
endif
include $(shell find $(OBJ_ROOT) -name *.d 2>/dev/null)
tarball:
scripts/zf_make_tarball
clean:
rm -rf $(ZF_BUILD_ROOT)