Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

85 lines (69 sloc) 2.321 kb
SOURCE_DIR=src
EBIN_DIR=ebin
DOC_DIR=doc
INCLUDE_DIR=include
INCLUDES=$(wildcard $(INCLUDE_DIR)/*.hrl)
SOURCES=$(wildcard $(SOURCE_DIR)/*.erl)
TARGETS=$(patsubst $(SOURCE_DIR)/%.erl, $(EBIN_DIR)/%.beam,$(SOURCES))
ERLC_OPTS=-I $(INCLUDE_DIR) -o $(EBIN_DIR) $(INETS_DEF) -Wall +debug_info # +native -v
DIST_DIR=dist
SIGNING_KEY_ID=F8D7D525
VERSION=1.2.0
PACKAGE_NAME=rfc4627_jsonrpc
EZ_NAME=$(PACKAGE_NAME).ez
## The path to httpd.hrl has changed in OTP R14A and newer. Detect the
## change, and supply a compile-time macro definition to allow
## rfc4627_jsonrpc_inets.erl to adapt to the new path.
ifeq ($(shell test R14A \> $$(erl -noshell -eval 'io:format(erlang:system_info(otp_release)), halt().') && echo yes),yes)
INETS_DEF=
else
INETS_DEF=-Dnew_inets
endif
ifeq ($(shell uname -s),Darwin)
SED=gnused
else
SED=sed
endif
all: package
$(EBIN_DIR)/%.beam: $(SOURCE_DIR)/%.erl $(INCLUDES)
erlc $(ERLC_OPTS) $<
clean:
rm -f ebin/*.beam
rm -f $(TARGETS)
rm -rf $(DIST_DIR)
cleandoc:
rm -f doc/*
dist: $(TARGETS)
mkdir -p $(DIST_DIR)
cp -r doc ebin include src test Makefile $(DIST_DIR)
package: $(DIST_DIR)/$(PACKAGE).ez
$(DIST_DIR)/$(PACKAGE).ez: $(TARGETS) dist
mkdir -p $(DIST_DIR)/$(PACKAGE_NAME)
cp -r $(DIST_DIR)/$(EBIN_DIR) $(DIST_DIR)/$(PACKAGE_NAME)
cp -r $(DIST_DIR)/$(INCLUDE_DIR) $(DIST_DIR)/$(PACKAGE_NAME)
(cd $(DIST_DIR); zip -r $(EZ_NAME) $(PACKAGE_NAME))
echo-package-name:
@echo $(PACKAGE_NAME)
distclean: clean
rm -rf $(DIST_DIR)
find . -name '*~' -exec rm {} \;
debian-package: clean
@(cat debian/changelog | head -1 | fgrep -q 'rfc4627-erlang ($(VERSION))') || \
(echo "No changelog entry for version $(VERSION) exists. Aborting."; false)
tar -cf debian-package.tar `ls | grep -v _darcs`
mkdir build
cd build; tar -xf ../debian-package.tar
cd build; dpkg-buildpackage -rfakeroot -k$(SIGNING_KEY_ID)
rm -rf build debian-package.tar
.PHONY: doc
doc: doc/overview.edoc
erl -noshell \
-eval 'edoc:application(rfc4627, ".", [])' \
-run init stop
$(SED) -e 's:\(<p><i>Generated by EDoc\), .*\(</i></p>\):\1\2:' -i doc/*.html
doc/overview.edoc: src/overview.edoc.in
sed -e 's:%%VERSION%%:$(VERSION):g' < $< > $@
test-compile:
erlc $(ERLC_OPTS) $(wildcard test/*.erl)
test: all test-compile
erl -pa ebin -noshell -eval 'passed = test_rfc4627:test_all(), c:q().'
Jump to Line
Something went wrong with that request. Please try again.