From 17726cb80b09d85cdf75486811e0dae97f988f5e Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Thu, 21 Feb 2019 15:27:20 +0100
Subject: [PATCH] Philippe 21/02/2019: add flag to compile the COMPRESS library

---
 src/Makefile.MESONH.mk  | 17 +++++++++++++++--
 src/Rules.AIX64.mk      |  5 +++++
 src/Rules.BG.mk         |  5 +++++
 src/Rules.BGQ.mk        |  5 +++++
 src/Rules.LXNAGfor.mk   |  5 +++++
 src/Rules.LXarm.mk      |  4 ++++
 src/Rules.LXcray.mk     |  5 +++++
 src/Rules.LXg95.mk      |  5 +++++
 src/Rules.LXgfortran.mk |  4 ++++
 src/Rules.LXifort.mk    |  5 +++++
 src/Rules.LXpathf95.mk  |  5 +++++
 src/Rules.LXpgi.mk      |  5 +++++
 src/Rules.SX8.mk        |  5 +++++
 13 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/src/Makefile.MESONH.mk b/src/Makefile.MESONH.mk
index 1a1607808..90e2b092e 100644
--- a/src/Makefile.MESONH.mk
+++ b/src/Makefile.MESONH.mk
@@ -1,6 +1,6 @@
-#MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
-#MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt  
+#MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
 ##########################################################
 #                                                        #
@@ -242,6 +242,19 @@ VPATH               += $(DIR_NEWLFI)
 #ARCH_XYZ    := $(ARCH_XYZ)-$(VER_NEWLFI)
 endif
 ##########################################################
+#           Source COMPRESS                              #
+##########################################################
+ifdef MNH_COMPRESS
+DIR_COMPRESS           = ../LIBTOOLS/lib/COMPRESS/src
+INC_COMPRESS           = -I$(B)$(DIR_COMPRESS)
+DIR_MASTER            += $(DIR_COMPRESS)
+OBJS_LISTE_MASTER     += bitbuff.o nearestpow2.o
+INC                   += $(INC_COMPRESS)
+VPATH                 += $(DIR_COMPRESS)
+CPPFLAGS_COMPRESS     ?= -DLITTLE_endian
+CPPFLAGS              += $(CPPFLAGS_COMPRESS)
+endif
+##########################################################
 #           Source FOREFIRE                              #
 ##########################################################
 ifdef MNH_FOREFIRE
diff --git a/src/Rules.AIX64.mk b/src/Rules.AIX64.mk
index b4de87fcf..c207e6df3 100644
--- a/src/Rules.AIX64.mk
+++ b/src/Rules.AIX64.mk
@@ -101,6 +101,11 @@ CNAME_GRIBEX=""
 #if MNH_TOOLS exists => compile the tools
 MNH_TOOLS = yes
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+MNH_COMPRESS=yes
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.BG.mk b/src/Rules.BG.mk
index d3d34f3f6..d34ee73ae 100644
--- a/src/Rules.BG.mk
+++ b/src/Rules.BG.mk
@@ -112,6 +112,11 @@ CNAME_GRIBEX=""
 #if MNH_TOOLS exists => compile the tools
 #MNH_TOOLS = no
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+#MNH_COMPRESS=no
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.BGQ.mk b/src/Rules.BGQ.mk
index e1e735144..afd158a03 100644
--- a/src/Rules.BGQ.mk
+++ b/src/Rules.BGQ.mk
@@ -171,6 +171,11 @@ GRIBAPI_CONF= --host=powerpc64-bgq-linux
 #if MNH_TOOLS exists => compile the tools
 #MNH_TOOLS = no
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+#MNH_COMPRESS=no
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.LXNAGfor.mk b/src/Rules.LXNAGfor.mk
index d7a8adf96..00f9c48b2 100644
--- a/src/Rules.LXNAGfor.mk
+++ b/src/Rules.LXNAGfor.mk
@@ -94,6 +94,11 @@ NETCDF_SUPPFLAGS = -dusty -kind=byte
 #if MNH_TOOLS exists => compile the tools
 MNH_TOOLS = yes
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+MNH_COMPRESS=yes
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.LXarm.mk b/src/Rules.LXarm.mk
index 7622b6807..918d1fc22 100644
--- a/src/Rules.LXarm.mk
+++ b/src/Rules.LXarm.mk
@@ -116,6 +116,10 @@ MNH_TOOLS=yes
 endif
 endif
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+MNH_COMPRESS=yes
 #
 #
 ##########################################################
diff --git a/src/Rules.LXcray.mk b/src/Rules.LXcray.mk
index 1fbd6578c..ae24c8420 100644
--- a/src/Rules.LXcray.mk
+++ b/src/Rules.LXcray.mk
@@ -109,6 +109,11 @@ GRIBAPI_CONF="FCFLAGS= -em -ef "
 #if MNH_TOOLS exists => compile the tools
 MNH_TOOLS = yes
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+MNH_COMPRESS=yes
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.LXg95.mk b/src/Rules.LXg95.mk
index fa86c4daf..cdd6184f0 100644
--- a/src/Rules.LXg95.mk
+++ b/src/Rules.LXg95.mk
@@ -81,6 +81,11 @@ CNAME_GRIBEX=g95
 #if MNH_TOOLS exists => compile the tools
 MNH_TOOLS = yes
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+MNH_COMPRESS=yes
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.LXgfortran.mk b/src/Rules.LXgfortran.mk
index cdf8bc938..a606a2fc3 100644
--- a/src/Rules.LXgfortran.mk
+++ b/src/Rules.LXgfortran.mk
@@ -110,6 +110,10 @@ MNH_TOOLS=yes
 endif
 endif
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+MNH_COMPRESS=yes
 #
 #
 ##########################################################
diff --git a/src/Rules.LXifort.mk b/src/Rules.LXifort.mk
index 3a3185d5a..60af5234d 100644
--- a/src/Rules.LXifort.mk
+++ b/src/Rules.LXifort.mk
@@ -205,6 +205,11 @@ ifeq "$(MNH_INT)" "4"
 MNH_TOOLS=yes
 endif
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+MNH_COMPRESS=yes
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.LXpathf95.mk b/src/Rules.LXpathf95.mk
index 014fcbaf4..1e0487f1f 100644
--- a/src/Rules.LXpathf95.mk
+++ b/src/Rules.LXpathf95.mk
@@ -57,6 +57,11 @@ CNAME_GRIBEX=pathf95
 #if MNH_TOOLS exists => compile the tools
 MNH_TOOLS = yes
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+MNH_COMPRESS=yes
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.LXpgi.mk b/src/Rules.LXpgi.mk
index 9b53a87c3..7bae40f42 100644
--- a/src/Rules.LXpgi.mk
+++ b/src/Rules.LXpgi.mk
@@ -116,6 +116,11 @@ CNAME_GRIBEX=_pgf77
 #if MNH_TOOLS exists => compile the tools
 MNH_TOOLS = yes
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+MNH_COMPRESS=yes
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.SX8.mk b/src/Rules.SX8.mk
index e5bb540f6..1246647cc 100644
--- a/src/Rules.SX8.mk
+++ b/src/Rules.SX8.mk
@@ -103,6 +103,11 @@ CNAME_GRIBEX=sxmpif90
 #if MNH_TOOLS exists => compile the tools
 #MNH_TOOLS = no
 #
+## COMPRESS flag
+#
+#if MNH_COMPRESS exists => compile the COMPRESS library (for LFI files)
+#MNH_COMPRESS=no
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
-- 
GitLab