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

Private GIT Repository
Add original file g5k.xml.
[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 -lrt
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) $(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) *~
75
76 .%.d: %.c ; $(MAKEDEPEND.C)
77
78 .%.d: %.cpp ; $(MAKEDEPEND.CXX)
79
80 $(FLAVOURED_LOBA):
81         $(MAKE) clean
82         $(MAKE) SIMGRID_INSTALL_DIR=$(PWD)/simgrid-$(patsubst loba-%,%,$@) loba
83         mv -f -- loba $@
84         $(MAKE) clean
85
86 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
87
88 ifeq ($(filter $(MAKECMDGOALS),full clean realclean $(FLAVOURED_LOBA)),)
89   $(shell ./setlocalversion)
90   -include $(DEP)
91 endif
92
93 .SECONDEXPANSION:
94 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
95         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@