00001 # Prerequisite: COMMON_TOP must be set. 00002 00003 00004 # Project section. 00005 00006 # PROJECT_NAME should be defined on a per-project basis. 00007 ifndef PROJECT_NAME 00008 PROJECT_NAME = Ceylan-common 00009 endif 00010 00011 00012 # PROJECT_VERSION should be defined on a per-project basis. 00013 ifndef PROJECT_VERSION 00014 PROJECT_VERSION = 0.1 00015 endif 00016 00017 00018 ifndef PACKAGE_NAME 00019 PACKAGE_NAME = common 00020 endif 00021 00022 00023 ifndef PACKAGE_TOP 00024 PACKAGE_TOP = $(COMMON_TOP) 00025 endif 00026 00027 00028 ARCHIVE_ROOT := $$HOME/Archive/$(PROJECT_NAME) 00029 00030 00031 ARCHIVE_FILE := $(ARCHIVE_ROOT)/`date +'%Y%m%d'`-$(PROJECT_NAME).tar.bz2 00032 00033 00034 ARCHIVE_BRANCH_FILE = $(ARCHIVE_ROOT)/`date +'%Y%m%d'`-$(PROJECT_NAME)-branch-$(shell basename `pwd`).tar.bz2 00035 00036 00037 00038 SNAPSHOT_ARCHIVE_FILE := $(ARCHIVE_ROOT)/`date +'%Y%m%d'`-$(PROJECT_NAME)-snapshot.tar.bz2 00039 00040 00041 PROJECT_RELEASE_BASE := $(PROJECT_NAME)-$(PROJECT_VERSION) 00042 00043 PROJECT_RELEASE_ARCHIVE_ZIP := $(PROJECT_RELEASE_BASE).zip 00044 PROJECT_RELEASE_ARCHIVE_BZ2 := $(PROJECT_RELEASE_BASE).tar.bz2 00045 00046 00047 00048 # Installation section. 00049 00050 00051 # If wanting to install that package, following installation prefix is used. 00052 # INSTALLATION_PREFIX should be defined on a per-project basis, or be 00053 # overridden on the command line (ex: 'make install INSTALLATION_PREFIX=/tmp'): 00054 ifndef INSTALLATION_PREFIX 00055 INSTALLATION_PREFIX = $$HOME/Software 00056 endif 00057 00058 00059 PACKAGE_INSTALLATION_PREFIX = $(INSTALLATION_PREFIX)/$(PACKAGE_NAME) 00060 00061 00062 # Could rely on the permissions instead: 00063 EXEC_TO_INSTALL := `find $(PACKAGE_TOP) -name '*.sh' -a ! -name '*.exe'` 00064 00065 00066 BEAMS_TO_INSTALL := `find $(PACKAGE_TOP) -name examples -prune -o \( -name '*.beam' -a ! -name '*_test.beam' -a ! -name 'class_Test*.beam' \) -a -print` 00067 00068 SOURCES_TO_INSTALL := `find $(PACKAGE_TOP) -name examples -prune -o \( -name '*.erl' -a ! -name '*_test.erl' -a ! -name 'class_Test*.erl' \) -a -print` 00069 00070 00071 EXAMPLES_TO_INSTALL_BEAMS := `[ ! -d examples ] || find $(PACKAGE_TOP)/examples -name '*.beam'` 00072 00073 EXAMPLES_TO_INSTALL_SRC := `[ ! -d examples ] || find $(PACKAGE_TOP)/examples -name '*.erl'` 00074 00075 00076 INCLUDES_TO_INSTALL := `find $(PACKAGE_TOP) -name '*.hrl'` 00077 00078 00079 TESTS_TO_INSTALL_BEAMS := `find $(PACKAGE_TOP) -name '*_test.beam' -o -name 'class_Test*.beam'` 00080 00081 TESTS_TO_INSTALL_SRC := `find $(PACKAGE_TOP) -name '*_test.erl' -o -name 'class_Test*.erl'` 00082 00083 00084 DOC_TO_INSTALL := `find $(PACKAGE_TOP) -name tmp-rst -prune -o \( -type f -a \( -name '*.pdf' -o -name '*.html' -o -name '*.png' \) \)|grep -v tmp-rst` 00085 00086 00087 00088 # Source section. 00089 COMMON_SRC := $(COMMON_TOP)/src 00090 00091 # BEAM path section. 00092 COMMON_BEAM := $(COMMON_TOP)/src 00093 00094 # Include path section. 00095 COMMON_INC = -I$(COMMON_SRC) 00096 00097 00098 INC += $(foreach dir,$(BEAM_DIRS),-I$(dir)) 00099 00100 00101 # Erlang environment section. 00102 00103 ERLANG_ROOT := ~/Software/Erlang/Erlang-current-install 00104 00105 ERLANG_COMPILER := `PATH=$(ERLANG_ROOT)/bin:$$PATH which erlc` 00106 00107 00108 WARNING_LEVEL := 2 00109 00110 ERLANG_COMPILER_OPT_DEBUG := +debug_info 00111 00112 # The number of available cores on this computer: 00113 CORE_COUNT := `grep -c processor /proc/cpuinfo` 00114 00115 ERLANG_INTERPRETER := `PATH=$(ERLANG_ROOT)/bin:$$PATH which erl` 00116 00117 ERLANG_INTERPRETER_OPT_DEBUG := -init_debug -smp auto 00118 00119 00120 ifndef FQDN 00121 00122 #FQDN := `host \`hostname\` | awk '{ print $$1 }' | head -n 1` 00123 FQDN := `hostname -f` 00124 00125 endif 00126 00127 00128 ifndef VM_TEST_NAME 00129 00130 VM_NAME := ceylan_debug 00131 00132 endif 00133 00134 00135 ifndef VM_TEST_NAME 00136 00137 VM_TEST_NAME := ceylan_test 00138 00139 endif 00140 00141 00142 #DISTRIBUTED_NODE_OPT := -sname $(VM_NAME) -setcookie $(PROJECT_NAME) 00143 DISTRIBUTED_NODE_OPT := -name $(VM_NAME)@$(FQDN) -setcookie $(PROJECT_NAME) 00144 00145 00146 STARTUP_FUNCTION := run 00147 00148 BEAM_DIRS += . $(COMMON_BEAM)/data-management $(COMMON_BEAM)/maths \ 00149 $(COMMON_BEAM)/user-interface $(COMMON_BEAM)/utils 00150 00151 00152 ERL_LAUNCHER = $(COMMON_SRC)/scripts/launch-erl.sh 00153 00154 00155 # Add '+native' if native-code compilation is supported. 00156 # 00157 # Removed options: 00158 # 00159 # - ("+{warn_format,2}" would trigger unwanted useless warnings about format 00160 # strings 00161 # 00162 # - -v/+verbose causes inlining to be too verbose, ex: 00163 # "Old inliner: threshold=0 functions=[{setAttribute,3},.." 00164 # 00165 ERLANG_COMPILER_OPT += -b beam $(INC) -W$(WARNING_LEVEL) \ 00166 $(ERLANG_COMPILER_OPT_DEBUG) +bin_opt_info +warn_export_all \ 00167 +warn_export_vars +warn_shadow_vars +warn_obsolete_guards \ 00168 +warn_unused_import +warnings_as_errors \ 00169 "+{debug_info_key,\"Ceylan\"}" 00170 00171 00172 # +v (verbose) option removed, as only active if the interpreter has been 00173 # compiled in debug mode (otherwise a warning is displayed at each execution). 00174 # (note: variable generally not used, as using the ERL_LAUNCHER script instead) 00175 ERLANG_INTERPRETER_OPT := -pz $(BEAM_DIRS) $(DISTRIBUTED_NODE_OPT) 00176 00177 00178 00179 # 'BEAM_PATH_OPT = --beam-paths $(BEAM_DIRS)' would be shorter, but would 00180 # prevent adding other options to the launcher afterwards: 00181 BEAM_PATH_OPT = $(foreach dir,$(BEAM_DIRS),--beam-dir $(dir)) 00182 00183 # Removed: 00184 # --ln $(VM_TEST_NAME) 00185 # -c $(PROJECT_NAME), as not specifying it on the command line allows to 00186 # select the one in ~/.erlang.cookie (if any), which is better 00187 # 00188 # OVERRIDDEN_OPT left for the user. 00189 ERL_PARAMETERIZED_LAUNCHER = $(ERL_LAUNCHER) -v --fqdn $(FQDN) \ 00190 $(BEAM_PATH_OPT) $(OVERRIDDEN_OPT) 00191 00192 INTERNAL_OPTIONS := -start-verbatim-options $(INTERNAL_OPTIONS)