1 #SIMGRID_INSTALL_DIR ?= $(PWD)/simgrid-stable
2 SIMGRID_INSTALL_DIR ?= $(PWD)/simgrid-dev
4 OPTIM_FLAGS += -pipe -O3
7 CHECK_FLAGS += -Wall -Wextra
12 CPPFLAGS += -I $(SIMGRID_INSTALL_DIR)/include
13 CPPFLAGS += $(CHECK_FLAGS)
16 #CFLAGS += -fgnu89-inline # workaround simgrid bug
17 CFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
19 CXXFLAGS += -std=c++11
20 CXXFLAGS += $(OPTIM_FLAGS) $(DEBUG_FLAGS)
22 LDFLAGS += -L $(SIMGRID_INSTALL_DIR)/lib
23 LDFLAGS += -Wl,-rpath,$(SIMGRID_INSTALL_DIR)/lib
25 LINK.o = $(CXX) $(CXXFLAGS) $(LDFLAGS) $(TARGET_ARCH)
26 LDLIBS := -lsimgrid -lrt
28 MAKEDEPEND.FLAGS = $(CPPFLAGS) -MM -MG -MF $@ $<
29 MAKEDEPEND.C = $(CC) $(CFLAGS) $(MAKEDEPEND.FLAGS)
30 MAKEDEPEND.CXX = $(CXX) $(CXXFLAGS) $(MAKEDEPEND.FLAGS)
32 SRC.loba := main.cpp \
37 $(wildcard loba_*.cpp) \
47 OBJ := $(SRC:%.cpp=%.o)
48 DEP := $(SRC:%.cpp=.%.d)
50 DEFAULT_TARGETS := loba
51 FLAVOURED_LOBA := loba-dev loba-stable
52 TARGETS := $(DEFAULT_TARGETS)
54 .PHONY: all full clean realclean $(FLAVOURED_LOBA)
56 all: $(DEFAULT_TARGETS)
59 @for target in $(FLAVOURED_LOBA); do \
60 echo $(MAKE) "$$target"; \
63 $(MAKE) $(DEFAULT_TARGETS)
66 $(RM) core core.[0-9]* vgcore.[0-9]*
73 $(RM) $(FLAVOURED_LOBA)
76 .%.d: %.c ; $(MAKEDEPEND.C)
78 .%.d: %.cpp ; $(MAKEDEPEND.CXX)
82 $(MAKE) SIMGRID_INSTALL_DIR=$(PWD)/simgrid-$(patsubst loba-%,%,$@) loba
86 version.o: $(patsubst %.cpp,%.o,$(filter-out version.cpp, $(SRC.loba)))
88 ifeq ($(filter $(MAKECMDGOALS),full clean realclean $(FLAVOURED_LOBA)),)
89 $(shell ./setlocalversion)
94 $(TARGETS): $$(patsubst %.cpp,%.o,$$(SRC.$$@))
95 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@