Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 0964e94601
Fetching contributors…

Cannot retrieve contributors at this time

326 lines (256 sloc) 10.538 kb
#### CONFIGURE VARIABLE
# export ERLC_EMULATOR to fix a bug in R9B with native compilation
ERLC_EMULATOR=@ERL@
export ERLC_EMULATOR
ERL=@ERL@
ERLC=@ERLC@
SED=@SED@
ERL_OPTS=@ERL_OPTS@
ERLDIR=@ERLDIR@
export ERLDIR
ERLANG_XMERL_DIR=@ERLANG_XMERL_DIR@
raw_erlang_prefix=@libdir@/erlang/
prefix=$(DESTDIR)@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
datadir=@datadir@
TEMPLATES_SUBDIR=@TEMPLATES_SUBDIR@
CONFIGURE_DEPENDENCIES=@CONFIGURE_DEPENDENCIES@
CONFIG_STATUS_DEPENDENCIES=@CONFIG_STATUS_DEPENDENCIES@
VERSION=@PACKAGE_VERSION@
PACKAGE=@PACKAGE_NAME@
DTD=@DTD@
#### END OF SUBSTITUTION
ERL_COMPILER_OPTIONS="[warn_unused_vars]"
export ERL_COMPILER_OPTIONS
ifeq ($(TYPE),debug)
OPT =+debug_info -DDEBUG
else
ifeq ($(TYPE),native)
OPT:=+native
else
OPT =
endif
endif
INC = ./include
CC = $(ERLC)
ESRC = ./src
EBIN = ./ebin
distdir = $(PACKAGE)-$(VERSION)
# installation path
BINDIR = $(bindir)
LIBDIR = $(libdir)/idx-tsunami/bin/
CONFDIR = $(datadir)/doc/idx-tsunami/examples
SHARE_DIR = $(datadir)/idx-tsunami/
TEMPLATES_DIR = $(datadir)/$(TEMPLATES_SUBDIR)
MAN_DIR = $(datadir)/man/man1/
DOC_DIR = $(datadir)/doc/idx-tsunami
ERLANG_LIB_DIR = $(libdir)/erlang/lib
APPLICATION = tsunami
CONTROLLER_APPLICATION = tsunami_controller
RECORDER_APPLICATION = tsunami_recorder
RECORDER_TARGETDIR = $(ERLANG_LIB_DIR)/$(RECORDER_APPLICATION)-$(VERSION)
CONTROLLER_TARGETDIR = $(ERLANG_LIB_DIR)/$(CONTROLLER_APPLICATION)-$(VERSION)
TARGETDIR = $(ERLANG_LIB_DIR)/$(APPLICATION)-$(VERSION)
TEMPLATES = $(wildcard $(ESRC)/templates/*.thtml)
TMP = $(wildcard *~) $(wildcard src/*~) $(wildcard inc/*~)
INC_FILES = $(wildcard $(INC)/*.hrl)
SRC = $(wildcard $(ESRC)/$(APPLICATION)/*.erl)
CONTROLLER_SRC = $(wildcard $(ESRC)/$(CONTROLLER_APPLICATION)/*.erl)
RECORDER_SRC = $(wildcard $(ESRC)/$(RECORDER_APPLICATION)/*.erl)
CONFFILE = idx-tsunami.xml
CONFFILE_SRC = idx-tsunami.xml.in
USERMANUAL = doc/user_manual.html doc/IDXDOC.css
USERMANUAL_IMG = $(wildcard doc/images/*.png)
USERMANUAL_SRC = doc/user_manual.tex
PERL_SCRIPTS_SRC = $(wildcard $(ESRC)/*.pl.in)
PERL_SCRIPTS = $(basename $(PERL_SCRIPTS_SRC))
TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/, $(notdir $(SRC)))))
CONTROLLER_TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/, $(notdir $(CONTROLLER_SRC)))))
RECORDER_TARGET = $(addsuffix .beam, $(basename \
$(addprefix $(EBIN)/, $(notdir $(RECORDER_SRC)))))
DEBIAN = debian/changelog debian/control debian/compat debian/copyright debian/docs debian/idx-tsunami.dirs debian/rules
SRC_APPFILES = $(ESRC)/$(APPLICATION)/$(APPLICATION).app.src $(ESRC)/$(APPLICATION)/$(APPLICATION).rel.src
CONTROLLER_SRC_APPFILES = $(ESRC)/$(CONTROLLER_APPLICATION)/$(CONTROLLER_APPLICATION).app.src $(ESRC)/$(CONTROLLER_APPLICATION)/$(CONTROLLER_APPLICATION).rel.src
RECORDER_SRC_APPFILES = $(ESRC)/$(RECORDER_APPLICATION)/$(RECORDER_APPLICATION).app.src $(ESRC)/$(RECORDER_APPLICATION)/$(RECORDER_APPLICATION).rel.src
TGT_APPFILES_E = $(EBIN)/$(APPLICATION).app
CONTROLLER_TGT_APPFILES_E = $(EBIN)/$(CONTROLLER_APPLICATION).app
RECORDER_TGT_APPFILES_E = $(EBIN)/$(RECORDER_APPLICATION).app
TGT_APPFILES_P = priv/$(APPLICATION)*
RECORDER_TGT_APPFILES_P = priv/$(RECORDER_APPLICATION)*
CONTROLLER_TGT_APPFILES_P = priv/$(CONTROLLER_APPLICATION)*
SCRIPT = $(BINDIR)/idx-tsunami
PWD = $(shell pwd)
BUILD_OPTIONS = '[{systools, \
[{variables,[ \
{"TSUNAMIPATH", "$(PWD)/temp/"}] \
}]}, \
{sh_script, none}, \
{make_app, true }, {make_rel, true}].'
BUILD_OPTIONS_DOT = $(subst $(PWD)/temp/,./,$(BUILD_OPTIONS))
BUILD_OPTIONS_FILE = ./BUILD_OPTIONS
DIST_COMMON=Makefile.in $(CONFFILE_SRC) $(PERL_SCRIPTS_SRC) idx-tsunami.sh.in idx-tsunami.spec.in
.PHONY: doc
idx-tsunami: Makefile config.status $(PERL_SCRIPTS) idx-tsunami.sh idx-tsunami.spec $(TARGET) $(RECORDER_TARGET) $(CONTROLLER_TARGET)
all: clean idx-tsunami
debug:
$(MAKE) TYPE=debug
native:
$(MAKE) TYPE=native
rpm: release idx-tsunami.spec
rpmbuild -ta $(distdir).tar.gz
deb:
fakeroot debian/rules clean
debian/rules build
fakeroot debian/rules binary
clean:
-cd priv && rm -f $(shell ls priv | grep -v builder\.erl| grep -v CVS) && cd ..
-rm -f $(TARGET) $(TMP) $(BUILD_OPTIONS_FILE) builder.beam
-rm -f $(TGT_APPFILES) idx-tsunami.sh $(PERL_SCRIPTS)
-rm -f ebin/*.beam idx-tsunami.sh idx-tsunami.spec idx-tsunami.xml
-make -C doc clean
install: doc boot install_recorder install_controller $(CONFFILE)
-rm -f $(TMP)
install -d $(TARGETDIR)/priv
install -d $(TARGETDIR)/ebin
install -d $(TARGETDIR)/src
install -d $(TARGETDIR)/include
install -d $(LIBDIR)/
install -d $(BINDIR)/
cp $(INC_FILES) $(TARGETDIR)/include
cp $(TARGET) $(TARGETDIR)/ebin
cp builder.beam $(TARGETDIR)/ebin
cp $(TGT_APPFILES_E) $(TARGETDIR)/ebin
cp $(TGT_APPFILES_P) $(TARGETDIR)/priv
cp $(SRC) $(SRC_APPFILES) $(TARGETDIR)/src
echo $(BUILD_OPTIONS_DOT) > $(TARGETDIR)/BUILD_OPTIONS
# install the man page & user's manual
install -d $(MAN_DIR)
install doc/idx-tsunami.1 $(MAN_DIR)
install -d $(DOC_DIR)/images
install $(USERMANUAL) $(DOC_DIR)
install $(USERMANUAL_IMG) $(DOC_DIR)/images
# create startup script
install idx-tsunami.sh $(SCRIPT)
install $(PERL_SCRIPTS) $(LIBDIR)/
install -d $(CONFDIR)
cp $(CONFFILE) $(CONFDIR)
install -d $(TEMPLATES_DIR)
cp $(TEMPLATES) $(TEMPLATES_DIR)
cp $(DTD) $(SHARE_DIR)
install_recorder:
install -d $(RECORDER_TARGETDIR)/priv
install -d $(RECORDER_TARGETDIR)/ebin
install -d $(RECORDER_TARGETDIR)/src
install -d $(RECORDER_TARGETDIR)/include
cp $(INC_FILES) $(RECORDER_TARGETDIR)/include
cp $(RECORDER_TARGET) $(RECORDER_TARGETDIR)/ebin
cp $(RECORDER_TGT_APPFILES_E) $(RECORDER_TARGETDIR)/ebin
cp $(RECORDER_TGT_APPFILES_P) $(RECORDER_TARGETDIR)/priv
cp $(RECORDER_SRC) $(RECORDER_SRC_APPFILES) $(RECORDER_TARGETDIR)/src
echo $(BUILD_OPTIONS_DOT) > $(RECORDER_TARGETDIR)/BUILD_OPTIONS
install_controller:
install -d $(CONTROLLER_TARGETDIR)/priv
install -d $(CONTROLLER_TARGETDIR)/ebin
install -d $(CONTROLLER_TARGETDIR)/src
install -d $(CONTROLLER_TARGETDIR)/include
cp $(INC_FILES) $(CONTROLLER_TARGETDIR)/include
cp $(CONTROLLER_TARGET) $(CONTROLLER_TARGETDIR)/ebin
cp $(CONTROLLER_TGT_APPFILES_E) $(CONTROLLER_TARGETDIR)/ebin
cp $(CONTROLLER_TGT_APPFILES_P) $(CONTROLLER_TARGETDIR)/priv
cp $(CONTROLLER_SRC) $(CONTROLLER_SRC_APPFILES) $(CONTROLLER_TARGETDIR)/src
echo $(BUILD_OPTIONS_DOT) > $(CONTROLLER_TARGETDIR)/BUILD_OPTIONS
uninstall:
rm -rf $(TARGETDIR) $(SCRIPT)
boot: idx-tsunami priv/tsunami.boot priv/tsunami_recorder.boot priv/tsunami_controller.boot
priv/tsunami.boot: builder.beam $(SRC_APPFILES)
# use builder to make boot file
@rm -rf temp
@mkdir -p temp/lib/$(APPLICATION)-$(VERSION)
@ln -sf $(PWD)/ebin temp/lib/$(APPLICATION)-$(VERSION)/ebin
@ln -sf $(PWD)/src/$(APPLICATION) temp/lib/$(APPLICATION)-$(VERSION)/src
@ln -sf $(PWD)/include temp/lib/$(APPLICATION)-$(VERSION)/include
@ln -sf $(PWD)/priv temp/lib/$(APPLICATION)-$(VERSION)/priv
@ln -sf $(PWD)/builder.beam temp/lib/$(APPLICATION)-$(VERSION)/
@ln -sf $(PWD) temp/lib/$(APPLICATION)-$(VERSION)
@(cd temp/lib/$(APPLICATION)-$(VERSION) \
&& echo $(BUILD_OPTIONS) > $(BUILD_OPTIONS_FILE) \
&& $(ERL) -s builder go -s init stop \
)
@rm -rf temp
priv/tsunami_controller.boot: builder.beam $(CONTROLLER_SRC_APPFILES)
# use builder to make boot file
@rm -rf temp
@mkdir -p temp/lib/$(CONTROLLER_APPLICATION)-$(VERSION)
@ln -sf $(PWD)/ebin temp/lib/$(CONTROLLER_APPLICATION)-$(VERSION)/ebin
@ln -sf $(PWD)/src/$(CONTROLLER_APPLICATION) temp/lib/$(CONTROLLER_APPLICATION)-$(VERSION)/src
@ln -sf $(PWD)/include temp/lib/$(CONTROLLER_APPLICATION)-$(VERSION)/include
@ln -sf $(PWD)/priv temp/lib/$(CONTROLLER_APPLICATION)-$(VERSION)/priv
@ln -sf $(PWD)/builder.beam temp/lib/$(CONTROLLER_APPLICATION)-$(VERSION)/
@(cd temp/lib/$(CONTROLLER_APPLICATION)-$(VERSION) \
&& echo $(BUILD_OPTIONS) > $(BUILD_OPTIONS_FILE) \
&& $(ERL) -s builder go -s init stop \
)
@rm -rf temp
priv/tsunami_recorder.boot: builder.beam $(RECORDER_SRC_APPFILES)
# use builder to make boot file
@rm -rf temp
@mkdir -p temp/lib/$(RECORDER_APPLICATION)-$(VERSION)
@ln -sf $(PWD)/ebin temp/lib/$(RECORDER_APPLICATION)-$(VERSION)/ebin
@ln -sf $(PWD)/src/$(RECORDER_APPLICATION) temp/lib/$(RECORDER_APPLICATION)-$(VERSION)/src
@ln -sf $(PWD)/include temp/lib/$(RECORDER_APPLICATION)-$(VERSION)/include
@ln -sf $(PWD)/priv temp/lib/$(RECORDER_APPLICATION)-$(VERSION)/priv
@ln -sf $(PWD)/builder.beam temp/lib/$(RECORDER_APPLICATION)-$(VERSION)/
@(cd temp/lib/$(RECORDER_APPLICATION)-$(VERSION) \
&& echo $(BUILD_OPTIONS) > $(BUILD_OPTIONS_FILE) \
&& $(ERL) -noshell -s builder go -s init stop \
)
@rm -rf temp
Makefile: Makefile.in config.status
@$(SHELL) ./config.status --file=$@
%.pl: %.pl.in
@$(SHELL) ./config.status --file=$@
%.spec: %.spec.in
@$(SHELL) ./config.status --file=$@
%.xml: %.xml.in
@$(SHELL) ./config.status --file=$@
%.sh :%.sh.in
@$(SHELL) ./config.status --file=$@
config.status: configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
configure: configure.in $(CONFIGURE_DEPENDENCIES)
@echo "running autoconf"
@autoconf
doc:
make -C doc
release: Makefile
rm -fr $(distdir)
mkdir -p $(distdir)
tar zcf tmp.tgz $(SRC) $(SRC_APPFILES) $(INC_FILES) \
$(CONTROLLER_SRC) $(CONTROLLER_SRC_APPFILES) \
$(RECORDER_SRC) $(RECORDER_SRC_APPFILES) $(TEMPLATES) \
doc/*.erl doc/*.txt doc/*.fig doc/*.png doc/Makefile doc/*.sgml \
$(USERMANUAL) $(USERMANUAL_SRC) $(USERMANUAL_IMG) $(DTD) \
COPYING README LISEZMOI TODO $(CONFFILE_SRC) \
priv/builder.erl idx-tsunami.sh.in vsn.mk \
$(DEBIAN) $(PERL_SCRIPTS_SRC) CONTRIBUTORS CHANGES \
configure configure.in config.guess config.sub Makefile.in \
install-sh idx-tsunami.spec.in idx-tsunami.spec
tar -C $(distdir) -zxf tmp.tgz
mkdir $(distdir)/ebin
tar zvcf $(distdir).tar.gz $(distdir)
rm -fr $(distdir)
rm -fr tmp.tgz
builder.beam: priv/builder.erl
$(CC) $(OPT) -I $(INC) $<
ebin/%.beam: src/$(APPLICATION)/%.erl $(INC_FILES)
$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -o ebin $<
ebin/%.beam: src/$(RECORDER_APPLICATION)/%.erl $(INC_FILES)
$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -o ebin $<
ebin/%.beam: src/$(CONTROLLER_APPLICATION)/%.erl $(INC_FILES)
$(CC) $(OPT) -I $(INC) -I $(ERLANG_XMERL_DIR) -o ebin $<
%:%.sh
# Override makefile default implicit rule
Jump to Line
Something went wrong with that request. Please try again.