aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2011-10-16 15:09:35 +0200
committerAnders Svensson <[email protected]>2011-10-19 17:47:06 +0200
commit955bbc378a146611929551cdabcfe63264a570ac (patch)
tree1dd4c2181f86891085e5fd7edf12db8886de7907 /lib
parentaf9759875f237353339fad921ad82a712f889dcc (diff)
downloadotp-955bbc378a146611929551cdabcfe63264a570ac.tar.gz
otp-955bbc378a146611929551cdabcfe63264a570ac.tar.bz2
otp-955bbc378a146611929551cdabcfe63264a570ac.zip
Minor tweaks and cleanup
Tweak some comments and variable names, move things around a bit (default src target is now opt, not debug), only clean what's built, use +warn_export_vars.
Diffstat (limited to 'lib')
-rw-r--r--lib/diameter/src/Makefile101
-rw-r--r--lib/diameter/src/modules.mk14
-rw-r--r--lib/diameter/test/Makefile77
-rw-r--r--lib/diameter/test/modules.mk2
4 files changed, 88 insertions, 106 deletions
diff --git a/lib/diameter/src/Makefile b/lib/diameter/src/Makefile
index 6b3a5e340e..ea1e43875e 100644
--- a/lib/diameter/src/Makefile
+++ b/lib/diameter/src/Makefile
@@ -46,15 +46,14 @@ INCDIR = ../include
VPATH = .:base:compiler:transport:gen
# ----------------------------------------------------
-# Target Specs
+# Target specs
# ----------------------------------------------------
include modules.mk
-DICT_FILES = $(RT_DICTS:%=dict/%.dia)
-DICT_MODULES = $(RT_DICTS:%=gen/diameter_gen_%)
-DICT_ERL_FILES = $(DICT_MODULES:%=%.erl)
-DICT_HRL_FILES = $(DICT_MODULES:%=%.hrl)
+DICT_MODULES = $(DICTS:%=gen/diameter_gen_%)
+DICT_ERLS = $(DICT_MODULES:%=%.erl)
+DICT_HRLS = $(DICT_MODULES:%=%.hrl)
# Modules to build before compiling dictionaries.
COMPILER_MODULES = $(filter compiler/%, $(CT_MODULES))
@@ -91,11 +90,8 @@ APPUP_FILE = diameter.appup
APPUP_SRC = $(APPUP_FILE).src
APPUP_TARGET = $(EBIN)/$(APPUP_FILE)
-EXAMPLE_FILES = $(EXAMPLES:%=../examples/%)
-BIN_FILES = $(BINS:%=../bin/%)
-
# ----------------------------------------------------
-# FLAGS
+# Flags
# ----------------------------------------------------
ifeq ($(TYPE),debug)
@@ -105,27 +101,39 @@ endif
ERL_COMPILE_FLAGS += \
+'{parse_transform,sys_pre_attributes}' \
+'{attribute,insert,app_vsn,$(APP_VSN)}' \
+ +warn_export_vars \
+warn_unused_vars \
-pa $(realpath $(EBIN)) \
-I $(INCDIR) \
-I gen
-# -pa is so that we can include_lib from our include directory. The
-# path has to be absolute to contain the application name.
+# -pa is to be able to include_lib from the include directory: the
+# path must contain the application name.
# ----------------------------------------------------
# Targets
# ----------------------------------------------------
+# erl/hrl from dictionary file.
+gen/diameter_gen_%.erl gen/diameter_gen_%.hrl: dict/%.dia
+ ../bin/diameterc -o gen -i $(EBIN) $<
+
+opt: $(TARGET_FILES)
+
debug:
@$(MAKE) TYPE=debug opt
-opt: $(TARGET_FILES)
+# Generate the app file.
+$(APP_TARGET): $(APP_SRC) ../vsn.mk modules.mk
+ M=`echo $(notdir $(APP_MODULES)) | tr ' ' ,`; \
+ sed -e 's;%VSN%;$(VSN);' \
+ -e "s;%MODULES%;$$M;" \
+ $< > $@
-clean:
- rm -f $(TARGET_FILES) $(DICT_ERL_FILES) $(DICT_HRL_FILES)
- rm -f $(APP_TARGET) $(APPUP_TARGET)
- rm -f errs core *~ gen/diameter_gen_*.forms gen/diameter_gen_*.spec
- rm -f depend.mk
+$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
+ sed -e 's;%VSN%;$(VSN);' $< > $@
+
+app: $(APP_TARGET) $(APPUP_TARGET)
+dict: $(DICT_ERLS)
docs:
@@ -133,7 +141,7 @@ list = echo $(1):; echo $($(1)) | tr ' ' '\n' | sort | sed 's@^@ @'
info:
@echo ========================================
- @$(call list,RT_DICTS)
+ @$(call list,DICTS)
@echo
@$(call list,RT_MODULES)
@echo
@@ -143,38 +151,21 @@ info:
@echo
@$(call list,TARGET_DIRS)
@echo
- @$(call list,EXTERNAL_HRL_FILES)
+ @$(call list,EXTERNAL_HRLS)
@echo
- @$(call list,INTERNAL_HRL_FILES)
+ @$(call list,INTERNAL_HRLS)
@echo
- @$(call list,EXAMPLE_FILES)
+ @$(call list,EXAMPLES)
@echo
- @$(call list,BIN_FILES)
+ @$(call list,BINS)
@echo ========================================
-# ----------------------------------------------------
-# Special Build Targets
-# ----------------------------------------------------
-
-# erl/hrl from dictionary file.
-gen/diameter_gen_%.erl gen/diameter_gen_%.hrl: dict/%.dia
- ../bin/diameterc -o gen -i $(EBIN) $<
-
-# Generate the app file.
-$(APP_TARGET): $(APP_SRC) ../vsn.mk modules.mk
- M=`echo $(notdir $(APP_MODULES)) | tr ' ' ,`; \
- sed -e 's;%VSN%;$(VSN);' \
- -e "s;%MODULES%;$$M;" \
- $< > $@
-
-$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
- sed -e 's;%VSN%;$(VSN);' $< > $@
-
-app: $(APP_TARGET) $(APPUP_TARGET)
-dict: $(DICT_ERL_FILES)
+clean:
+ rm -f $(TARGET_FILES) $(DICT_ERLS) $(DICT_HRLS)
+ rm -f depend.mk
# ----------------------------------------------------
-# Release Target
+# Release targets
# ----------------------------------------------------
ifeq ($(ERL_TOP),)
@@ -186,21 +177,21 @@ endif
release_spec: opt
$(INSTALL_DIR) $(RELSYSDIR)/bin \
$(RELSYSDIR)/ebin \
- $(RELSYSDIR)/src/dict \
- $(TARGET_DIRS:%=$(RELSYSDIR)/src/%) \
+ $(RELSYSDIR)/examples \
$(RELSYSDIR)/include \
- $(RELSYSDIR)/examples
- $(INSTALL_SCRIPT) $(BIN_FILES) $(RELSYSDIR)/bin
+ $(RELSYSDIR)/src/dict \
+ $(TARGET_DIRS:%/=$(RELSYSDIR)/src/%)
+ $(INSTALL_SCRIPT) $(BINS:%=../bin/%) $(RELSYSDIR)/bin
$(INSTALL_DATA) $(TARGET_FILES) $(RELSYSDIR)/ebin
- $(INSTALL_DATA) $(DICT_FILES) $(RELSYSDIR)/src/dict
- $(INSTALL_DATA) $(EXTERNAL_HRL_FILES) $(DICT_HRL_FILES) \
+ $(INSTALL_DATA) $(EXAMPLES:%=../examples/%) $(RELSYSDIR)/examples
+ $(INSTALL_DATA) $(EXTERNAL_HRLS:%=../include/%) $(DICT_HRLS) \
$(RELSYSDIR)/include
- $(INSTALL_DATA) $(EXAMPLE_FILES) $(RELSYSDIR)/examples
+ $(INSTALL_DATA) $(DICTS:%=dict/%.dia) $(RELSYSDIR)/src/dict
$(MAKE) $(TARGET_DIRS:%/=release_src_%)
$(TARGET_DIRS:%/=release_src_%): release_src_%:
$(INSTALL_DATA) $(filter $*/%,$(TARGET_MODULES:%=%.erl) \
- $(INTERNAL_HRL_FILES)) \
+ $(INTERNAL_HRLS)) \
$(RELSYSDIR)/src/$*
release_docs_spec:
@@ -231,13 +222,17 @@ depend.mk: depend.sed $(MODULES:%=%.erl) Makefile
-include depend.mk
-.PRECIOUS: $(DICT_ERL_FILES) $(DICT_HRL_FILES)
+.PRECIOUS: $(DICT_ERLS) $(DICT_HRLS)
.PHONY: app clean depend dict info release_subdir
.PHONY: debug opt release_docs_spec release_spec
.PHONY: $(TARGET_DIRS:%/=%) $(TARGET_DIRS:%/=release_src_%)
+# ----------------------------------------------------
+# Targets using secondary expansion
+# ----------------------------------------------------
+
.SECONDEXPANSION:
-# Make the modules from a subdirectory.
+# Make beams from a subdirectory.
$(TARGET_DIRS:%/=%): \
$$(patsubst $$@/%,$(EBIN)/%.$(EMULATOR),$$(filter $$@/%,$(TARGET_MODULES)))
diff --git a/lib/diameter/src/modules.mk b/lib/diameter/src/modules.mk
index ef72bab17b..c7cbe598af 100644
--- a/lib/diameter/src/modules.mk
+++ b/lib/diameter/src/modules.mk
@@ -19,7 +19,7 @@
# Runtime dictionary files in ./dict. Modules will be generated from
# these are included in the app file.
-RT_DICTS = \
+DICTS = \
base_rfc3588 \
base_accounting \
relay
@@ -66,13 +66,13 @@ CT_MODULES = \
compiler/diameter_spec_util \
compiler/diameter_make
-# Released hrl files intended for public consumption.
-EXTERNAL_HRL_FILES = \
- ../include/diameter.hrl \
- ../include/diameter_gen.hrl
+# Released hrl files in ../include intended for public consumption.
+EXTERNAL_HRLS = \
+ diameter.hrl \
+ diameter_gen.hrl
-# Release hrl files intended for private use.
-INTERNAL_HRL_FILES = \
+# Released hrl files intended for private use.
+INTERNAL_HRLS = \
base/diameter_internal.hrl \
base/diameter_types.hrl \
compiler/diameter_forms.hrl
diff --git a/lib/diameter/test/Makefile b/lib/diameter/test/Makefile
index 8df7cc85fe..69bcabbfbb 100644
--- a/lib/diameter/test/Makefile
+++ b/lib/diameter/test/Makefile
@@ -22,7 +22,6 @@ include $(DIAMETER_TOP)/make/$(TARGET)/rules.mk
else
include $(ERL_TOP)/make/target.mk
include $(ERL_TOP)/make/$(TARGET)/otp.mk
-DIAMETER_TOP = $(ERL_TOP)/lib/diameter
endif
# ----------------------------------------------------
@@ -45,18 +44,11 @@ RELSYSDIR = $(RELEASE_PATH)/diameter_test
include modules.mk
-EBIN = .
-
-HRL_FILES = $(INTERNAL_HRL_FILES)
-ERL_FILES = $(MODULES:%=%.erl)
-
-SOURCE = $(HRL_FILES) $(ERL_FILES)
+ERL_FILES = $(MODULES:%=%.erl)
TARGET_FILES = $(MODULES:%=%.$(EMULATOR))
SUITE_MODULES = $(filter diameter_%_SUITE, $(MODULES))
-SUITES = $(SUITE_MODULES:diameter_%_SUITE=%)
-
-RELTEST_FILES = $(TEST_SPEC_FILE) $(COVER_SPEC_FILE) $(SOURCE)
+SUITES = $(SUITE_MODULES:diameter_%_SUITE=%)
# ----------------------------------------------------
# FLAGS
@@ -64,9 +56,10 @@ RELTEST_FILES = $(TEST_SPEC_FILE) $(COVER_SPEC_FILE) $(SOURCE)
# This is only used to compile suite locally when running with a
# target like 'all' below. Target release_tests only installs source.
-ERL_COMPILE_FLAGS += +warn_unused_vars \
+ERL_COMPILE_FLAGS += +warn_export_vars \
+ +warn_unused_vars \
-DDIAMETER_CT=true \
- -I $(DIAMETER_TOP)/src/gen
+ -I ../src/gen
# ----------------------------------------------------
# Targets
@@ -82,62 +75,52 @@ clean:
realclean: clean
rm -rf log
- rm -f errs core *~
-
-.PHONY: all tests debug opt clean realclean
docs:
+list = echo $(1):; echo $($(1)) | tr ' ' '\n' | sort | sed 's@^@ @'
+
info:
- @echo "TARGET_FILES = $(TARGET_FILES)"
+ @echo ========================================
+ @$(call list,MODULES)
@echo
- @echo "ERL_COMPILE_FLAGS = $(ERL_COMPILE_FLAGS)"
- @echo "ERL = $(ERL)"
- @echo "ERLC = $(ERLC)"
- @echo
- @echo "HRL_FILES = $(HRL_FILES)"
- @echo "ERL_FILES = $(ERL_FILES)"
- @echo "TARGET_FILES = $(TARGET_FILES)"
- @echo
- @echo "SUITE_MODULES = $(SUITE_MODULES)"
- @echo "SUITES = $(SUITES)"
+ @$(call list,HRL_FILES)
@echo
+ @$(call list,SUITES)
+ @echo ========================================
help:
+ @echo ========================================
+ @echo "Useful targets:"
@echo
- @echo "Targets:"
- @echo
- @echo " all"
- @echo " Run all test suites."
+ @echo " all:"
+ @echo " Compile and run all test suites."
@echo
- @echo " $(SUITES)"
- @echo " Run a specific test suite."
+ @echo " $(SUITES):"
+ @echo " Compile and run a specific test suite."
@echo
- @echo " tests"
+ @echo " beam:"
@echo " Compile all test-code."
@echo
- @echo " clean | realclean"
+ @echo " clean | realclean:"
@echo " Remove generated files."
@echo
- @echo " info"
- @echo " Prints various environment variables."
- @echo " May be useful when debugging this Makefile."
- @echo
- @echo " help"
- @echo " Print this info."
- @echo
+ @echo " info:"
+ @echo " Echo some interesting variables."
+ @echo ========================================
-.PHONY: docs info help
+.PHONY: all beam clean debug docs help info opt realclean tests
# ----------------------------------------------------
# Special Targets
# ----------------------------------------------------
# Exit with a non-zero status if the output looks to indicate failure.
-# diameter_ct:run/1 itself can't tell (it seems).
+# diameter_ct:run/1 itself can't tell (it seems). The absolute -pa is
+# because ct will change directories.
$(SUITES): log tests
$(ERL) -noshell \
- -pa $(DIAMETER_TOP)/ebin \
+ -pa $(realpath ../ebin) \
-sname diameter_test_$@ \
-s diameter_ct run diameter_$@_SUITE \
-s init stop \
@@ -165,7 +148,11 @@ release_docs_spec:
release_tests_spec:
$(INSTALL_DIR) $(RELSYSDIR)
- $(INSTALL_DATA) $(RELTEST_FILES) $(RELSYSDIR)
+ $(INSTALL_DATA) $(TEST_SPEC_FILE) \
+ $(COVER_SPEC_FILE) \
+ $(HRL_FILES) \
+ $(ERL_FILES) \
+ $(RELSYSDIR)
.PHONY: release_spec release_docs_spec release_test_specs
diff --git a/lib/diameter/test/modules.mk b/lib/diameter/test/modules.mk
index 531aca2799..75fdd0bd1d 100644
--- a/lib/diameter/test/modules.mk
+++ b/lib/diameter/test/modules.mk
@@ -38,5 +38,5 @@ MODULES = \
diameter_tls_SUITE \
diameter_failover_SUITE
-INTERNAL_HRL_FILES = \
+HRL_FILES = \
diameter_ct.hrl