-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
47 lines (32 loc) · 1.24 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
# SPDX-License-Identifier: BSD-3-Clause
CCAN_PATH := ./ccan
YNL_PATH := ./ynl-c
CC=gcc
CFLAGS=-std=gnu99 -I$(CCAN_PATH) -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow -DDEBUG -g
CFLAGS += -I$(YNL_PATH)/include/
LIBS=-lm -L$(CCAN_PATH) -pthread -lccan
LIBS += -L$(YNL_PATH) -lynl
include $(wildcard *.d)
all: server client units
units: bipartite_match cpu_stat
server: $(CCAN_PATH)/libccan.a $(YNL_PATH)/libynl.a server.o server_session.o proto.o worker.o devmem.o cpu_stat.o tcp.o
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
client: $(CCAN_PATH)/libccan.a client.o proto.o bipartite_match.o
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
$(CCAN_PATH)/libccan.a:
make -C $(CCAN_PATH)/
ar rcs $(CCAN_PATH)/libccan.a $(CCAN_PATH)/ccan/*/*.o
$(YNL_PATH)/libynl.a:
make -C $(YNL_PATH)
clean:
rm -rf *.o *.d *~ bipartite_match cpu_stat
distclean:
rm -rf *.o *.d *~ bipartite_match cpu_stat server client $(CCAN_PATH)/libccan.a
bipartite_match: $(CCAN_PATH)/libccan.a
$(CC) $(CFLAGS) -DKPERF_UNITS bipartite_match.c -o bipartite_match $(CCAN_PATH)/libccan.a
cpu_stat: $(CCAN_PATH)/libccan.a
$(CC) $(CFLAGS) -DKPERF_UNITS cpu_stat.c -o cpu_stat $(CCAN_PATH)/libccan.a
%.o: %.c
$(COMPILE.c) -MMD -o $@ $<
.PHONY: all clean units ccan distclean
.DEFAULT_GOAL=all