-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (40 loc) · 1.33 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
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2010-2014 Intel Corporation
# binary name
APP = httpfake
# all source are stored in SRCS-y
SRCDIR=src
OBJDIR=obj
SRCS := $(wildcard $(SRCDIR)/*.c)
OBJECTS := $(SRCS:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
#OBJECTS += src/main.o
PKGCONF ?= pkg-config
# Build using pkg-config variables if possible
ifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0)
$(error "no installation of DPDK found")
endif
all: shared
.PHONY: shared static
shared: build/$(APP)-shared
ln -sf $(APP)-shared build/$(APP)
static: build/$(APP)-static
ln -sf $(APP)-static build/$(APP)
CFLAGS += -std=c11 -O3 $(shell $(PKGCONF) --cflags libdpdk) -D_POSIX_C_SOURCE=200809L
#CFLAGS += -O0 -g $(shell $(PKGCONF) --cflags libdpdk) -mavx512vl
LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) lib/libconfig.a
LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
@echo "Compiled "$<" successfully!"
build/$(APP)-shared: $(OBJECTS) | build
$(CC) $(OBJECTS) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
build/$(APP)-static: $(OBJECTS) | build
$(CC) $(OBJECTS) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
build:
@mkdir -p $@
@mkdir -p obj
.PHONY: clean
clean:
rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
rm -fr obj/*
test -d build && rmdir -p build || true