-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8eeeacb
commit 08d4acf
Showing
24 changed files
with
4,942 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Listing path patterns that shall be ignored by git: | ||
*.beam | ||
include/*.hrl | ||
*.traces | ||
*.log | ||
*.plt | ||
*erlang.log.* | ||
declared-types-in-*.txt | ||
.eunit | ||
erl_crash.dump | ||
*~ | ||
|
||
# Added in relation to rebar3: | ||
.rebar | ||
rebar3.crashdump | ||
.rebar3 | ||
_* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
US_COMMON_TOP = . | ||
|
||
|
||
.PHONY: help help-intro help-us-common register-version-in-header \ | ||
register-us-common info info-local | ||
|
||
|
||
MODULES_DIRS = src doc conf test | ||
|
||
|
||
# To override the 'all' default target with a parallel version: | ||
BASE_MAKEFILE = true | ||
|
||
|
||
|
||
# Default target: | ||
help: help-intro help-us-common | ||
|
||
|
||
help-intro: | ||
@echo " Following main make targets are available for package $(PACKAGE_NAME):" | ||
|
||
|
||
help-us-common: | ||
@cd $(TRACES_TOP) && $(MAKE) -s help-traces | ||
|
||
|
||
register-version-in-header: | ||
@if [ -z "$(VERSION_FILE)" ] ; then \ | ||
echo "Error, no version file defined." 1>&2 ; exit 52 ; else \ | ||
$(MAKE) register-us-common ; fi | ||
|
||
|
||
register-us-common: | ||
@echo "-define( us_common_version, \"$(US_COMMON_VERSION)\" )." >> $(VERSION_FILE) | ||
|
||
|
||
# Useful to extract internal layout for re-use in upper layers: | ||
list-beam-dirs: | ||
@for d in $(US_COMMON_BEAM_DIRS) ; do echo $$(readlink -f $$d) ; done | ||
|
||
|
||
stats: | ||
@$(MAKE_CODE_STATS) $(US_COMMON_TOP) | ||
|
||
|
||
info: info-local | ||
|
||
|
||
info-local: | ||
@echo "REBAR3 = $(REBAR3)" | ||
@echo "TRACES_TOP = $(TRACES_TOP)" | ||
@echo "WOOPER_TOP = $(WOOPER_TOP)" | ||
@echo "MYRIAD_TOP = $(MYRIAD_TOP)" | ||
|
||
|
||
include $(US_COMMON_TOP)/GNUmakesettings.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Here are gathered automatic (generic, pattern-based) rules for US-common. | ||
# | ||
# See GNUmakerules-explicit.inc for the explicit (immediate, static) | ||
# counterparts. | ||
|
||
|
||
# Prerequisite: US_COMMON_TOP must be set. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Here are gathered explicit (immediate, static) rules for US-common. | ||
# | ||
# See GNUmakerules-automatic.inc for their automatic (generic, pattern-based) | ||
# counterparts. | ||
|
||
|
||
# Prerequisite: US_COMMON_TOP must be set. | ||
|
||
|
||
|
||
# The first non-generic, therefore default, rule: | ||
default-us-common-rule: all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# This is the single file that all US-common GNUmakefiles, and only them, should | ||
# include. | ||
|
||
# Prerequisite: US_COMMON_TOP must be set. | ||
|
||
|
||
# Each project should define its own GNUmakesettings.inc, as explained in | ||
# myriad/GNUmakesettings.inc. | ||
|
||
|
||
# Nothing simpler can be used: | ||
|
||
|
||
# First the make variables: | ||
|
||
include $(US_COMMON_TOP)/GNUmakevars.inc | ||
include $(TRACES_TOP)/GNUmakevars.inc | ||
include $(WOOPER_TOP)/GNUmakevars.inc | ||
include $(MYRIAD_TOP)/GNUmakevars.inc | ||
|
||
|
||
# Then rules are split between automatic (generic, pattern-based) ones and | ||
# explicit (immediate, static) ones, so that the latter can be placed last | ||
# (otherwise they would shadow any default target, such as 'all', defined by any | ||
# lower layer, for instance when overriding base cleaning with their own | ||
# 'clean-local' target): | ||
|
||
include $(US_COMMON_TOP)/GNUmakerules-automatic.inc | ||
include $(TRACES_TOP)/GNUmakerules-automatic.inc | ||
include $(WOOPER_TOP)/GNUmakerules-automatic.inc | ||
include $(MYRIAD_TOP)/GNUmakerules-automatic.inc | ||
|
||
include $(US_COMMON_TOP)/GNUmakerules-explicit.inc | ||
include $(TRACES_TOP)/GNUmakerules-explicit.inc | ||
include $(WOOPER_TOP)/GNUmakerules-explicit.inc | ||
include $(MYRIAD_TOP)/GNUmakerules-explicit.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
# Prerequisite: US_COMMON_TOP must be set. | ||
|
||
|
||
# Useful to target for example the root of the current layer (ex: to locate the | ||
# relevant, layer-local '_build' directory): | ||
# | ||
ifndef LAYER_TOP | ||
LAYER_TOP := $(US_COMMON_TOP) | ||
endif | ||
|
||
|
||
# Project section. | ||
|
||
|
||
# PROJECT_NAME should be defined on a per-project basis. | ||
ifndef PROJECT_NAME | ||
PROJECT_NAME = US-common | ||
endif | ||
|
||
|
||
# REBAR3_PROJECT_NAME should be defined on a per-project basis. | ||
ifndef REBAR3_PROJECT_NAME | ||
REBAR3_PROJECT_NAME := us_common | ||
endif | ||
|
||
|
||
# The uniquely-defined version of this layer, for all uses, including rebar: | ||
US_COMMON_VERSION := 0.0.1 | ||
|
||
|
||
# PROJECT_VERSION should be defined on a per-project basis: | ||
ifndef PROJECT_VERSION | ||
PROJECT_VERSION = $(US_COMMON_VERSION) | ||
endif | ||
|
||
|
||
ifndef PACKAGE_NAME | ||
PACKAGE_NAME = $(PROJECT_NAME) | ||
endif | ||
|
||
|
||
ifndef PACKAGE_TOP | ||
PACKAGE_TOP = $(US_COMMON_TOP) | ||
endif | ||
|
||
|
||
|
||
# For any quick, local, non-packaged update thereof: | ||
WOOPER_SIBLING_BUILD = $(LAYER_TOP)/../Ceylan-WOOPER | ||
|
||
|
||
# The OTP tree of the WOOPER application within a local OTP _build tree: | ||
WOOPER_LOCAL_APP := $(LAYER_TOP)/_build/default/lib/wooper | ||
|
||
# Where WOOPER BEAMs are to lie when used as an OTP application: | ||
WOOPER_LOCAL_EBIN := $(WOOPER_LOCAL_APP)/ebin/ | ||
|
||
|
||
US_COMMON_RELEASE_BASE := us-common-$(PROJECT_VERSION) | ||
|
||
US_COMMON_RELEASE_ARCHIVE_ZIP := $(US_COMMON_RELEASE_BASE).zip | ||
US_COMMON_RELEASE_ARCHIVE_BZ2 := $(US_COMMON_RELEASE_BASE).tar.bz2 | ||
US_COMMON_RELEASE_ARCHIVE_XZ := $(US_COMMON_RELEASE_BASE).tar.xz | ||
|
||
|
||
# Source section. | ||
US_COMMON_SRC := $(US_COMMON_TOP)/src | ||
|
||
# BEAM path section. | ||
US_COMMON_BEAM := $(US_COMMON_TOP) | ||
|
||
# Include path section (also for include_lib). | ||
US_COMMON_INC = -I$(US_COMMON_SRC) -I$(US_COMMON_TOP)/.. | ||
|
||
|
||
# In an OTP/rebar3-style application layout, at compilation time, libraries | ||
# making use of WOOPER will expect its includes to be located in: | ||
# | ||
# (Myriad already taken care of, at the WOOPER level) | ||
# | ||
WOOPER_OTP_INC := -I$(US_COMMON_TOP)/../wooper/include | ||
|
||
INC += $(US_COMMON_INC) $(WOOPER_OTP_INC) | ||
|
||
|
||
# When building a layer in an OTP context from its usual, GIT root (ex: with | ||
# 'make rebar3-application'), the BEAMs of WOOPER are to be found in the OTP | ||
# build tree - rather than in a supposedly fully-built usual root for WOOPER: | ||
# | ||
WOOPER_OTP_BEAM_DIR_FROM_USUAL = $(LAYER_TOP)/$(WOOPER_REBAR_BUILD_BASE)/ebin | ||
|
||
|
||
# In an OTP/rebar3-style application layout, at compilation time, modules | ||
# compiled (directly or not) by the WOOPER parse transform will expect its | ||
# module to be located in: | ||
# | ||
WOOPER_OTP_BEAM_DIR_FROM_OTP = $(LAYER_TOP)/../wooper/ebin | ||
|
||
|
||
DOC_ROOT = $(US_COMMON_TOP)/../../../doc | ||
|
||
|
||
ifndef VM_NAME | ||
|
||
VM_NAME := us_common_debug | ||
|
||
endif | ||
|
||
|
||
ifndef VM_TEST_NAME | ||
|
||
VM_TEST_NAME := us_common_test | ||
|
||
endif | ||
|
||
|
||
# We rely on Myriad and WOOPER as well: | ||
BEAM_DIRS += $(US_COMMON_BEAM_DIRS) | ||
|
||
|
||
# So that they can be fetched from outside | ||
# (see the 'list-beam-dirs' target) | ||
# | ||
US_COMMON_BEAM_DIRS = $(US_COMMON_BEAM)/src | ||
|
||
|
||
# For later reuse in the next layer of the software stack: | ||
US_COMMON_PLT_FILE := $(US_COMMON_TOP)/us_common.plt | ||
|
||
|
||
# This is the merged PLT of the level just below in the software stack. | ||
# For us-common, it is the PLT of 'Traces': | ||
ifndef PREDECESSOR_PLT | ||
PREDECESSOR_PLT = $(TRACES_PLT_FILE) | ||
endif | ||
|
||
|
||
# We define the path to the Traces layer: | ||
# | ||
# (it may be a symbolic link pointing to the actual Traces package to be used, | ||
# which itself may be either a 'Ceylan-Traces' directory or a 'traces' one) | ||
# | ||
ifneq ($(wildcard $(US_COMMON_TOP)/../traces),) | ||
|
||
TRACES_TOP = $(US_COMMON_TOP)/../traces | ||
|
||
else | ||
|
||
# Default: | ||
TRACES_TOP = $(US_COMMON_TOP)/../Ceylan-Traces | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
US_COMMON_TOP = .. | ||
|
||
|
||
.PHONY: clean-local clean-rebar | ||
|
||
|
||
|
||
# Typically to generate various flavours (normal, for Hex, for testing, etc.) of | ||
# rebar.config files: | ||
# | ||
# (note: not centralised in a GNUmakerules-automatic file for all layers, as | ||
# substitutions are layer-specific) | ||
# | ||
%: %.template | ||
@echo " Generating $@ from $< (VERSION_FOR_REBAR3 being $(VERSION_FOR_REBAR3), TRACES_VERSION_FOR_REBAR being $(TRACES_VERSION), WOOPER_VERSION_FOR_REBAR being $(WOOPER_VERSION), MYRIAD_VERSION_FOR_REBAR being $(MYRIAD_VERSION)); this file should be copied to the root of this layer in order to be taken into account." | ||
@cat $< | sed "s|\"MYRIAD_VERSION_FOR_REBAR\"|\"$(MYRIAD_VERSION)\"|g" | sed "s|\"WOOPER_VERSION_FOR_REBAR\"|\"$(WOOPER_VERSION)\"|g" | sed "s|\"TRACES_VERSION_FOR_REBAR\"|\"$(TRACES_VERSION)\"|g" | sed "s|\"VERSION_FOR_REBAR3\"|\"$(VERSION_FOR_REBAR3)\"|g" | sed "s|FIRST_FILES_FOR_REBAR|$(REBAR_FIRST_FILES)|g" | sed "s|DEBUG_KEY_FOR_REBAR|$(DEBUG_INFO_KEY)|g"| sed "s|INCS_FOR_REBAR|$(REBAR_INCS)|g" > $@ | ||
|
||
|
||
clean: clean-local | ||
|
||
|
||
clean-local: clean-rebar | ||
-@/bin/rm -f $(REBAR_CONF_FILES) | ||
|
||
|
||
clean-rebar: | ||
-@/bin/rm -f rebar.config | ||
-@#/bin/rm -rf priv/ | ||
|
||
|
||
include $(US_COMMON_TOP)/GNUmakesettings.inc |
Oops, something went wrong.