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

Private GIT Repository
Update .gitignore.
[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 += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
19
20 LDFLAGS += -L $(SIMGRID_INSTALL_DIR)/lib
21 LDFLAGS += -Wl,-rpath,$(SIMGRID_INSTALL_DIR)/lib
22
23 LINK.o = $(CXX) $(LDFLAGS) $(TARGET_ARCH)
24 LDLIBS := -lsimgrid
25
26 MAKEDEPEND.FLAGS =  $(CPPFLAGS) -MM -MF $@ $<
27 MAKEDEPEND.C = $(CC) $(MAKEDEPEND.FLAGS)
28 MAKEDEPEND.CXX = $(CXX) $(MAKEDEPEND.FLAGS)
29
30 LOCALVERSION := localversion
31 SETLOCALVERSION := ./setlocalversion
32
33 SRC.loba := main.cpp            \
34         communicator.cpp        \
35         cost_func.cpp           \
36         deployment.cpp          \
37         hostdata.cpp            \
38         $(wildcard loba_*.cpp)  \
39         misc.cpp                \
40         neighbor.cpp            \
41         options.cpp             \
42         process.cpp             \
43         version.cpp
44
45 SRC.simple_async := simple_async.cpp
46
47 SRC := $(SRC.loba) $(SRC.simple_async)
48 OBJ := $(SRC:%.cpp=%.o)
49 DEP := $(SRC:%.cpp=%.d)
50
51 TARGETS := loba simple_async
52
53 $(shell $(SETLOCALVERSION))
54
55 .PHONY: all depend clean
56
57 all: $(TARGETS)
58
59 clean:
60         $(RM) core core.[0-9]* vgcore.[0-9]*
61         $(RM) $(LOCALVERSION)
62         $(RM) $(OBJ)
63         $(RM) $(DEP)
64         $(RM) $(TARGETS)
65
66 realclean: clean
67         $(RM) *~
68
69 %.d: %.c ; $(MAKEDEPEND.C)
70 %.d: %.cpp ; $(MAKEDEPEND.CXX)
71
72 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
73
74 -include $(DEP)
75
76 .SECONDEXPANSION:
77 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
78         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@