Commit 8426bb09 authored by Guillaume Huard's avatar Guillaume Huard
Browse files

vpl script and Local__Makefile for local org activities

parent 9845f3d7
# Usage :
# MODE='push|run|debug|evaluate [debug]' make [name]
# Either :
# - pushes all the files for the given name (matching a .org) to Caséine
# - or executes locally a run, a debug or an evaluate for the given name
THIS_MAKEFILE=$(lastword $(MAKEFILE_LIST))
VPLPP=$(dir $(THIS_MAKEFILE))
BASES=Basic_System C_Programming
VPLPP_DIRS=$(addprefix $(VPLPP)/, $(BASES))
VPLPP_LOCAL=$(VPLPP)/local.sh
VPLPP_FILES=$(addsuffix .org, $(VPLPP_DIRS)) $(addsuffix /ef/*, $(VPLPP_DIRS)) $(VPLPP_LOCAL)
LOCAL_SRC=$(wildcard *.org)
LOCAL_DIRS=$(patsubst %.org, %, $(LOCAL_SRC))
WRONG_DIRS=$(addsuffix _wrong, $(LOCAL_DIRS))
LOCALS=$(addsuffix /local.sh, $(LOCAL_DIRS) $(WRONG_DIRS))
PUSHES=$(addsuffix /push, $(LOCAL_DIRS) $(WRONG_DIRS))
ifeq ($(MODE),push)
TARGET=push
else
TARGET=local.sh
endif
EMACS=emacs --batch --eval "(progn \
(setq enable-local-eval t) \
(setq enable-local-variables t) \
(require 'org) \
(setq org-export-babel-evaluate t) \
(setq org-confirm-babel-evaluate nil) \
(setq org-latex-listings 'listings) \
(org-babel-do-load-languages 'org-babel-load-languages '(\
(shell . t)\
)) \
(setq org-src-preserve-indentation t)\
)"
.PHONY: default debug run debug evaluate push \
$(LOCAL_DIRS) $(WRONG_DIRS) $(FILES_DIRS)
default:
@echo "Type :"
@echo "MODE='chosen_mode' make 'name'"
@echo
@echo "Where chosen_mode might be 'run', 'debug', 'evaluate' or 'push', possibly assorted with 'debug',"
@echo "And name is the name of a .org file properly organised"
debug:
@echo "Local dirs: $(LOCAL_DIRS)"
@echo "Wrongs dirs: $(WRONG_DIRS)"
@echo "VPLPP: $(VPLPP)"
$(LOCAL_DIRS): %: %/vpl_id.txt %/$(TARGET)
cd $* && ./local.sh $(MODE)
$(WRONG_DIRS): %_wrong: %/vpl_id.txt %_wrong/$(TARGET)
cp -r $*/vpl_id.txt $*/ef $*/rf $*_wrong
cd $*_wrong && ./local.sh $(MODE)
%/vpl_id.txt: %.org
-if [ -d $* ];then cd $* && rm -r ef rf cf hf 2>/dev/null;fi
$(EMACS) $< --funcall org-babel-execute-buffer
$(EMACS) $< --funcall org-babel-tangle
if [ -d $*_files ];then cp -r $*_files/* $*;fi
$(LOCALS): %/local.sh: $(VPLPP_FILES)
cd $(VPLPP) && make files
cp -r $(VPLPP_FILES) $*
$(PUSHES): %/push: %/local.sh
touch $*/push
......@@ -24,7 +24,7 @@ then
then
rm -fr local_run
fi
export VPL_SUBFILES=$(ls cf rf hf | sort | uniq)
export VPL_SUBFILES=$(ls cf rf hf 2>/dev/null | sort | uniq)
export VPL_GRADEMIN=${VPL_GRADEMIN-0.0}
export VPL_GRADEMAX=${VPL_GRADEMAX-100.0}
local_files=$(echo rf/* cf/* hf/* ef/*)
......@@ -36,7 +36,10 @@ then
done
for file in $local_files
do
cp -v $file local_run
if [ -f "$file" ]
then
cp -v $file local_run
fi
done
cd local_run
if [ "$1" = "debug" ]
......@@ -66,11 +69,11 @@ else
# touch $dest/$dir/empty_file
# fi
done
for file in $(ls cf)
for file in $(ls cf 2>/dev/null)
do
touch $dest/rf/$file
done
for file in $(ls hf)
for file in $(ls hf 2>/dev/null)
do
cp hf/$file $dest/cf
done
......
#!/bin/bash
usage () {
cat <<END
$0 mode name
Depending on mode, performs the appropriate action on the activity name defined in name.org.
Mode might be: run, debug, evaluate or push. The execution modes (run, debug, evaluate) can
be assorted with the debug word for additionnal messages.
END
}
if [ $# -lt 2 ]
then
usage
exit 1
fi
MODE="$1"
shift
while [ $# -gt 1 ]
do
MODE="$MODE $1"
shift
done
export MODE
make -f $(dirname $0)/Local_Makefile $1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment