Index: codes/icosagcm/devel/Python/src/hex_master/macros.jin
===================================================================
--- codes/icosagcm/devel/Python/src/hex_master/macros.jin	(revision 721)
+++ codes/icosagcm/devel/Python/src/hex_master/macros.jin	(revision 721)
@@ -0,0 +1,2 @@
+#define HEX_MASTER
+#include "../hexagonal/macros.jin"
Index: codes/icosagcm/devel/Python/src/hexagonal/macros.jin
===================================================================
--- codes/icosagcm/devel/Python/src/hexagonal/macros.jin	(revision 720)
+++ codes/icosagcm/devel/Python/src/hexagonal/macros.jin	(revision 721)
@@ -58,4 +58,22 @@
 #if PASS_JINJA
 
+#ifdef HEX_MASTER
+
+{% set ll_begin, ll_beginp1 = '1', '2' %}  
+{% set ll_endm1, ll_end, ll_endp1 = 'llm-1', 'llm', 'llm+1' %}  
+{% macro ij_omp(ext) -%}
+ij_begin{{ext}},ij_end{{ext}}
+{%- endmacro %}
+
+#else
+
+{% set ll_begin, ll_beginp1 = 'll_begin', 'll_beginp1' %}  
+{% set ll_endm1, ll_end, ll_endp1 = 'll_endm1', 'll_end', 'll_endp1' %}  
+{% macro ij_omp(ext) -%}
+ij_omp_begin{{ext}},ij_omp_end{{ext}}
+{%- endmacro %}
+
+#endif
+
 {% macro sequence() -%}
 {{ caller(body_primal,at_level_primal,'') }}
@@ -68,5 +86,5 @@
 {% macro at_level_primal(lev,ext) -%}
 {{ define('LL', lev) }}
-DO ij=ij_omp_begin{{ext}},ij_omp_end{{ext}}
+DO ij={{ ij_omp(ext) }}
 {{ caller() }}
 END DO
@@ -76,5 +94,5 @@
 {{ define('LL', 'l') }}
 DO l = {{ range }}
-  DO ij=ij_omp_begin{{ext}},ij_omp_end{{ext}}
+  DO ij={{ ij_omp(ext) }}
     {{ caller() }}
   END DO
@@ -88,5 +106,5 @@
 {% macro at_level_edge(lev,ext) -%}
 {{ define('LL', lev) }}
-DO ij=ij_omp_begin{{ext}},ij_omp_end{{ext}}
+DO ij={{ ij_omp(ext) }}
       {{ caller('u_right','t_right') }}
       {{ caller('u_lup','t_lup') }}
@@ -98,5 +116,5 @@
 {{ define('LL', 'l') }}
 DO l = {{ range }}
-   DO ij=ij_omp_begin{{ext}},ij_omp_end{{ext}}
+   DO ij={{ ij_omp(ext) }}
       {{ caller('u_right','t_right') }}
       {{ caller('u_lup','t_lup') }}
@@ -117,6 +135,6 @@
 
 {% macro forall(start,end,ij_range,thecode) %}
-{% set start_omp={'1':'ll_begin' , '2':'ll_beginp1'}[start] %}  
-{% set end_omp={'llm-1':'ll_endm1' , 'llm':'ll_end', 'llm+1':'ll_endp1'}[end] %}
+{% set start_omp={'1':ll_begin , '2':ll_beginp1}[start] %}  
+{% set end_omp={'llm-1':ll_endm1 , 'llm':ll_end, 'llm+1':ll_endp1}[end] %}
 {% set is_top_layer, is_top_inter = False, False %}
 
Index: codes/icosagcm/devel/make_python
===================================================================
--- codes/icosagcm/devel/make_python	(revision 720)
+++ codes/icosagcm/devel/make_python	(revision 721)
@@ -12,12 +12,5 @@
 }
 
-#--------------- Generate kernels, invoked by : './make_python kernels' ---------------
-
-function update()
-{
- diff $2 $1 || log cp -pr $1 $2
-}
-
-function cmd_clean() # this function is invoked by : './make_python clean'
+function cmd_clean() # cleanup, invoked by : './make_python clean'
 {
     rm -f lib/*.so lib/dynamico
@@ -26,20 +19,27 @@
 }
 
+#--------------- Generate kernels, invoked by : './make_python kernels' ---------------
+
+function update()
+{
+    diff $2 $1 || log cp -pr $1 $2
+}
+
+function update_kernels()
+{
+    cd $KERNELS/src/$1
+    for x in *.k90 ; do
+	update "$x" "$DYNAMICO_ROOT/src/$2/$x"
+    done
+}
+
 function cmd_kernels() # this function is invoked by : './make_python kernels'
 {
     cd $KERNELS
-    ./codegen hexagonal unstructured
-
-    cd $KERNELS/src/hexagonal
-    for x in *.k90 ; do
-	update "$x" "$DYNAMICO_ROOT/src/kernels_hex/$x"
-    done
-
-    cd $KERNELS/src/unstructured
-    for x in *.k90 ; do
-	update "$x" "$DYNAMICO_ROOT/src/kernels_unst/$x"
-    done
-
-# make sure to recompile dynamics
+    ./codegen hexagonal hex_master unstructured
+    update_kernels hexagonal kernels_hex
+    update_kernels hex_master kernels_hex_master
+    update_kernels unstructured kernels_unst
+# make sure that ./rebuild recompiles dynamics
     cd $DYNAMICO_ROOT
     touch src/dynamics/*.F90 src/diagnostics/*.F90 src/transport/*.F90 src/unstructured/*.F90
@@ -117,3 +117,3 @@
 cd Python/env ;  . ${CURRENT_ARCH}.env ; cd $DYNAMICO_ROOT
 
-cmd_$1
+time cmd_$1
