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

Private GIT Repository
Rewrite macro ESSE() and get rid of misc::str_nil.
[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 CC := gcc
10 CXX := g++
11
12 CPPFLAGS += -I $(SIMGRID_INSTALL_DIR)/include
13 CPPFLAGS += -D XBT_LOG_OLD_STYLE
14 CPPFLAGS += $(CHECK_FLAGS)
15
16 #CFLAGS += -std=c99
17 #CFLAGS += -fgnu89-inline      # workaround simgrid bug
18 CFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
19
20 #CXXFLAGS += -std=c++0x
21 CXXFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
22
23 LDFLAGS += -L $(SIMGRID_INSTALL_DIR)/lib
24 LDFLAGS += -Wl,-rpath,$(SIMGRID_INSTALL_DIR)/lib
25
26 LINK.o = $(CXX) $(CXXFLAGS) $(LDFLAGS) $(TARGET_ARCH)
27 LDLIBS := -lsimgrid
28
29 MAKEDEPEND.FLAGS =  $(CPPFLAGS) -MM -MG -MF $@ $<
30 MAKEDEPEND.CXX = $(CXX) $(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         misc.cpp                \
39         neighbor.cpp            \
40         options.cpp             \
41         process.cpp             \
42         version.cpp
43
44 SRC.simple_async := simple_async.cpp
45
46 SRC := $(SRC.loba) $(SRC.simple_async)
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            simple_async
54
55 XML_FILES =                                             \
56         Dep.xml  Plat.xml                               \
57         platform.xml deployment.xml simple_async.xml    \
58         cluster1000.xml
59
60 XML_DEV_FILES = $(XML_FILES:%.xml=%_dev.xml)
61
62 .PHONY: all full xml clean realclean $(FLAVOURED_LOBA)
63
64 all: $(DEFAULT_TARGETS)
65
66 full:
67         @for target in $(FLAVOURED_LOBA); do    \
68                 echo $(MAKE) "$$target";        \
69                 $(MAKE) "$$target";             \
70         done
71         $(MAKE) xml $(DEFAULT_TARGETS)
72
73 xml: $(XML_DEV_FILES)
74
75 clean:
76         $(RM) core core.[0-9]* vgcore.[0-9]*
77         $(RM) localversion
78         $(RM) $(OBJ)
79         $(RM) $(DEP)
80         $(RM) $(TARGETS)
81
82 realclean: clean
83         $(RM) $(FLAVOURED_LOBA)
84         $(RM) $(XML_DEV_FILES)
85         $(RM) *~
86
87 %.d: %.cpp ; $(MAKEDEPEND.CXX)
88
89 %_dev.xml: %.xml
90         sed '/DOCTYPE/s,simgrid.dtd,http://simgrid.gforge.inria.fr/&,' $< > $@
91
92 $(FLAVOURED_LOBA):
93         $(MAKE) clean
94         $(MAKE) SIMGRID_INSTALL_DIR=./simgrid-$(patsubst loba-%,%,$@) loba
95         mv -f -- loba $@
96         $(MAKE) clean
97
98 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
99
100 ifeq ($(filter $(MAKECMDGOALS),full clean realclean $(FLAVOURED_LOBA)),)
101   $(shell ./setlocalversion)
102   -include $(DEP)
103 endif
104
105 .SECONDEXPANSION:
106 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
107         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@