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

Private GIT Repository
Improve warning message.
[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 += $(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.CXX = $(CXX) $(MAKEDEPEND.FLAGS)
30
31 SRC.loba := main.cpp            \
32         communicator.cpp        \
33         cost_func.cpp           \
34         deployment.cpp          \
35         hostdata.cpp            \
36         $(wildcard loba_*.cpp)  \
37         misc.cpp                \
38         neighbor.cpp            \
39         options.cpp             \
40         process.cpp             \
41         statistics.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) misc_autogen.h
78         $(RM) localversion
79         $(RM) $(OBJ)
80         $(RM) $(DEP)
81         $(RM) $(TARGETS)
82
83 realclean: clean
84         $(RM) $(FLAVOURED_LOBA)
85         $(RM) $(XML_DEV_FILES)
86         $(RM) *~
87
88 %.d: %.cpp ; $(MAKEDEPEND.CXX)
89
90 %_dev.xml: %.xml
91         sed '/DOCTYPE/s,simgrid.dtd,http://simgrid.gforge.inria.fr/&,' $< > $@
92
93 $(FLAVOURED_LOBA):
94         $(MAKE) clean
95         $(MAKE) SIMGRID_INSTALL_DIR=./simgrid-$(patsubst loba-%,%,$@) loba
96         mv -f -- loba $@
97         $(MAKE) clean
98
99 misc_autogen.h: $(SIMGRID_INSTALL_DIR)/include/xbt/log.h
100         grep -C1 '# *define *CLOG' $< \
101         | sed 's/CLOG/XCLOG/;s/_XBT_LOGV\(([^)]*)\)/(*\1)/' > $@
102
103 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
104
105 ifeq ($(filter $(MAKECMDGOALS),full clean realclean $(FLAVOURED_LOBA)),)
106   $(shell ./setlocalversion)
107   -include $(DEP)
108 endif
109
110 .SECONDEXPANSION:
111 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
112         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@