INC_DIR = ./src BUILD_DIR = ./build CC=g++ CFLAGS=-c -Wall `root-config --cflags --libs` -lMinuit --std=c++0x -O2 -g -I$(INC_DIR) -Wno-reorder SOURCES := $(shell find ./src $(SOURCEDIR) -name '*.cpp') OBJECTSTMP=$(SOURCES:.cpp=.o) OBJECTS=$(subst $(INC_DIR),$(BUILD_DIR),$(OBJECTSTMP)) EXECUTABLE=saffron all: dir $(SOURCES) $(EXECUTABLE) dir: mkdir -p $(BUILD_DIR) $(EXECUTABLE): $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $@ `root-config --cflags --libs` -lMinuit $(BUILD_DIR)/%.o: $(INC_DIR)/%.cpp; mkdir -p $(@D) $(CC) $(CFLAGS) $< -o $@ clean: rm -f $(OBJECTS) $(OBJECTSTMP)