export CERN=$(shell pwd) ifdef CERNLIB_VERSION export CERN_LEVEL=$(CERNLIB_VERSION) else export CERN_LEVEL=2006 endif export CERN_ROOT=$(CERN)/$(CERN_LEVEL) export CVSCOSRC=$(CERN_ROOT)/src export PATH:=$(CERN_ROOT)/bin:$(PATH) WHICH_GFORTRAN = $(shell which gfortran) ifneq (,$(findstring gfortran,$(WHICH_GFORTRAN))) FC=gfortran PATCH_PACKLIB = $(shell $(BUILD_SCRIPTS)/patches/cernlib/packlib_patch.pl) else FC=g77 PATCH_PACKLIB = false endif UBUNTU_MARKER := $(shell ls /etc/lsb-release) all: info make_cernlib make_links final_patches info: @echo FC = $(FC) @echo PATCH_PACKLIB = $(PATCH_PACKLIB) @echo WHICH_GFORTRAN = $(WHICH_GFORTRAN) $(CERN_ROOT)/.untar_src_done: $(CERN_LEVEL)_src.tar.gz tar zxf $< date > $@ $(CERN_ROOT)/.untar_include_done: include.tar.gz tar zxf $< date > $@ make_cernlib: $(CERN_ROOT)/build/scripts/install.bin $(MAKE) -C$(CERN_ROOT)/build FC=$(FC) $(CERN_ROOT)/build/scripts/Makefile: $(MAKE) -C$(CERN_ROOT)/build scripts/Makefile make_links: ifneq ($(UBUNTU_MARKER),/etc/lsb-release) cd $(CERN_ROOT)/lib ; test -L libblas.a || ln -s /usr/lib/libblas.a libblas.a cd $(CERN_ROOT)/lib ; test -L liblapack3.a || ln -s /usr/lib/liblapack.a liblapack3.a else cd $(CERN_ROOT)/lib ; test -L libblas.a || ln -s /usr/lib/atlas-base/atlas/libblas.a libblas.a cd $(CERN_ROOT)/lib ; test -L liblapack3.a || ln -s /usr/lib/atlas-base/atlas/liblapack.a liblapack3.a endif %.tar.gz: wget http://cernlib.web.cern.ch/cernlib/download/${CERN_LEVEL}_source/tar/$@ $(CERN_ROOT)/cernlib_patch_file.txt: cat $(BUILD_SCRIPTS)/patches/cernlib/*.txt > $@ $(CERN_ROOT)/.patch_done: $(CERN_ROOT)/.untar_src_done $(CERN_ROOT)/.untar_include_done $(CERN_ROOT)/cernlib_patch_file.txt cd $(CERN_ROOT); patch -p1 < $(CERN_ROOT)/cernlib_patch_file.txt date > $@ $(CERN_ROOT)/.dirs_done: cd $(CERN_ROOT); mkdir -p build bin lib date > $@ $(CERN_ROOT)/.imake_boot_done: $(CERN_ROOT)/.patch_done $(CERN_ROOT)/.dirs_done cd $(CERN_ROOT)/build; $(CVSCOSRC)/config/imake_boot date > $@ $(CERN_ROOT)/bin/kuipc: $(CERN_ROOT)/.imake_boot_done $(MAKE) -C$(CERN_ROOT)/build bin/kuipc $(CERN_ROOT)/scripts/Makefile: $(CERN_ROOT)/bin/kuipc $(MAKE) -C$(CERN_ROOT)/build scripts/Makefile $(CERN_ROOT)/build/scripts/install.bin: $(CERN_ROOT)/scripts/Makefile $(MAKE) -C$(CERN_ROOT)/build/scripts install.bin final_patches: $(CERN_ROOT)/.packlib_patch_done $(CERN_ROOT)/.packlib_patch_done: gcc -c $(BUILD_SCRIPTS)/patches/cernlib/lshift.c ar rv $(CERN_ROOT)/lib/libpacklib.a lshift.o date > $@