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

Private GIT Repository
Merge branch 'master' of ssh://info.iut-bm.univ-fcomte.fr/loba
[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 DEFAULT_TARGETS := loba
45 FLAVOURED_LOBA := loba-dev loba-stable
46 TARGETS := $(DEFAULT_TARGETS)   \
47            simple_async
48
49 .PHONY: all full clean realclean $(FLAVOURED_LOBA)
50
51 all: $(DEFAULT_TARGETS)
52
53 full:
54         $(MAKE) $(FLAVOURED_LOBA)
55         $(MAKE) $(TARGETS)
56
57 clean:
58         $(RM) core core.[0-9]* vgcore.[0-9]*
59         $(RM) misc_autogen.h
60         $(RM) localversion
61         $(RM) $(OBJ)
62         $(RM) $(DEP)
63         $(RM) $(TARGETS)
64
65 realclean: clean
66         $(RM) $(FLAVOURED_LOBA)
67         $(RM) *~
68
69 %.d: %.cpp ; $(MAKEDEPEND.CXX)
70
71 $(FLAVOURED_LOBA):
72         $(MAKE) clean
73         $(MAKE) SIMGRID_INSTALL_DIR=./simgrid-$(patsubst loba-%,%,$@) loba
74         mv -f -- loba $@
75         $(MAKE) clean
76
77 misc_autogen.h: $(SIMGRID_INSTALL_DIR)/include/xbt/log.h
78         grep -C1 '# *define *CLOG' $< \
79         | sed 's/CLOG/XCLOG/;s/_XBT_LOGV\(([^)]*)\)/(*\1)/' > $@
80
81 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
82
83 ifeq ($(filter $(MAKECMDGOALS),full clean realclean $(FLAVOURED_LOBA)),)
84   $(shell ./setlocalversion)
85   -include $(DEP)
86 endif
87
88 .SECONDEXPANSION:
89 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
90         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@