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

Private GIT Repository
TODO update.
[loba.git] / Makefile
1 SIMGRID_INSTALL_DIR := ./simgrid-stable
2 #SIMGRID_INSTALL_DIR := ./simgrid-dev
3
4 OPTIM_FLAGS += -O3
5 DEBUG_FLAGS += -g
6 #DEBUG_FLAGS += -pg
7 CHECK_FLAGS += -Wall -Wextra
8
9 CXX := g++
10
11 CPPFLAGS += -I $(SIMGRID_INSTALL_DIR)/include
12 CPPFLAGS += $(CHECK_FLAGS)
13
14 #CXXFLAGS += -std=c++0x
15 CXXFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
16
17 LDFLAGS += -L $(SIMGRID_INSTALL_DIR)/lib
18 LDFLAGS += -Wl,-rpath,$(SIMGRID_INSTALL_DIR)/lib
19
20 LINK.o = $(CXX) $(CXXFLAGS) $(LDFLAGS) $(TARGET_ARCH)
21 LDLIBS := -lsimgrid
22
23 MAKEDEPEND.FLAGS =  $(CPPFLAGS) -MM -MG -MF $@ $<
24 MAKEDEPEND.CXX = $(CXX) $(MAKEDEPEND.FLAGS)
25
26 SRC.loba := main.cpp            \
27         communicator.cpp        \
28         cost_func.cpp           \
29         deployment.cpp          \
30         hostdata.cpp            \
31         $(wildcard loba_*.cpp)  \
32         misc.cpp                \
33         neighbor.cpp            \
34         options.cpp             \
35         process.cpp             \
36         version.cpp
37
38 SRC.simple_async := simple_async.cpp
39
40 SRC := $(SRC.loba) $(SRC.simple_async)
41 OBJ := $(SRC:%.cpp=%.o)
42 DEP := $(SRC:%.cpp=%.d)
43
44 TARGETS := loba simple_async
45
46 .PHONY: all clean realclean
47
48 all: $(TARGETS)
49
50 clean:
51         $(RM) core core.[0-9]* vgcore.[0-9]*
52         $(RM) misc_autogen.h
53         $(RM) localversion
54         $(RM) $(OBJ)
55         $(RM) $(DEP)
56         $(RM) $(TARGETS)
57
58 realclean: clean
59         $(RM) *~
60
61 %.d: %.cpp ; $(MAKEDEPEND.CXX)
62
63 misc_autogen.h: $(SIMGRID_INSTALL_DIR)/include/xbt/log.h
64         grep -C1 '# *define *CLOG' $< \
65         | sed 's/CLOG/XCLOG/;s/_XBT_LOGV\(([^)]*)\)/(*\1)/' > $@
66
67 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
68
69 ifneq ($(MAKECMDGOALS),clean)
70   ifneq ($(MAKECMDGOALS),realclean)
71     $(shell ./setlocalversion)
72     -include $(DEP)
73   endif
74 endif
75
76 .SECONDEXPANSION:
77 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
78         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@