-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
executable file
·137 lines (106 loc) · 2.58 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#TOP :=$(shell pwd)
TOP :=.
MAIN_DIR:=$(TOP)/mainenv
IPC_INC += -I$(MAIN_DIR)/inc
IPC_INC += -I$(LOG_DIR)
PROJECT_SRC += $(wildcard $(TOP)/*.cpp)
######
# mainenv
######
IPC_INC += -I$(MAIN_DIR)
PROJECT_SRC += $(wildcard $(MAIN_DIR)/*.cpp)
######
# alarm
######
ALARM_DIR := $(TOP)/mainenv/alarm
IPC_INC += -I$(ALARM_DIR)
PROJECT_SRC += $(wildcard $(ALARM_DIR)/*.cpp)
######
# codec
######
CODEC_DIR := $(TOP)/mainenv/codec
IPC_INC += -I$(CODEC_DIR)
PROJECT_SRC += $(wildcard $(CODEC_DIR)/*.cpp)
######
# log
######
LOG_DIR := $(TOP)/mainenv/log
IPC_INC += -I$(LOG_DIR)
PROJECT_SRC += $(wildcard $(LOG_DIR)/*.cpp)
######
# Net
######
NET_DIR := $(TOP)/mainenv/net
IPC_INC += -I$(NET_DIR)
PROJECT_SRC += $(wildcard $(NET_DIR)/*.cpp)
######
# other
######
OTHER_DIR := $(TOP)/mainenv/other
IPC_INC += -I$(OTHER_DIR)
PROJECT_SRC += $(wildcard $(OTHER_DIR)/*.cpp)
######
# param
######
PARAM_DIR := $(TOP)/mainenv/param
IPC_INC += -I$(PARAM_DIR)
PROJECT_SRC += $(wildcard $(PARAM_DIR)/*.cpp)
######
# server
######
SERVER_DIR := $(TOP)/mainenv/server
IPC_INC += -I$(SERVER_DIR)
PROJECT_SRC += $(wildcard $(SERVER_DIR)/*.cpp)
######
# time
######
TIME_DIR := $(TOP)/mainenv/time
IPC_INC += -I$(TIME_DIR)
PROJECT_SRC += $(wildcard $(TIME_DIR)/*.cpp)
######
# timer
######
TIMER_DIR := $(TOP)/mainenv/timer
IPC_INC += -I$(TIMER_DIR)
PROJECT_SRC += $(wildcard $(TIMER_DIR)/*.cpp)
######
# common
#######
COMMON_DIR := $(TOP)/mainenv/common
IPC_INC += -I$(COMMON_DIR)
PROJECT_SRC += $(wildcard $(COMMON_DIR)/tinyxml/*.cpp)
CFLAGS += $(IPC_INC)
################
# lib
#############
LIB += $(MAIN_DIR)/lib/libevent/libevent.a
LIB += $(MAIN_DIR)/lib/libevent/libevent_core.a
LIB += $(MAIN_DIR)/lib/libevent/libevent_extra.a
LIB += $(MAIN_DIR)/lib/libevent/libevent_pthreads.a
STD += -std=c99
LDFLAGS += $(LIB)
LDFLAGS += -ldl -pthread -g
OBJECTS_DIR:=$(TOP)/objects
OBJECT_FILE:=$(addprefix $(OBJECTS_DIR)/, $(addsuffix .o, $(basename $(notdir $(PROJECT_SRC)))))
CC := g++
EXE_NAME:=ipc_software
DEPFILE:=$(PROJECT_ROOT)/deps
.PHONY:all
all:$(DEPFILE) $(EXE_NAME)
$(DEPFILE): $(PROJECT_SRC) Makefile
@echo "Generating new dependency file...";
@-rm -f $(DEPFILE)
@for f in $(PROJECT_SRC); do \
OBJ=$(OBJECTS_DIR)/`basename $$f|sed -e 's/\.cpp/\.o/' -e 's/\.c/\.o/'`; \
echo $$OBJ: $$f>> $(DEPFILE); \
echo ' $(CC) $$(CFLAGS) -c -o $$@ $$^'>> $(DEPFILE); \
done
-include $(DEPFILE)
############################################
$(EXE_NAME): $(OBJECT_FILE)
$(CC) $(STD) $(CFLAGS) $(OBJECT_FILE) -o "$@" $(LDFLAGS)
.PHONY:clean
clean:
rm -rf $(EXE_NAME)
rm -rf $(DEPFILE)
rm -rf $(OBJECTS_DIR)/*.o