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

Private GIT Repository
Wip...
[loba.git] / Makefile
1 SIMGRID_INSTALL_DIR := ./simgrid-3.5-install
2
3 OPTIM_FLAGS += -O3
4 DEBUG_FLAGS += -g
5 CHECK_FLAGS += -Wall -Wextra
6
7 CC := gcc
8 CXX := g++
9
10 CPPFLAGS += -I $(SIMGRID_INSTALL_DIR)/include
11 CPPFLAGS += $(CHECK_FLAGS)
12
13 CFLAGS += -std=c99
14 CFLAGS += -fgnu89-inline        # workaround simgrid bug
15 CFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
16
17 CXXFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
18
19 LDFLAGS += -L $(SIMGRID_INSTALL_DIR)/lib
20 LDFLAGS += -Wl,-rpath,$(SIMGRID_INSTALL_DIR)/lib
21
22 LINK.o = $(CXX) $(LDFLAGS) $(TARGET_ARCH)
23 LDLIBS := -lsimgrid
24
25 MAKEDEPEND.FLAGS =  $(CPPFLAGS) -MM -MF $@ $<
26 MAKEDEPEND.C = $(CC) $(MAKEDEPEND.FLAGS)
27 MAKEDEPEND.CXX = $(CXX) $(MAKEDEPEND.FLAGS)
28
29 LOCALVERSION := localversion
30 SETLOCALVERSION := ./setlocalversion
31
32 SRC.loba := main.cpp            \
33         communicator.cpp        \
34         cost_func.cpp           \
35         options.cpp             \
36         process.cpp             \
37         version.cpp
38
39 SRC.simple_async := simple_async.cpp
40
41 SRC := $(SRC.loba) $(SRC.simple_async)
42 OBJ := $(SRC:%.cpp=%.o)
43 DEP := $(SRC:%.cpp=%.d)
44
45 TARGETS := loba simple_async
46
47 $(shell $(SETLOCALVERSION))
48
49 .PHONY: all depend clean
50
51 all: $(TARGETS)
52
53 clean:
54         $(RM) core core.[0-9]* vgcore.[0-9]*
55         $(RM) $(LOCALVERSION)
56         $(RM) $(OBJ)
57         $(RM) $(DEP)
58         $(RM) $(TARGETS)
59
60 realclean: clean
61         $(RM) *~
62
63 %.d: %.c ; $(MAKEDEPEND.C)
64 %.d: %.cpp ; $(MAKEDEPEND.CXX)
65
66 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
67
68 -include $(DEP)
69
70 .SECONDEXPANSION:
71 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
72         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@