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

Private GIT Repository
Improve help messages.
[loba.git] / Makefile
1 #SIMGRID_INSTALL_DIR ?= $(PWD)/simgrid-stable
2 SIMGRID_INSTALL_DIR ?= $(PWD)/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         messages.cpp            \
38         misc.cpp                \
39         msg_thread.cpp          \
40         neighbor.cpp            \
41         options.cpp             \
42         process.cpp             \
43         version.cpp
44
45 SRC := $(SRC.loba)
46 OBJ := $(SRC:%.cpp=%.o)
47 DEP := $(SRC:%.cpp=.%.d)
48
49 DEFAULT_TARGETS := loba
50 FLAVOURED_LOBA := loba-dev loba-stable
51 TARGETS := $(DEFAULT_TARGETS)
52
53 .PHONY: all full clean realclean $(FLAVOURED_LOBA)
54
55 all: $(DEFAULT_TARGETS)
56
57 full:
58         @for target in $(FLAVOURED_LOBA); do    \
59                 echo $(MAKE) "$$target";        \
60                 $(MAKE) "$$target";             \
61         done
62         $(MAKE) xml $(DEFAULT_TARGETS)
63
64 clean:
65         $(RM) core core.[0-9]* vgcore.[0-9]*
66         $(RM) localversion
67         $(RM) $(OBJ)
68         $(RM) $(DEP)
69         $(RM) $(TARGETS)
70
71 realclean: clean
72         $(RM) $(FLAVOURED_LOBA)
73         $(RM) $(XML_DEV_FILES)
74         $(RM) *~
75
76 .%.d: %.cpp ; $(MAKEDEPEND.CXX)
77
78 $(FLAVOURED_LOBA):
79         $(MAKE) clean
80         $(MAKE) SIMGRID_INSTALL_DIR=$(PWD)/simgrid-$(patsubst loba-%,%,$@) loba
81         mv -f -- loba $@
82         $(MAKE) clean
83
84 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
85
86 ifeq ($(filter $(MAKECMDGOALS),full clean realclean $(FLAVOURED_LOBA)),)
87   $(shell ./setlocalversion)
88   -include $(DEP)
89 endif
90
91 .SECONDEXPANSION:
92 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
93         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@