From a500848a8b721902a67d052397b3dc28945fc672 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Mar 2015 01:33:32 +0100 Subject: [PATCH] Improved Ocaml makefile --- ocaml/Makefile | 7 +++---- scripts/create_executables_list.sh | 26 ++++++++++++++++++++++++++ src/Makefile | 14 +++++--------- 3 files changed, 34 insertions(+), 13 deletions(-) create mode 100755 scripts/create_executables_list.sh diff --git a/ocaml/Makefile b/ocaml/Makefile index 18788a1b..be763cbd 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -1,7 +1,6 @@ -# Check if QPACKAGE_ROOT is defined - .NOPARALLEL: +# Check if QPACKAGE_ROOT is defined ifndef QPACKAGE_ROOT $(info -------------------- Error --------------------) $(info QPACKAGE_ROOT undefined. Source the quantum_package.rc script) @@ -30,8 +29,8 @@ default: $(ALL_TESTS) $(ALL_EXE) .gitignore echo $$i ; \ done >> .gitignore -executables: - $(MAKE) -C $(QPACKAGE_ROOT)/data executables +executables: $(QPACKAGE_ROOT)/data/executables + $(QPACKAGE_ROOT)/scripts/create_executables_list.sh external_libs: opam install cryptokit core diff --git a/scripts/create_executables_list.sh b/scripts/create_executables_list.sh new file mode 100755 index 00000000..b4aa4244 --- /dev/null +++ b/scripts/create_executables_list.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Thu Mar 26 01:27:14 CET 2015 + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +cd ${QPACKAGE_ROOT}/data + +rm -f executables +EXES=$(find ${QPACKAGE_ROOT}/src -perm /u+x -type f | grep -e "${QPACKAGE_ROOT}/src/[^/]*/[^/]*$" |sort ) + +for EXE in $EXES +do + printf "%-30s %s\n" $(basename $EXE) $EXE | sed "s|${QPACKAGE_ROOT}|\$QPACKAGE_ROOT|g" >> executables +done + + + + + diff --git a/src/Makefile b/src/Makefile index cd8ce65b..298cc134 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,24 +8,18 @@ ALL_MODULES=$(shell cat NEEDED_MODULES) EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a -.PHONY: $(ALL_MODULES) +.PHONY: $(ALL_MODULES) ezfio -default: $(EZFIO) +default: ezfio $(QPACKAGE_ROOT)/scripts/build_modules.sh $(ALL_MODULES) veryclean: $(QPACKAGE_ROOT)/scripts/clean_modules.sh $(ALL_MODULES) -$(ALL_MODULES): $(EZFIO) +$(ALL_MODULES): ezfio $(QPACKAGE_ROOT)/scripts/build_modules.sh $@ -executables: $(ALL_MODULES) - rm -f executables ; \ - for EXE in $$(find $(QPACKAGE_ROOT)/src -perm /u+x -type f | grep -e "$(QPACKAGE_ROOT)/src/[^/]*/[^/]*$$" |sort ) ; \ - do printf "%-30s %s\n" $$(basename $$EXE) $$EXE | sed "s|$(QPACKAGE_ROOT)|\$$QPACKAGE_ROOT|g" >> executables ;\ - done - # Define the EZFIO rules $(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/EZFIO.cfg) $(QPACKAGE_ROOT)/scripts/prepare_ezfio.sh @@ -34,6 +28,8 @@ $(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ $(MAKE) ;\ $(MAKE) Python +ezfio: $(EZFIO) + # Frequent typos clena: clean veryclena: veryclean