forked from iqiyi/dpvs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (66 loc) · 2.04 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
82
83
84
85
86
87
#
# DPVS is a software load balancer (Virtual Server) based on DPDK.
#
# Copyright (C) 2021 iQIYI (www.iqiyi.com).
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program 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 General Public License for more details.
#
#
# Makefile for dpvs (DPVS main program).
#
#DEBUG := 1 # enable for debug
TARGET := dpvs
ifneq ("$(wildcard VERSION)","")
VERSION_STRING := $(shell ./VERSION)
else
VERSION_STRING := $(shell git describe --tags --always)
endif
DATE_STRING := $(shell date +%Y.%m.%d.%H:%M:%S)
# same path of THIS Makefile
SRCDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
ifeq ($(RTE_SDK),)
$(error "The variable RTE_SDK is not defined.")
endif
include $(RTE_SDK)/mk/rte.vars.mk
include $(SRCDIR)/config.mk
include $(SRCDIR)/dpdk.mk
INCDIRS += -I $(SRCDIR)/../include
# for dpvs main program.
CFLAGS += -D __DPVS__ -DDPVS_VERSION=\"$(VERSION_STRING)\" -DDPVS_BUILD_DATE=\"$(DATE_STRING)\"
CFLAGS += -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -mcmodel=medium
ifeq ($(shell test $(GCC_VERSION) -ge 70 && echo 1), 1)
CFLAGS += -Wno-format-truncation
CFLAGS += -Wno-stringop-truncation
CFLAGS += -Wstringop-overflow=0
endif
ifeq ($(DEBUG),)
CFLAGS += -O3
else
CFLAGS += -g -O0 -D DEBUG
CFLAGS += -rdynamic
endif
LIBS += -lpthread -lnuma
CFLAGS += $(INCDIRS) $(LIBS)
OBJS := $(shell find $(SRCDIR) -name '*.c' | sort)
OBJS := $(patsubst %.c,%.o,$(OBJS))
all: $(TARGET)
$(TARGET): $(OBJS)
@echo " $(notdir $@)"
$(Q)$(CC) $(CFLAGS) $^ -o $@
%.o: %.c
@echo " $(notdir $@)"
$(Q)$(CC) -c $(CFLAGS) $< -o $@
clean:
find $(SRCDIR) -name '*.o' | xargs rm -f
rm -f ./$(TARGET)
install:
install -m 744 $(TARGET) $(INSDIR)