version 1.1, 2003/12/16 13:39:53
|
version 1.5, 2004/02/26 22:05:17
|
|
|
## This makefile must be executed with gmake (gnu make). | ## This makefile must be executed with gmake (gnu make). |
| |
|
#set to g77 or absoft to choose a compiler under linux |
|
LINUX_COMPILER=g77 |
|
|
simcdir = . | simcdir = . |
CERN_ROOT = /site/cernlib/pc_linux/99 |
#CERN_ROOT = /site/cernlib/pc_linux/99 |
|
#CERN_ROOT = /cern/pro |
export ABSOFT=/apps/absoft/PRO/usr/absoft | export ABSOFT=/apps/absoft/PRO/usr/absoft |
| |
RM = rm -f | RM = rm -f |
|
|
transp.o musc.o musc_ext.o \ | transp.o musc.o musc_ext.o \ |
stringlib.o ranecu.o loren.o \ | stringlib.o ranecu.o loren.o \ |
locforunt.o gauss1.o mt19937.o \ | locforunt.o gauss1.o mt19937.o \ |
trg_track.o gen_track.o hms_track.o \ |
trg_track.o hms_track.o \ |
electron_trans.o qfs_new9_sub.o init.o \ |
qfs_new11_sub.o init.o \ |
brem.o radc.o hcf2r.o |
brem.o radc.o hcf2r.o \ |
|
hallc2h.o |
| |
MYOS := $(subst -,,$(shell uname)) | MYOS := $(subst -,,$(shell uname)) |
CERNLIBS = -lgeant$(GEANTVER) -lpawlib -lgraflib -lgrafX11 -lpacklib -lmathlib | CERNLIBS = -lgeant$(GEANTVER) -lpawlib -lgraflib -lgrafX11 -lpacklib -lmathlib |
|
|
OTHERLIBS = -L$(CERN_ROOT)/lib -lpacklib $(CERNLIBS) | OTHERLIBS = -L$(CERN_ROOT)/lib -lpacklib $(CERNLIBS) |
endif | endif |
| |
|
|
ifeq ($(MYOS),Linux) |
|
FABSFLAGS=-O -V -W -f -s -N1 -B108 -B100 -N90 -N22 -N2 -N113 |
|
INCLUDES=-I$(Csoft)/SRC/INCLUDE |
|
EXTRAFLAGS=-DABSOFTFORTRAN |
|
FFLAGS= $(INCLUDES) $(FABSFLAGS) $(EXTRAFLAGS) |
|
FFLAG1=$(FFLAGS) -c |
|
OTHERLIBS = -L$(CERN_ROOT)/lib $(CERNLIBS) -lV77 -lU77 -lg2c -lc -lm |
|
FC := $(ABSOFT)/bin/f77 |
|
F77 := $(ABSOFT)/bin/f77 |
|
endif |
|
|
|
ifeq ($(MYOS),SunOS) | ifeq ($(MYOS),SunOS) |
CERN_ROOT = /site/cernlib/sun4_solaris2/97a | CERN_ROOT = /site/cernlib/sun4_solaris2/97a |
FFLAGS=-g -e -I$(Csoft)/SRC/INCLUDE | FFLAGS=-g -e -I$(Csoft)/SRC/INCLUDE |
|
|
-lpacklib $(CERNLIBS) -Wl,-L/usr/lib/X11R5 -lX11 -lm | -lpacklib $(CERNLIBS) -Wl,-L/usr/lib/X11R5 -lX11 -lm |
endif | endif |
| |
|
ifeq ($(MYOS),Linux) |
|
ifeq ($(LINUX_COMPILER),absoft) |
|
FABSFLAGS=-V -W -f -s -N1 -B108 -B100 -N90 -N22 -N2 -N113 |
|
INCLUDES=-I$(Csoft)/SRC/INCLUDE |
|
EXTRAFLAGS=-DABSOFTFORTRAN |
|
FFLAGS=-O $(INCLUDES) $(FABSFLAGS) $(EXTRAFLAGS) |
|
FFLAG1=$(FFLAGS) -c |
|
OTHERLIBS = -L$(CERN_ROOT)/lib $(CERNLIBS) -lV77 -lU77 -lg2c -lc -lm |
|
FC := $(ABSOFT)/bin/f77 |
|
F77 := $(ABSOFT)/bin/f77 |
|
endif |
|
ifeq ($(LINUX_COMPILER),g77) |
|
FC=g77 |
|
F77=g77 |
|
FFLAGS=-O6 -I. -ffixed-line-length-none |
|
OTHERLIBS=-L$(CERN_ROOT)/lib -lpacklib -lmathlib -lnss_nis |
|
endif |
|
endif |
|
|
%.o: %.f | %.o: %.f |
$(F77) $(FFLAGS) -c $< -o $@ | $(F77) $(FFLAGS) -c $< -o $@ |
| |
mc_hms_single: $(my_objs) Makefile mc_hms_single.o | mc_hms_single: $(my_objs) Makefile mc_hms_single.o |
$(F77) -o $@ $(FFLAGS) mc_hms_single.o $(my_objs) $(OTHERLIBS) | $(F77) -o $@ $(FFLAGS) mc_hms_single.o $(my_objs) $(OTHERLIBS) |
| |
|
debug: $(my_objs) Makefile mc_hms_single.o |
|
$(F77) -g -o mc_hms_single $(FFLAGS) mc_hms_single.o $(my_objs) $(OTHERLIBS) |
|
|
clean: | clean: |
# rm -f *.o $(SPEC)*.o $(SHARE)*.o mc_hms_single |
find . -name '*.o' -exec rm {} \; |
rm -f *.o $(SPEC)*.o $(SHARE)*.o |
find . -name '*.d' -exec rm {} \; |
|
rm -f mc_hms_single debug |
|
|
|
#the rule below updates a file, Makefile.dep, that lists which include files |
|
#each fortran file uses. If an include file is changed, all the fortran files |
|
#that use it will automatically be recompiled. p.mckee dec03 |
|
Makefile.dep : *.inc gen_constants.par |
|
@ echo "Updating dependencies on include files" |
|
@ echo -e "#specify include files used by each .f file\n" > Makefile.dep |
|
@ for file in `ls *.f | sed 's/\.f//'` ; do\ |
|
inc_files=`cat $$file.f | sed -n 's/^[[:blank:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ ]*['\''"]\(.*\)['\''"]/\1/p' | sort | uniq | xargs echo -n` ;\ |
|
if [ -n "$$inc_files" ]; then \ |
|
echo "$$file.o : $$file.f $$inc_files" >> Makefile.dep;\ |
|
fi;\ |
|
done |
|
|
|
include Makefile.dep |