]> AND Private Git Repository - loba.git/blob - Makefile
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Use a lock-free synchronized queue for the message queue.
[loba.git] / Makefile
1 #SIMGRID_INSTALL_DIR ?= $(PWD)/simgrid-stable
2 SIMGRID_INSTALL_DIR ?= $(PWD)/simgrid-dev
3
4 OPTIM_FLAGS += -pipe -O3
5 DEBUG_FLAGS += -g
6 #DEBUG_FLAGS += -pg
7 CHECK_FLAGS += -Wall -Wextra
8
9 CC := gcc
10 CXX := g++
11
12 CPPFLAGS += -I $(SIMGRID_INSTALL_DIR)/include
13 CPPFLAGS += $(CHECK_FLAGS)
14
15 #CFLAGS += -std=c99
16 #CFLAGS += -fgnu89-inline      # workaround simgrid bug
17 CFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
18
19 CXXFLAGS += -std=c++0x
20 CXXFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
21
22 LDFLAGS += -L $(SIMGRID_INSTALL_DIR)/lib
23 LDFLAGS += -Wl,-rpath,$(SIMGRID_INSTALL_DIR)/lib
24
25 LINK.o = $(CXX) $(CXXFLAGS) $(LDFLAGS) $(TARGET_ARCH)
26 LDLIBS := -lsimgrid
27
28 MAKEDEPEND.FLAGS =  $(CPPFLAGS) -MM -MG -MF $@ $<
29 MAKEDEPEND.C = $(CC) $(CFLAGS) $(MAKEDEPEND.FLAGS)
30 MAKEDEPEND.CXX = $(CXX) $(CXXFLAGS) $(MAKEDEPEND.FLAGS)
31
32 SRC.loba := main.cpp            \
33         communicator.cpp        \
34         cost_func.cpp           \
35         deployment.cpp          \
36         hostdata.cpp            \
37         $(wildcard loba_*.cpp)  \
38         messages.cpp            \
39         misc.cpp                \
40         msg_thread.cpp          \
41         neighbor.cpp            \
42         options.cpp             \
43         process.cpp             \
44         version.cpp
45
46 SRC := $(SRC.loba)
47 OBJ := $(SRC:%.cpp=%.o)
48 DEP := $(SRC:%.cpp=.%.d)
49
50 DEFAULT_TARGETS := loba
51 FLAVOURED_LOBA := loba-dev loba-stable
52 TARGETS := $(DEFAULT_TARGETS)
53
54 .PHONY: all full clean realclean $(FLAVOURED_LOBA)
55
56 all: $(DEFAULT_TARGETS)
57
58 full:
59         @for target in $(FLAVOURED_LOBA); do    \
60                 echo $(MAKE) "$$target";        \
61                 $(MAKE) "$$target";             \
62         done
63         $(MAKE) xml $(DEFAULT_TARGETS)
64
65 clean:
66         $(RM) core core.[0-9]* vgcore.[0-9]*
67         $(RM) localversion
68         $(RM) $(OBJ)
69         $(RM) $(DEP)
70         $(RM) $(TARGETS)
71
72 realclean: clean
73         $(RM) $(FLAVOURED_LOBA)
74         $(RM) $(XML_DEV_FILES)
75         $(RM) *~
76
77 .%.d: %.c ; $(MAKEDEPEND.C)
78
79 .%.d: %.cpp ; $(MAKEDEPEND.CXX)
80
81 $(FLAVOURED_LOBA):
82         $(MAKE) clean
83         $(MAKE) SIMGRID_INSTALL_DIR=$(PWD)/simgrid-$(patsubst loba-%,%,$@) loba
84         mv -f -- loba $@
85         $(MAKE) clean
86
87 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
88
89 ifeq ($(filter $(MAKECMDGOALS),full clean realclean $(FLAVOURED_LOBA)),)
90   $(shell ./setlocalversion)
91   -include $(DEP)
92 endif
93
94 .SECONDEXPANSION:
95 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
96         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@