Subversion Repositories f9daq

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

# Makefile tutorial: https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents
 
# Make variables ----------------------------------------------------

# ROOT include and libraries
ROOTINC=$(shell root-config --incdir)
ROOTLIB=$(shell root-config --libs)
GRROOTLIB=$(shell root-config --cflags --glibs)

# Source and debug directories
SRC=./src
DBG=./dbg
IDIR=./include
BIN=./bin
DICT=./dict
LDIR=./lib

# Includes and libraries
INC=-I. -I$(ROOTINC)
LIBS=$(ROOTLIB) -L. -lm


# Specific variables for the main program
TARGET=root_app
FILES=$(SRC)/root_app.C
HEADER=$(IDIR)/root_app.h $(IDIR)/root_include.h

# -------------------------------------------------------------------

# Base rules --------------------------------------------------------

# Make the main program and libraries
#all: libtest.so $(TARGET) 
all: $(TARGET)

# Rules for making the main program
$(TARGET): $(FILES)
        @echo "\n# Generating dictionary GuiDict.C ---------------------------"
        rootcint -f $(DICT)/GuiDict.C -c -p $(INC) $(CPPFLAGS) $(IDIR)/root_app.h $(DICT)/GuiLinkDef.h
        @echo "\n# Checking to see if bin directory already exists -----------"
        if [ ! -d "$(BIN)" ];then  mkdir $(BIN);  fi
        @echo "\n# Compiling main program ------------------------------------"
        $(CXX) $(INC) -fPIC -g -Wall $(FILES) $(DICT)/GuiDict.C $(CPPFLAGS) -o ./bin/$(TARGET) $(GRROOTLIB) -lstdc++
        cp -f ./input/start.sh ./
        @echo "\n# Compilation successful ------------------------------------"
        @echo "# Use ./start.sh to run the program -------------------------"

# -------------------------------------------------------------------

# Cleaning rules ----------------------------------------------------

# Rules for cleaning the installation
clean:
        @echo "# Cleaning the installation directory -------------------------"
        rm -fr $(DICT)/*Dict.C $(DICT)/*Dict.h ./bin ./lib start.sh $(SRC)/$(TARGET)_C.d $(SRC)/$(TARGET)_C.so *.o

# -------------------------------------------------------------------