61 lines
1.5 KiB
Makefile
61 lines
1.5 KiB
Makefile
#---------------------------------------------------
|
|
# get compilation flags from root-config
|
|
|
|
ROOTCFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags)
|
|
|
|
#---------------------------------------------------
|
|
|
|
OS = LINUX
|
|
CXX = g++
|
|
CXXFLAGS = -O3 -Wall -Wno-trigraphs -fPIC
|
|
LOCALINCLUDE = .
|
|
ROOTINCLUDE = $(ROOTSYS)/include
|
|
INCLUDES = -I$(LOCALINCLUDE) -I$(ROOTINCLUDE)
|
|
LD = g++
|
|
LDFLAGS =
|
|
SOFLAGS = -O -shared
|
|
|
|
# the output from the root-config script:
|
|
CXXFLAGS += $(ROOTCFLAGS)
|
|
LDFLAGS +=
|
|
|
|
# some definitions: headers (used to generate *Dict* stuff), sources, objects,...
|
|
OBJS =
|
|
OBJS += TMyFunction.o TMyLibraryDict.o
|
|
|
|
SHLIB = libTMyLibrary.so
|
|
|
|
# make the shared lib:
|
|
#
|
|
all: $(SHLIB)
|
|
|
|
$(SHLIB): $(OBJS)
|
|
@echo "---> Building shared library $(SHLIB) ..."
|
|
/bin/rm -f $(SHLIB)
|
|
$(LD) $(OBJS) $(SOFLAGS) -o $(SHLIB)
|
|
@echo "done"
|
|
|
|
# clean up: remove all object file (and core files)
|
|
# semicolon needed to tell make there is no source
|
|
# for this target!
|
|
#
|
|
clean:; @rm -f $(OBJS) *Dict* core*
|
|
@echo "---> removing $(OBJS)"
|
|
|
|
#
|
|
$(OBJS): %.o: %.cpp
|
|
$(CXX) $(INCLUDES) $(CXXFLAGS) -c $<
|
|
|
|
# Generate the ROOT CINT dictionary
|
|
|
|
TMyLibraryDict.cpp: TMyFunction.h TMyLibraryLinkDef.h
|
|
@echo "Generating dictionary $@..."
|
|
rootcint -f $@ -c -p -I$(ROOTINCLUDE) $^
|
|
|
|
install: all
|
|
@echo "Installing shared lib: libTApproximation.so"
|
|
ifeq ($(OS),LINUX)
|
|
cp -pv $(SHLIB) $(ROOTSYS)/lib
|
|
cp -pv $(LOCALINCLUDE)/*.h $(ROOTSYS)/include
|
|
endif
|