#----------------------------------------------------------------------
#           SETTINGS FOR THE ELIOM PROJECT %%%PROJECT_NAME%%%
#----------------------------------------------------------------------
# Required binaries
OPAM                  := opam

PROJECT_NAME          := %%%PROJECT_NAME%%%

##----------------------------------------------------------------------
## The following part is used for the internationalization (i18n).

## The list of supported language, separated by a comma. Each language will
## generate a value in a sum type defined in the generate i18n file.
I18N_LANGUAGES         := en,fr

## The default language.
I18N_DEFAULT_LANGUAGE  := en

## The TSV files containing all translations.
I18N_TSV_DIR           := assets/
I18N_PRIMARY_FILE      := $(I18N_TSV_DIR)$(PROJECT_NAME)_i18n.tsv
# The demo entries are in their own file, for convenience.
I18N_EXTRA_FILES       := $(I18N_TSV_DIR)$(PROJECT_NAME)_Demo_i18n.tsv

##----------------------------------------------------------------------

##----------------------------------------------------------------------
## The following part contains the settings for the compilation process like the
## server/client OPAM packages and the server/client files.

# Source files for the server. By default, it's all eliom, eliomi and ml files
# in the project root directory.
SERVER_FILES          := $(wildcard *.eliomi *.eliom *.ml) \
                         $(notdir $(patsubst %.tsv,%.eliom,$(I18N_EXTRA_FILES))) \
                         %%%PROJECT_NAME%%%_i18n.eliom

# Source files for the client. By default, it's all eliom and eliomi files
# in the project root directory.
CLIENT_FILES          := $(wildcard *.eliomi *.eliom) \
                         $(notdir $(patsubst %.tsv,%.eliom,$(I18N_EXTRA_FILES))) \
                         %%%PROJECT_NAME%%%_i18n.eliom

# OCamlfind packages for the server (for modules which defines services)
SERVER_ELIOM_PACKAGES := ocsigen-start.server

# OCamlfind packages for the server
SERVER_PACKAGES       := lwt_ppx js_of_ocaml-ppx_deriving_json ppx_deriving.std pgocaml ocsigen-ppx-rpc

# OCamlfind packages for database access
SERVER_DB_PACKAGES    := pgocaml pgocaml_ppx

# OCamlfind packages for the client
CLIENT_PACKAGES       := lwt_ppx js_of_ocaml-ppx js_of_ocaml-ppx_deriving_json \
                         ppx_deriving.std ocsigen-start.client base ocsigen-ppx-rpc

# Automatically install packages via NPM
USE_NPM               := no

##----------------------------------------------------------------------

##----------------------------------------------------------------------
## The following part contains the configuration for the ocsigenserver.

# User to run server with (make run.*)
WWWUSER               := www-data
WWWGROUP              := www-data

# Port for running the server (make run.*)
PORT                  := 80

# Port for testing (make test.*)
TEST_PORT             := 8080

# Root of installation (must end with /)
PREFIX                := /usr/local/

# Local folder for make test.* (must end with /)
TEST_PREFIX           := local/

## The installation tree (relative to $(PREFIX) when installing/running or
## $(TEST_PREFIX) when testing).

# Configuration file $(PROJECT_NAME).conf
ETCDIR                := etc/${PROJECT_NAME}

# Project's library $(PROJECT_NAME).cma (cmxs)
LIBDIR                := lib/${PROJECT_NAME}

# Command pipe, eg. $ echo restart > $(INSTALL_PREFIX)$(CMDPIPE)
CMDPIPE               := var/run/${PROJECT_NAME}-cmd

# Ocsigenserver's logging files
LOGDIR                := var/log/${PROJECT_NAME}

# Ocsigenserver's persistent data files
DATADIR               := var/data/${PROJECT_NAME}

# Project's static files
FILESDIR              := var/www/${PROJECT_NAME}

# Project's JavaScript file directory
ELIOMSTATICDIR        := var/www/${PROJECT_NAME}

##----------------------------------------------------------------------

##----------------------------------------------------------------------
## The following part contains the settings for CSS.

# Directory with files to be statically served. All external CSS files will be
# copied in this directory.
LOCAL_STATIC          := static
LOCAL_STATIC_CSS      := $(LOCAL_STATIC)/css
LOCAL_STATIC_IMAGES      := $(LOCAL_STATIC)/images
LOCAL_STATIC_FONTS      := $(LOCAL_STATIC)/fonts
# Default CSS if not using SASS:
LOCAL_STATIC_DEFAULTCSS      := $(LOCAL_STATIC)/defaultcss

# Main CSS generated file.
# If you use SASS, this is the compiled file.
# If you don't use SASS, all CSS files in $(CSS_FILES) will be concatenate in
# this file.
LOCAL_CSS             := $(LOCAL_STATIC_DEFAULTCSS)/$(PROJECT_NAME).css

# The OPAM share directory.
SHAREDIR              := /usr/pkg/share

# The ocsigen-toolkit directory containing CSS files.
SHAREDIR_OT_CSS       := $(SHAREDIR)/ocsigen-toolkit/css

