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

Private GIT Repository
Fix an error about misc_autogen.h that is not found.
[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 -MG -MF $@ $<
28 MAKEDEPEND.C = $(CC) $(MAKEDEPEND.FLAGS)
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         version.cpp
42
43 SRC.simple_async := simple_async.cpp
44
45 SRC := $(SRC.loba) $(SRC.simple_async)
46 OBJ := $(SRC:%.cpp=%.o)
47 DEP := $(SRC:%.cpp=%.d)
48
49 TARGETS := loba simple_async
50
51 .PHONY: all clean realclean
52
53 all: $(TARGETS)
54
55 clean:
56         $(RM) core core.[0-9]* vgcore.[0-9]*
57         $(RM) misc_autogen.h
58         $(RM) localversion
59         $(RM) $(OBJ)
60         $(RM) $(DEP)
61         $(RM) $(TARGETS)
62
63 realclean: clean
64         $(RM) *~
65
66 %.d: %.c ; $(MAKEDEPEND.C)
67 %.d: %.cpp ; $(MAKEDEPEND.CXX)
68
69 misc_autogen.h: $(SIMGRID_INSTALL_DIR)/include/xbt/log.h
70         grep -C1 '# *define *CLOG' $< \
71         | sed 's/CLOG/XCLOG/;s/_XBT_LOGV\(([^)]*)\)/(*\1)/' > $@
72
73 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
74
75 ifneq ($(MAKECMDGOALS),clean)
76   ifneq ($(MAKECMDGOALS),realclean)
77     $(shell ./setlocalversion)
78     -include $(DEP)
79   endif
80 endif
81
82 .SECONDEXPANSION:
83 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
84         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@