Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 130 | f9daq | 1 | # Makefile tutorial: https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents  | 
        
| 2 | |||
| 3 | # Make variables ----------------------------------------------------  | 
        ||
| 4 | |||
| 5 | # ROOT include and libraries  | 
        ||
| 6 | ROOTINC=$(shell root-config --incdir)  | 
        ||
| 7 | ROOTLIB=$(shell root-config --libs)  | 
        ||
| 8 | GRROOTLIB=$(shell root-config --cflags --glibs)  | 
        ||
| 9 | |||
| 10 | # Source and debug directories  | 
        ||
| 11 | SRC=./src  | 
        ||
| 12 | DBG=./dbg  | 
        ||
| 13 | IDIR=./include  | 
        ||
| 14 | BIN=./bin  | 
        ||
| 15 | DICT=./dict  | 
        ||
| 16 | LDIR=./lib  | 
        ||
| 17 | |||
| 18 | # Includes and libraries  | 
        ||
| 19 | INC=-I. -I$(ROOTINC)  | 
        ||
| 20 | LIBS=$(ROOTLIB) -L. -lm  | 
        ||
| 21 | |||
| 22 | |||
| 23 | # Specific variables for the main program  | 
        ||
| 24 | TARGET=root_app  | 
        ||
| 25 | FILES=$(SRC)/root_app.C  | 
        ||
| 26 | HEADER=$(IDIR)/root_app.h $(IDIR)/root_include.h  | 
        ||
| 27 | |||
| 28 | # -------------------------------------------------------------------  | 
        ||
| 29 | |||
| 30 | # Base rules --------------------------------------------------------  | 
        ||
| 31 | |||
| 32 | # Make the main program and libraries  | 
        ||
| 33 | #all: libtest.so $(TARGET)  | 
        ||
| 34 | all: $(TARGET)  | 
        ||
| 35 | |||
| 36 | # Rules for making the main program  | 
        ||
| 37 | $(TARGET): $(FILES)  | 
        ||
| 38 | @echo "\n# Generating dictionary GuiDict.C ---------------------------"  | 
        ||
| 39 | rootcint -f $(DICT)/GuiDict.C -c -p $(INC) $(CPPFLAGS) $(IDIR)/root_app.h $(DICT)/GuiLinkDef.h  | 
        ||
| 40 | @echo "\n# Checking to see if bin directory already exists -----------"  | 
        ||
| 41 | if [ ! -d "$(BIN)" ];then mkdir $(BIN); fi  | 
        ||
| 42 | @echo "\n# Compiling main program ------------------------------------"  | 
        ||
| 43 | $(CXX) $(INC) -fPIC -g -Wall $(FILES) $(DICT)/GuiDict.C $(CPPFLAGS) -o ./bin/$(TARGET) $(GRROOTLIB) -lstdc++  | 
        ||
| 44 | cp -f ./input/start.sh ./  | 
        ||
| 45 | @echo "\n# Compilation successful ------------------------------------"  | 
        ||
| 46 | @echo "# Use ./start.sh to run the program -------------------------"  | 
        ||
| 47 | |||
| 48 | # -------------------------------------------------------------------  | 
        ||
| 49 | |||
| 50 | # Cleaning rules ----------------------------------------------------  | 
        ||
| 51 | |||
| 52 | # Rules for cleaning the installation  | 
        ||
| 53 | clean:  | 
        ||
| 54 | @echo "# Cleaning the installation directory -------------------------"  | 
        ||
| 55 | rm -fr $(DICT)/*Dict.C $(DICT)/*Dict.h ./bin ./lib start.sh $(SRC)/$(TARGET)_C.d $(SRC)/$(TARGET)_C.so *.o  | 
        ||
| 56 | |||
| 57 | # -------------------------------------------------------------------  |