-
Notifications
You must be signed in to change notification settings - Fork 46
/
Makefile
69 lines (53 loc) · 1.96 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
UNAME_S := $(shell uname -s)
CXX = g++
CXXFLAGS = -c --std=c++11 -Wall -Wno-unused-variable -Wno-unused-function -fPIC
LD = g++
RM = rm
5G_SIM_DEBUG = 5G-air-simulator
5G_SIM_RELEASE = 5G-air-simulator-release
ifeq ($(UNAME_S),Darwin)
FAST_FADING_LIBRARY = libfastfading.dylib
LIBS = -larmadillo -lfastfading
else
FAST_FADING_LIBRARY = fast-fading.so
LIBS = -larmadillo
endif
FAST_FADING_PATH = src/channel/propagation-model/FastFadingRealization
SRC_PROGRAM = $(shell find src/ -path $(FAST_FADING_PATH) -prune -o -name *.cpp -print)
SRC_FAST_FADING = $(shell find $(FAST_FADING_PATH) -name *.cpp)
OBJ_PROGRAM_DEBUG = $(SRC_PROGRAM:%.cpp=.obj/Debug/%.o)
OBJ_PROGRAM_RELEASE = $(SRC_PROGRAM:%.cpp=.obj/Release/%.o)
OBJ_FAST_FADING = $(SRC_FAST_FADING:%.cpp=.obj/Debug/%.o)
all: Debug
.obj/Debug/%.o: %.cpp
@mkdir -p $(@D)
@echo $<
@$(CXX) -O0 -g3 -D_GLIBCXX_DEBUG -DDEBUG $(CXXFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -MT"$(@:%.o=%.d)" $< -o $@
.obj/Release/%.o: %.cpp
@mkdir -p $(@D)
@echo $<
@$(CXX) -O2 $(CXXFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -MT"$(@:%.o=%.d)" $< -o $@
$(FAST_FADING_LIBRARY): $(OBJ_FAST_FADING)
ifeq ($(UNAME_S),Darwin)
@$(LD) -dynamiclib -install_name '/usr/local/lib/$(FAST_FADING_LIBRARY)' $(OBJ_FAST_FADING) -o $(FAST_FADING_LIBRARY)
else
@$(LD) -shared -o $(FAST_FADING_LIBRARY) $(OBJ_FAST_FADING)
endif
DEP = $(OBJ_PROGRAM_DEBUG:%.o=%.d)
-include $(DEP)
Debug: $(OBJ_PROGRAM_DEBUG) $(FAST_FADING_LIBRARY)
@echo $(5G_SIM_DEBUG)
ifeq ($(UNAME_S),Darwin)
@$(LD) -o $(5G_SIM_DEBUG) -Wl,-rpath,. $(OBJ_PROGRAM_DEBUG) $(LIBS)
else
@$(LD) -o $(5G_SIM_DEBUG) -Wl,-rpath=. $(OBJ_PROGRAM_DEBUG) $(LIBS) $(FAST_FADING_LIBRARY)
endif
Release: $(OBJ_PROGRAM_RELEASE) $(FAST_FADING_LIBRARY)
@echo $(5G_SIM_RELEASE)
ifeq ($(UNAME_S),Darwin)
@$(LD) -o $(5G_SIM_RELEASE) -Wl,-rpath,. $(OBJ_PROGRAM_RELEASE) $(LIBS)
else
@$(LD) -o $(5G_SIM_RELEASE) -Wl,-rpath=. $(OBJ_PROGRAM_RELEASE) $(LIBS) $(FAST_FADING_LIBRARY)
endif
clean:
$(RM) -rf .obj/*