# CSS files to copy from other projects into the working directory.
# By default, ocsigen-start needs the CSS files of ocsigen-toolkit.
# If you don't need ocsigen-toolkit CSS files, remote CSS files related to
# ocsigen-toolkit in this variable.
# The order is important because it will be used when concataining all CSS files
# if SASS is deactivated.
# These files are copied with every run of make so they must not be modified.
EXTERNAL_CSS_FILES    := $(SHAREDIR_OT_CSS)/ot_buttons.css \
                         $(SHAREDIR_OT_CSS)/ot_carousel.css \
                         $(SHAREDIR_OT_CSS)/ot_tongue.css \
                         $(SHAREDIR_OT_CSS)/ot_sticky.css \
                         $(SHAREDIR_OT_CSS)/ot_datetime.css \
                         $(SHAREDIR_OT_CSS)/ot_drawer.css \
                         $(SHAREDIR_OT_CSS)/ot_icons.css \
                         $(SHAREDIR_OT_CSS)/ot_picture_uploader.css \
                         $(SHAREDIR_OT_CSS)/ot_popup.css \
                         $(SHAREDIR_OT_CSS)/ot_spinner.css \
                         $(SHAREDIR_OT_CSS)/ot_page_transition.css

# All CSS files which must be concatenated.
# This variable is only used if SASS is deactivated.
# The order is important because it will be used when concataining all CSS
# files.
CSS_FILES             := $(LOCAL_STATIC_CSS)/font-awesome.min.css \
                         $(EXTERNAL_CSS_FILES) \
                         $(LOCAL_STATIC_DEFAULTCSS)/os.css
# CSS destination
CSSDIR                := $(TEST_PREFIX)$(ELIOMSTATICDIR)/css
CSS_PREFIX            := $(CSSDIR)/$(PROJECT_NAME)
CSS_DEST              := $(CSS_PREFIX).css
##----------------------------------------------------------------------

##----------------------------------------------------------------------
## The following part contains the settings for SASS.

# Set to yes if you want to use SASS (http://sass-lang.com). Any other value
# will disable SASS.
# It is recommended to use SASS to write your styles. By default, SASS is
# activated.
USE_SASS              := no

# The directory where SASS files are.
SASSDIR               := sass

# The filename of the main SASS file.
# You can import other stylesheets from this file
# (with @import "path/filename[.css]").
SASS_SRC              := $(SASSDIR)/$(PROJECT_NAME).scss

# A separated-colon list of path containing CSS and SCSS files. It allows to
# avoid to write the entire path to a SCSS/CSS file in a @import rule.
SASS_PATH             := $(SASSDIR)/lib:$(LOCAL_STATIC_CSS)
##----------------------------------------------------------------------

##----------------------------------------------------------------------
## The following part contains the settings for debugging

# Debug application (yes/no): Debugging info in compilation,
# JavaScript, ocsigenserver
DEBUG                 := yes

##----------------------------------------------------------------------

##----------------------------------------------------------------------
## The following part contains the settings for the mobile application.

# The directory where the Cordova application will be copied.
CORDOVAPATH                    := cordova

# The directory containing the files about the mobile application like the
# config.xml.in, index.html.in, eliom_loader.ml, ...
MOBILESTATICPATH               := mobile

MOBILE_APP_ID                  := com.%%%PROJECT_NAME%%%.mobile
MOBILE_APP_NAME                := %%%PROJECT_NAME%%%
MOBILE_APP_VERSION             := 0.1
MOBILE_DESCRIPTION             := %%%PROJECT_NAME%%% mobile application
MOBILE_AUTHOR_EMAIL            := developer@domain.com
MOBILE_AUTHOR_HREF             := http://domain.com
MOBILE_AUTHOR_DESCRIPTION      := %%%PROJECT_NAME%%% team
MOBILE_ANDROID_SDK_VERSION     := 19
MOBILE_NOTIFICATIONS_SENDER_ID := 424242424242

##----------------------------------------------------------------------

##----------------------------------------------------------------------
## The following part is only used for PGOcaml (ie for the database).

## The host database.
DB_HOST               := localhost

## The port of the database server
DB_PORT               := 3000

## The database name for the project. By default, it's the project name.
DB_NAME               := %%%PROJECT_NAME%%%

## The database user. By default, it will use the username of the current user.
DB_USER               := $(USER)

## The password to access the database. By default it's empty.
DB_PASSWORD           := ""

## The main SQL file. This file will be used by the rule 'db-schema' (defined
## in Makefile.db) to initialise the database schema.
PSQL_FILE             := $(DB_NAME).sql

## The filename for the database snapshot. This variable is used
## by 'db-snapshot'.
DB_SNAPSHOT           := %%%PROJECT_NAME%%%-$$(date '+%Y%m%d%H%M%S').sql.gz

## Choose if the database will be installed locally or globally
# - yes: will create the database in the $(TEST_PREFIX)/db (which has the value
#   'local' by default).
# - no: will use the default database daemon
LOCAL                 := yes

## If the LOCAL variable is set to yes, PSQL_DIR is the database directory.
PSQL_DIR              := local_db

## If the LOCAL variable is set to yes, PSQL_LOG is the log directory.
PSQL_LOG              := $(PSQL_DIR)/log

##----------------------------------------------------------------------
