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 )
|
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 )
|
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-04-01 18:37:27 +02:00
|
|
|
IRP_VERSION_OK=$(shell $(IRPF90) -v | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= 1.3")
|
|
|
|
ifeq ($(IRP_VERSION_OK),False)
|
2014-04-04 00:41:43 +02:00
|
|
|
$(info -------------------- Error --------------------)
|
|
|
|
$(info IRPF90 version >= 1.3 is required)
|
|
|
|
$(info -----------------------------------------------)
|
|
|
|
$(error )
|
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 )
|
|
|
|
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 )
|
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 -----------------------------------------------)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# Update the README.rst file for GitHub, and git add it
|
|
|
|
|
|
|
|
$(shell update_README.py)
|
|
|
|
|
|
|
|
|
|
|
|
# Define the Makefile common variables and rules
|
|
|
|
|
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-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-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-04-03 11:28:54 +02:00
|
|
|
irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) NEEDED_MODULES
|
|
|
|
$(IRPF90)
|
|
|
|
|
|
|
|
Makefile.depend: Makefile
|
|
|
|
$(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh
|
|
|
|
|
|
|
|
include irpf90.make
|
|
|
|
|
2014-04-07 16:56:29 +02:00
|
|
|
test:
|
2014-04-16 22:16:32 +02:00
|
|
|
DEBUG=1 make -j 1 -C tests
|
2014-04-04 00:41:43 +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:
|
|
|
|
|