[How to compile GEANT3 programs on Mac OS X]

An example Makefile for compiling a GEANT3 program on Mac OS X

Original Makefile by Hiro Watanabe (KEK), list of libraries given by Jon Nix (Chicago).


# =================================
#       Makefile skelton
# =================================

#PACK = /cern/pro/lib
PACK = $(CERN_ROOT)/lib

# ///////////////////////////////////////////
#       Source, Product Information
# ///////////////////////////////////////////

# The name of EXECUTABLE PROGRAM
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PROGRAM_INT = ../run/int_exam.exe
PROGRAM_BAT = ../run/bat_exam.exe

# The PROGRAM is made from follows
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OBJECTS = guhadr.o gukine.o guout.o guphad.o gustep.o \
          gutrev.o gxphys.o ufiles.o ugeom.o uginit.o \
          uglast.o uhinit.o


#          $(PACK)/liblapack3.a \
#          $(PACK)/libblas.a \
# Flags given to C compiler in front of SOURCE FILE
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CFLAGSF =

# Flags given to C compiler after SOURCE FILE
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CFLAGSB = 

# Flags given to G77 compiler in front of SOURCE FILE
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#FFLAGSF =  -O2 -I/cern/pro/include
FFLAGSF = -O2 -l$(CERN_ROOT)/include

# Flags given to G77 compiler after SOURCE FILE
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FFLAGSB =

# C compiler is next one
# ~~~~~~~~~~~~~~~~~~~~~~
CCOMPIL =

# FORTRAN compiler is next one
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
F77COMP = g77

# And finaly PROGRAM is producted by LINKER, next is as LINKER
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LINKING = g77

# Linking Flags
# ~~~~~~~~~~~~~
LFLAGSF =  -O2
### for Mac OS X using Fink ###
LFLAGSB = -L$(PACK) \
        -lgeant321 -lpawlib -lgraflib -lgrafX11 \
        -lpacklib -lmathlib -lkernlib -lphtools  \
        -llapack -lf77blas -lgsl -latlas \
        -L/usr/X11R6/lib -lX11 \
        -L/usr/lib/ -lcrypto -ldl

### For Linux ###
#LFLAGSB = -L$(CERN_ROOT)/lib \
#        -lgeant321 -lpawlib -lgraflib -lgrafX11 \
#        -lpacklib -lmathlib -lkernlib \
#        -llapack3 -lblas \
#        -L/usr/X11R6/lib -lX11 -lcrypt -lnsl -ldl

# ////////////////////////
#       Procedure             Don't touch if you don't know what this is!
# ////////////////////////

.cc.o:
        $(CCOMPIL) $(CFLAGSF) -c $< $(CFLAGSB)

.f.o:
        $(F77COMP) $(FFLAGSF) -c $< $(FFLAGSB)

.F.o:
        $(F77COMP) $(FFLAGSF) -c $< $(FFLAGSB)

all: $(PROGRAM_INT) $(PROGRAM_BAT)

$(PROGRAM_INT) : gxint.o $(OBJECTS)
        $(LINKING) -o $(PROGRAM_INT) $(LFLAGSF) gxint.o $(OBJECTS) $(LFLAGSB)

$(PROGRAM_BAT) : main.o $(OBJECTS)
        $(LINKING) -o $(PROGRAM_BAT) $(LFLAGSF) main.o $(OBJECTS) $(LFLAGSB)

clean:
        rm -rf *.o $(PROGRAM_INT) $(PROGRAM_BAT)

clear:
        rm -rf *~

# //////////////////////////////
#       File Relations
# //////////////////////////////

# Syntax is like this:
# [ { object-file } : { souce-file source-file (header-file etc.) ....} ]
*.o     : geant_cmn.F



	

2005-06-25 Taku