forked from sachinAtGitHub/AutomaticConfigurationRouteFlow
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Make.rules
81 lines (58 loc) · 2.08 KB
/
Make.rules
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
#.SILENT:
# Sufix and prefix
ARCH := $(shell getconf LONG_BIT)
LIBSUFFIX=a
LIBPREFIX=lib
SOURCE_SUFIX := cc
SOURCE_FILES := $(wildcard *.$(SOURCE_SUFIX))
RFLIBS := $(addprefix $(BUILD_LIB_DIR)/,$(RFLIB_NAME))
RFLIBS := $(addsuffix .$(LIBSUFFIX),$(RFLIBS))
LNX_LIBS := -lrt -lnetlink -lutil -lpthread -lmongoclient -lboost_thread -lboost_system -lboost_filesystem -lboost_program_options
CPPFLAGS += -I$(LIB_DIR)
CPPFLAGS += $(addprefix -I$(LIB_DIR)/,$(libdirs))
CPPFLAGS += -I$(MONGO_DIR)
ifneq (,$(DEBUG))
CFLAGS += -g -D_GLIBCXX_DEBUG=1
endif
ifneq (,$(MAKEAPPS))
apps_bin := $(BUILD_DIR)/$(MAKEAPPS)
objs := $(patsubst %.$(SOURCE_SUFIX),%.o, \
$(addprefix $(BUILD_OBJ_DIR)/$(notdir $(CURDIR))/,$(SOURCE_FILES)))
endif
ifneq (,$(MAKELIBS))
targetlib := $(BUILD_LIB_DIR)/$(RFLIB_NAME).$(LIBSUFFIX)
objs := $(foreach dir, $(MAKELIBS), $(wildcard $(BUILD_OBJ_DIR)/$(dir)/*.o))
endif
ifneq (,$(LIBDEP))
ifeq ($(ARCH),64)
CPPFLAGS += -fPIC
endif
lib_objs := $(patsubst %.$(SOURCE_SUFIX),%.o, \
$(addprefix $(BUILD_OBJ_DIR)/$(notdir $(CURDIR))/,$(SOURCE_FILES)))
endif
ifneq (,$(SOURCE_FILES))
endif
################################################################################
# TARGETS
all: $(lib_objs) $(targetlib) $(apps_bin)
################################################################################
# BUILD OBJS
$(BUILD_OBJ_DIR)/$(notdir $(CURDIR))/%.o: %.$(SOURCE_SUFIX)
$(CPP) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
################################################################################
# BUILD LIB DEPS
$(BUILD_LIB_DIR)/$(notdir $(CURDIR))/%.o: %.$(SOURCE_SUFIX)
$(CPP) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
################################################################################
# BUILD LIBS
$(BUILD_LIB_DIR)/%.$(LIBSUFFIX): $(objs)
$(AR) r $@ $?
################################################################################
# BUILD APPS
$(apps_bin): $(objs) $(RFLIBS)
$(CPP) $(CPPFLAGS) -o $@ $(objs) $(RFLIBS) $(LNX_LIBS);
################################################################################
# CLEAN
clean:
@rm -f $(objs);
@rm -f $(targetlib);