# Makefile for class MyClassA. # shell: gmake -f Makefile4MyClassA ARCH = $(shell root-config --arch) CXX = ObjSuf = o SrcSuf = cxx ExeSuf = DllSuf = so OutPutOpt = -o ROOTCFLAGS := $(shell root-config --cflags) ROOTLIBS := $(shell root-config --libs) ROOTGLIBS := $(shell root-config --glibs) ifeq ($(ARCH),linuxegcs) # Linux with egcs (>= RedHat 5.2) CXX = g++ CXXFLAGS = -O -Wall -fPIC LD = g++ LDFLAGS = -O SOFLAGS = -shared endif ifeq ($(ARCH),macosx) # MacOS X with cc (GNU cc 2.95.2) CXX = c++ #CXXFLAGS = -O -pipe -Wall CXXFLAGS = -g -pipe -Wall LD = c++ #LDFLAGS = -O -Xlinker -bind_at_load -flat_namespace LDFLAGS = -g -Xlinker -bind_at_load -flat_namespace # The SOFLAGS will be used to create the .dylib; the .so will # be created separately DllSuf = dylib SOFLAGS = -dynamiclib -flat_namespace -undefined suppress endif CXXFLAGS += $(ROOTCFLAGS) LIBS = $(ROOTLIBS) $(SYSLIBS) GLIBS = $(ROOTGLIBS) $(SYSLIBS) #------------------------------------------------------------------------------ MYCLASSAO = MyClassA.$(ObjSuf) MyClassADict.$(ObjSuf) MYCLASSAS = MyClassA.$(SrcSuf) MyClassADict.$(SrcSuf) MYCLASSASO = libMyClassA.$(DllSuf) OBJS = $(MYCLASSAO) PROGRAMS = $(MYCLASSASO) #------------------------------------------------------------------------------ .SUFFIXES: .$(SrcSuf) .$(ObjSuf) .$(DllSuf) all: $(PROGRAMS) $(MYCLASSASO): $(MYCLASSAO) ifeq ($(ARCH),macosx) # We need to make both the .dylib and the .so $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ $(LD) -bundle -undefined suppress -Wl,-x $(LDFLAGS) $^ \ $(OutPutOpt) $(subst .$(DllSuf),.so,$@) else $(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ endif clean: @rm -f $(OBJS) core .SUFFIXES: .$(SrcSuf) ### #MyClassA.$(ObjSuf): MyClassA.h MyClassADict.$(SrcSuf): MyClassA.h MyClassALinkDef.h @echo "Generating dictionary $@..." @rootcint -f $@ -c $^ .$(SrcSuf).$(ObjSuf): $(CXX) $(CXXFLAGS) -c $<