-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
60 lines (45 loc) · 1.42 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
.PHONY: all clean
CONFIG_MK = config.mk
CC = gcc
INC_DIR = include
SRC_DIR = src util events components app_events applications
OBJ_DIR = obj
BIN_DIR = bin
LOG_DIR = $(BIN_DIR)/log
TMP_DIR = $(BIN_DIR)/tmp
CPPFLAGS = $(addprefix -I,$(shell find $(SRC_DIR) -type d))
CFLAGS = -O2 -Wall -std=gnu99 -I/usr/include/mysql
#CFLAGS = -g -ggdb -Wall -std=gnu99 -I/usr/include/mysql
LDFLAGS = -lpthread -ljansson -lrt -lcli -lzmq -L/usr/lib -lmysqlclient
include $(CONFIG_MK)
CFLAGS += $(addprefix -D, $(CONFIG))
PROG = barista
SRC = $(shell find $(SRC_DIR) -name '*.c')
OBJ = $(patsubst %.c,%.o,$(notdir $(SRC)))
DEP = $(patsubst %.o,.%.dep,$(OBJ))
vpath %.c $(dir $(SRC))
vpath %.o $(OBJ_DIR)
.PRECIOUS: $(OBJ) %.o
all: $(PROG)
$(PROG): $(addprefix $(OBJ_DIR)/,$(OBJ))
mkdir -p $(@D)
$(CC) -o $@ $^ $(LDFLAGS)
mv $(PROG) $(BIN_DIR)
@cd ext_apps/l2_learning; make
@cd ext_apps/rbac; make
@cd ext_apps/benign_app; make
@cd ext_apps/malicious_app; make
$(OBJ_DIR)/%.o: %.c
mkdir -p $(@D)
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
$(OBJ_DIR)/.%.dep: %.c $(CONFIG_MK)
mkdir -p $(@D)
$(CC) $(CPPFLAGS) $(CFLAGS) -MM $< \
-MT '$(OBJ_DIR)/$(patsubst .%.dep,%.o,$(notdir $@))' > $@
mv $(PROG) $(BIN_DIR)
clean:
rm -rf $(BIN_DIR)/$(PROG) $(BIN_DIR)/core $(LOG_DIR)/*.log $(TMP_DIR)/* $(OBJ_DIR) G*
@cd ext_apps/l2_learning; make clean
@cd ext_apps/rbac; make clean
@cd ext_apps/benign_app; make clean
@cd ext_apps/malicious_app; make clean