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

Private GIT Repository
Add default auto_depl::topology...
[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 CHECK_FLAGS += -Wall -Wextra
7
8 CC := gcc
9 CXX := g++
10
11 CPPFLAGS += -I $(SIMGRID_INSTALL_DIR)/include
12 CPPFLAGS += $(CHECK_FLAGS)
13
14 CFLAGS += -std=c99
15 #CFLAGS += -fgnu89-inline       # workaround simgrid bug
16 CFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
17
18 #CXXFLAGS += -std=c++0x
19 CXXFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
20
21 LDFLAGS += -L $(SIMGRID_INSTALL_DIR)/lib
22 LDFLAGS += -Wl,-rpath,$(SIMGRID_INSTALL_DIR)/lib
23
24 LINK.o = $(CXX) $(LDFLAGS) $(TARGET_ARCH)
25 LDLIBS := -lsimgrid
26
27 MAKEDEPEND.FLAGS =  $(CPPFLAGS) -MM -MF $@ $<
28 MAKEDEPEND.C = $(CC) $(MAKEDEPEND.FLAGS)
29 MAKEDEPEND.CXX = $(CXX) $(MAKEDEPEND.FLAGS)
30
31 LOCALVERSION := localversion
32 SETLOCALVERSION := ./setlocalversion
33
34 SRC.loba := main.cpp            \
35         communicator.cpp        \
36         cost_func.cpp           \
37         deployment.cpp          \
38         hostdata.cpp            \
39         $(wildcard loba_*.cpp)  \
40         misc.cpp                \
41         neighbor.cpp            \
42         options.cpp             \
43         process.cpp             \
44         version.cpp
45
46 SRC.simple_async := simple_async.cpp
47
48 SRC := $(SRC.loba) $(SRC.simple_async)
49 OBJ := $(SRC:%.cpp=%.o)
50 DEP := $(SRC:%.cpp=%.d)
51
52 TARGETS := loba simple_async
53
54 $(shell $(SETLOCALVERSION))
55
56 .PHONY: all clean realclean
57
58 all: $(TARGETS)
59
60 clean:
61         $(RM) core core.[0-9]* vgcore.[0-9]*
62         $(RM) $(LOCALVERSION)
63         $(RM) $(OBJ)
64         $(RM) $(DEP)
65         $(RM) $(TARGETS)
66
67 realclean: clean
68         $(RM) *~
69
70 %.d: %.c ; $(MAKEDEPEND.C)
71 %.d: %.cpp ; $(MAKEDEPEND.CXX)
72
73 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
74
75 ifneq ($(MAKECMDGOALS),clean)
76 ifneq ($(MAKECMDGOALS),realclean)
77 -include $(DEP)
78 endif
79 endif
80
81 .SECONDEXPANSION:
82 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
83         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@