2015-01-15 13:59:12 +01:00
|
|
|
.PHONY: default
|
|
|
|
|
|
|
|
default: all .gitignore
|
|
|
|
|
2014-11-04 01:03:50 +01:00
|
|
|
# Required EZFIO version
|
|
|
|
EZFIO_VERSION=1.1
|
|
|
|
|
|
|
|
# Required IRPF90 version
|
|
|
|
IRPF90_VERSION=1.4
|
|
|
|
|
2014-04-04 00:41:43 +02:00
|
|
|
# Check if QPACKAGE_ROOT is defined
|
|
|
|
|
2014-04-03 01:50:22 +02:00
|
|
|
ifndef QPACKAGE_ROOT
|
2014-04-04 00:41:43 +02:00
|
|
|
$(info -------------------- Error --------------------)
|
|
|
|
$(info QPACKAGE_ROOT undefined. Run the setup_environment.sh script)
|
|
|
|
$(info -----------------------------------------------)
|
|
|
|
$(error )
|
2015-01-19 16:37:29 +01:00
|
|
|
else
|
|
|
|
$(info QPACKAGE_ROOT is defined.)
|
2014-04-01 18:37:27 +02:00
|
|
|
endif
|
|
|
|
|
2014-04-03 11:28:54 +02:00
|
|
|
|
2014-04-04 00:41:43 +02:00
|
|
|
# Check if the user's config exists
|
2014-04-03 11:28:54 +02:00
|
|
|
|
2014-04-04 00:41:43 +02:00
|
|
|
MAKEFILE_OK=$(shell ls $(QPACKAGE_ROOT)/src/Makefile.config 2> /dev/null && echo True || echo False)
|
|
|
|
ifeq ($(MAKEFILE_OK),False)
|
|
|
|
$(info -------------------- Error --------------------)
|
|
|
|
$(info Makefile.config is not present.)
|
|
|
|
$(info You can create Makefile.config)
|
|
|
|
$(info by modifying Makefile.config.example)
|
|
|
|
$(info -----------------------------------------------)
|
|
|
|
$(error )
|
2015-01-19 16:37:29 +01:00
|
|
|
else
|
|
|
|
$(info Makefile.config is present.)
|
2014-04-03 01:50:22 +02:00
|
|
|
endif
|
2014-04-01 18:37:27 +02:00
|
|
|
|
2014-04-04 00:41:43 +02:00
|
|
|
|
|
|
|
# Include the user's config
|
|
|
|
|
|
|
|
include $(QPACKAGE_ROOT)/src/Makefile.config
|
|
|
|
|
|
|
|
|
|
|
|
# Check the version of IRPF90
|
|
|
|
|
2014-11-04 01:03:50 +01:00
|
|
|
IRP_VERSION_OK=$(shell $(IRPF90) -v | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= $(IRPF90_VERSION)")
|
2014-04-01 18:37:27 +02:00
|
|
|
ifeq ($(IRP_VERSION_OK),False)
|
2014-04-04 00:41:43 +02:00
|
|
|
$(info -------------------- Error --------------------)
|
2014-11-04 01:03:50 +01:00
|
|
|
$(info IRPF90 version >= $(IRPF90_VERSION) is required)
|
|
|
|
$(info To upgrade IRPF90, run : )
|
|
|
|
$(info $(QPACKAGE_ROOT)/scripts/upgrade_irpf90.sh )
|
2014-04-04 00:41:43 +02:00
|
|
|
$(info -----------------------------------------------)
|
|
|
|
$(error )
|
2015-01-19 16:37:29 +01:00
|
|
|
else
|
|
|
|
$(info irpf90 version is OK.)
|
2014-04-01 18:37:27 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2014-04-11 01:53:15 +02:00
|
|
|
# Create the NEEDED_MODULES variable, needed for IRPF90
|
|
|
|
|
|
|
|
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
|
|
|
|
|
|
|
|
|
2014-04-04 00:41:43 +02:00
|
|
|
# Check if the NEEDED_MODULES file is consistent
|
|
|
|
|
|
|
|
NEEDED_MODULES_OK=$(shell X=`$(QPACKAGE_ROOT)/scripts/check_dependencies.sh $(NEEDED_MODULES)` && echo OK || echo $$X)
|
|
|
|
ifneq ($(NEEDED_MODULES_OK),OK)
|
|
|
|
$(info -------------------- Error --------------------)
|
|
|
|
$(info Your NEEDED_MODULES file is inconsistent. It should be)
|
|
|
|
$(info $(NEEDED_MODULES_OK))
|
|
|
|
$(info -----------------------------------------------)
|
|
|
|
$(error )
|
2015-01-19 16:37:29 +01:00
|
|
|
else
|
|
|
|
$(info NEEDED_MODULES files is consistent.)
|
2014-04-04 00:41:43 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# Check and update dependencies
|
|
|
|
|
|
|
|
include Makefile.depend
|
|
|
|
|
|
|
|
|
|
|
|
# Check if README.rst exists
|
|
|
|
|
|
|
|
README_RST_OK=$(shell ls README.rst 2>/dev/null || echo False)
|
|
|
|
ifeq ($(README_RST_OK), False)
|
|
|
|
$(shell $(QPACKAGE_ROOT)/scripts/create_rst_templates.sh)
|
|
|
|
$(info -------------------- Error --------------------)
|
|
|
|
$(info README.rst was not present, so I created a)
|
|
|
|
$(info default one for you.)
|
|
|
|
$(info You should document it before you compile, as)
|
|
|
|
$(info well as the ASSUMPTIONS.rst file.)
|
|
|
|
$(info -----------------------------------------------)
|
|
|
|
$(error )
|
2015-01-19 16:37:29 +01:00
|
|
|
else
|
|
|
|
$(info README.rst is present.)
|
2014-04-01 18:37:27 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2014-04-04 00:41:43 +02:00
|
|
|
# Check if ASSUMPTIONS.rst exists
|
|
|
|
|
|
|
|
ASSUMPTIONS_RST_OK=$(shell ls ASSUMPTIONS.rst || echo False)
|
|
|
|
ifeq ($(ASSUMPTIONS_RST_OK), False)
|
|
|
|
$(info -------------------- Error --------------------)
|
|
|
|
$(info This is a Bug. At that point, the ASSUMPTIONS.rst)
|
|
|
|
$(info file should exist.)
|
|
|
|
$(info -----------------------------------------------)
|
2015-01-19 16:37:29 +01:00
|
|
|
else
|
|
|
|
$(info ASSUMPTIONS.rst is present.)
|
2014-04-04 00:41:43 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2014-11-04 01:03:50 +01:00
|
|
|
# Define the Makefile common variables
|
2014-04-04 00:41:43 +02:00
|
|
|
|
2014-04-03 01:50:22 +02:00
|
|
|
EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO
|
2014-04-01 18:37:27 +02:00
|
|
|
EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a
|
2014-04-04 00:41:43 +02:00
|
|
|
INCLUDE_DIRS=$(NEEDED_MODULES) include
|
2014-04-01 18:37:27 +02:00
|
|
|
|
2014-11-04 01:03:50 +01:00
|
|
|
# Check EZFIO version
|
|
|
|
|
|
|
|
EZFIO_VERSION_OK=$(shell cat $(EZFIO_DIR)/version | cut -d '=' -f 2 | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= $(EZFIO_VERSION)")
|
|
|
|
ifeq ($(EZFIO_VERSION_OK),False)
|
|
|
|
$(info -------------------- Error --------------------)
|
|
|
|
$(info EZFIO version >= $(EZFIO_VERSION) is required )
|
|
|
|
$(info To upgrade EZFIO, run : )
|
|
|
|
$(info $(QPACKAGE_ROOT)/scripts/upgrade_ezfio.sh )
|
|
|
|
$(info -----------------------------------------------)
|
|
|
|
$(error )
|
2015-01-19 16:37:29 +01:00
|
|
|
else
|
|
|
|
$(info EZFIO version is OK.)
|
2014-11-04 01:03:50 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Define the EZFIO rules
|
|
|
|
|
2014-04-03 01:50:22 +02:00
|
|
|
$(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config)
|
2014-04-01 18:37:27 +02:00
|
|
|
@echo Building EZFIO library
|
2014-04-03 01:50:22 +02:00
|
|
|
@cp $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(EZFIO_DIR)/config
|
2014-04-01 18:37:27 +02:00
|
|
|
@cd $(EZFIO_DIR) ; export FC="$(FC)" ; export FCFLAGS="$(FCFLAGS)" ; export IRPF90="$(IRPF90)" ; $(MAKE) ; $(MAKE) Python
|
|
|
|
|
2014-08-24 20:00:26 +02:00
|
|
|
ezfio: $(EZFIO)
|
2014-04-01 18:37:27 +02:00
|
|
|
|
2014-04-04 00:41:43 +02:00
|
|
|
# Create symbolic links of other modules
|
2014-04-01 18:37:27 +02:00
|
|
|
|
2014-04-03 01:50:22 +02:00
|
|
|
ifneq ($(PWD),$(QPACKAGE_ROOT)/src)
|
|
|
|
$(shell $(QPACKAGE_ROOT)/scripts/prepare_module.sh $(INCLUDE_DIRS))
|
2014-04-01 18:37:27 +02:00
|
|
|
clean_links:
|
2014-04-03 11:19:41 +02:00
|
|
|
rm -f $(INCLUDE_DIRS) $$(basename $$PWD)
|
2014-04-01 18:37:27 +02:00
|
|
|
else
|
|
|
|
clean_links:
|
|
|
|
endif
|
|
|
|
|
|
|
|
LIB+=$(EZFIO) $(MKL)
|
2014-04-24 12:31:15 +02:00
|
|
|
IRPF90+=$(patsubst %, -I %, $(INCLUDE_DIRS)) $(IRPF90_FLAGS)
|
2014-04-01 18:37:27 +02:00
|
|
|
|
2014-05-13 13:57:58 +02:00
|
|
|
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES $(wildcard *.py)
|
2014-05-14 00:07:58 +02:00
|
|
|
- $(IRPF90)
|
|
|
|
- update_README.py
|
2014-04-03 11:28:54 +02:00
|
|
|
|
|
|
|
Makefile.depend: Makefile
|
|
|
|
$(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh
|
|
|
|
|
2015-01-11 20:28:33 +01:00
|
|
|
ifneq ( $(PWD), $($(QPACKAGE_ROOT)/src))
|
2014-04-03 11:28:54 +02:00
|
|
|
include irpf90.make
|
2015-01-11 20:28:33 +01:00
|
|
|
endif
|
2014-04-03 11:28:54 +02:00
|
|
|
|
2014-04-07 16:56:29 +02:00
|
|
|
# Dummy rule to enable to force recompilation
|
2014-04-03 11:28:54 +02:00
|
|
|
FORCE:
|
|
|
|
|
2014-06-07 22:07:50 +02:00
|
|
|
vercylean: veryclean
|
2015-01-15 13:59:12 +01:00
|
|
|
|
|
|
|
.gitignore:
|
|
|
|
$(QPACKAGE_ROOT)/scripts/create_gitignore.sh
|
|
|
|
|
|
|
|
|
|
|
|
# Frequent typos
|
|
|
|
clena: clean
|
2014-06-07 22:07:50 +02:00
|
|
|
veryclena: veryclean
|