# Makefile for the ROOT test programs.
# This Makefile shows nicely how to compile and link applications
# using the ROOT libraries on all supported platforms.
#
# Copyright (c) 2000 Rene Brun and Fons Rademakers
#
# Author: Fons Rademakers, 29/2/2000

include Makefile.arch

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


BINDATAO        = BinData.$(ObjSuf) bindict.$(ObjSuf) ExpBin.$(ObjSuf) ExpJob.$(ObjSuf) fft.$(ObjSuf) 
BINDATAS        = BinData.$(SrcSuf) bindict.$(SrcSuf) ExpBin.$(SrcSuf) ExpJob.$(SrcSuf) fft.$(SrcSuf) 
BINDATASO       = BinData.$(DllSuf)


OBJS          = $(BINDATAO)
PROGRAMS      = $(BINDATASO)

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

.SUFFIXES: .$(SrcSuf) .$(ObjSuf) .$(DllSuf)
.PHONY:    BinData

all:            $(PROGRAMS)

BinData:          $(BINDATASO)
$(BINDATASO):     $(BINDATAO)
ifeq ($(ARCH),aix)
		/usr/ibmcxx/bin/makeC++SharedLib $(OutPutOpt) $@ $(LIBS) -p 0 $^
else
ifeq ($(ARCH),aix5)
		/usr/vacpp/bin/makeC++SharedLib $(OutPutOpt) $@ $(LIBS) -p 0 $^
else
ifeq ($(PLATFORM),macosx)
# We need to make both the .dylib and the .so
		$(LD) $(SOFLAGS) $^ $(OutPutOpt) $@
		$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ \
		   $(OutPutOpt) $(subst .$(DllSuf),.so,$@)
else
		$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(EXPLLINKLIBS) $(OutPutOpt)$@
endif
endif
endif


clean:
		@rm -f $(OBJS) core

distclean:      clean
		@rm -f $(PROGRAMS) $(EVENTSO) $(EVENTLIB) *Dict.* *.def *.exp \
		   *.root *.ps *.so *.lib *.dll *.d .def so_locations
		@rm -rf cxx_repository
		-@cd RootShower && $(MAKE) distclean

.SUFFIXES: .$(SrcSuf)

###


bindict.$(SrcSuf): ExpJob.h ExpBin.h LinkDef.h
	@echo "Generating dictionary $@..."
	@rootcint -f $@ -c $^


%.$(ObjSuf):%.$(SrcSuf)
	$(CXX) $(CXXFLAGS) -c $<
