1 # ----------------------------------------------------
2 # Make file for creating a release.
3 # ----------------------------------------------------
6 # Basename of this release.
8 RELS
=$(shell basename `pwd`)
10 include ..
/..
/build
/otp.mk
15 ERLWARE_LIB_PATH
=$(ERLWARE_HOME
)/application_packages
/$(TARGET_ERTS_VSN
)/lib
16 FSLIB_DIR
=$(ERLWARE_LIB_PATH
)/$(shell ls
$(ERLWARE_LIB_PATH
) | grep fslib |
sort -r | head
-n
1)
17 INSTALL_DIR
=/usr
/local
/lib
18 ABS_USER_LIBPATH
=$(shell cd ..
/..
/lib
;pwd
)
19 ERL
=$(shell ERL
=$(which erl
); if
[ "$${ERL}" = "" ];then ERL
=$(ERLWARE_HOME
)/bin
/erl
; fi
; echo
$${ERL})
20 FAXIEN
=$(shell FAXIEN
=$(which faxien
); if
[ "$${FAXIEN}" = "" ];then FAXIEN
=$(ERLWARE_HOME
)/bin
/faxien
; fi
; echo
$${FAXIEN})
22 # ----------------------------------------------------
23 # CREATE DIR STRUCTURE HERE
24 # ----------------------------------------------------
26 BUILD_FILES
=fs_boot_smithe.beam fs_lists.beam fs_lib.beam
29 PACKAGE_DIR
=$(RELS
)-$(REL_VSN
)
33 $(LOCAL_DIR
)/log
/$(REL_VSN
) \
35 RELEASE_DEFINITION_FILES
= \
40 LOCAL_RELEASE_DEFINITION_FILES
= \
41 $(LOCAL_DIR
)/$(RELS
).script \
42 $(LOCAL_DIR
)/$(RELS
).boot
44 LOCAL_TARGET_FILES
=$(LOCAL_HTTP_CONF
) $(LOCAL_DIR
)/$(RELS
).config
$(LOCAL_RELEASE_DEFINITION_FILES
)
46 LOCAL_TARGETS
=$(DIR_STRUCTURE
) $(LOCAL_DIR
)/$(RELS
).sh vsnit
$(LOCAL_TARGET_FILES
)
48 # ----------------------------------------------------
50 # ----------------------------------------------------
52 all debug opt instr script
: $(LOCAL_TARGETS
)
54 package
: $(PACKAGE_DIR
)
60 $(RM
) -r
$(PACKAGE_DIR
)
61 $(RM
) $(REL_SCRIPTS
) $(TARGET_FILES
)
62 $(RM
) -r
$(LOCAL_DIR
) $(PRODN_DIR
)
66 $(RM
) $(RELS
).rel.src.tmp
67 $(RM
) $(RELEASE_DEFINITION_FILES
)
69 # ----------------------------------------------------
70 # TARGETS FOR LOCAL MODE
71 # ----------------------------------------------------
73 # startup script for local mode
74 $(LOCAL_DIR
)/$(RELS
).sh
:
75 @echo
'#!/bin/sh' > $@
76 @echo
"cd $(CURDIR)/$(LOCAL_DIR)" >> $@
77 @echo
"$(ERL) -name $${USER}_$(RELS) -boot $(RELS) -config $(RELS).config \$$@" >> $@
80 @echo
"==== Start local node with \"sh $@\" ===="
83 # Create the config file for local mode.
84 $(LOCAL_DIR
)/$(RELS
).config
: $(RELS
).config.src
85 sed
-e
's;%LOG_OTP%;$(CURDIR)/$(LOCAL_DIR)/log/$(REL_VSN);' \
86 -e
's;%REL_NAME%;$(RELS);g' \
87 -e
's;%HOME%;$(HOME);g' \
88 -e
's;%BROADCAST_ADDRESS%;$(BROADCAST_ADDRESS);g' \
89 -e
's;%CONTACT_NODE%;$(CONTACT_NODE);g' \
90 -e
"s;%HOSTNAME%;`hostname --long`;" \
93 # Create the release file for local mode.
94 vsnit
: $(RELS
).rel.src
95 sed
-e
's;%REL_VSN%;$(REL_VSN);' \
96 -e
's;%REL_NAME%;$(RELS);' \
97 -e
's;%ERTS_VSN%;$(TARGET_ERTS_VSN);' \
100 # Create and position script and boot files for local mode.
101 $(LOCAL_RELEASE_DEFINITION_FILES
):
102 @echo
"FSLIB_DIR: $(FSLIB_DIR)"
103 @
$(ERL
) -pz
$(FSLIB_DIR
)/ebin \
105 -s fs_lib commandline_apply fs_boot_smithe make_script_and_boot
[\"$(ERLWARE_LIB_PATH
)/*\",\"$(ERL_RUN_TOP
)/*\",\"$(USR_LIBPATH
)\"] \
106 \"$$(basename `pwd`).rel.src.tmp
\" \
109 mv
$(RELEASE_DEFINITION_FILES
) $(LOCAL_DIR
)/
111 # ----------------------------------------------------
112 # TARGETS FOR PACKAGE CREATION
113 # ----------------------------------------------------
115 # Create the config file for a package.
116 $(PACKAGE_DIR
)/releases
/$(REL_VSN
)/$(RELS
).config
: $(RELS
).config.src
117 mkdir
-p
`dirname $@`
118 sed
-e
's;%LOG_OTP%;/tmp/;' \
119 -e
's;%REL_NAME%;$(RELS);g' \
120 -e
's;%REL_VSN%;$(REL_VSN);g' \
121 -e
's;%HOME%;$(HOME);g' \
122 -e
's;%BROADCAST_ADDRESS%;$(BROADCAST_ADDRESS);g' \
123 -e
's;%CONTACT_NODE%;$(CONTACT_NODE);g' \
126 # Create the executable script
127 $(PACKAGE_DIR
)/bin
/$(RELS
): $(RELS
).src
128 mkdir
-p
$(PACKAGE_DIR
)/bin
129 sed
-e
's;%REL_VSN%;$(REL_VSN);g' \
130 -e
"s;%TARGET_ERTS_VSN%;$(TARGET_ERTS_VSN);" \
131 -e
"s;%INVOCATION_SUFFIX%;-detached;" \
135 $(PACKAGE_DIR
): $(LOCAL_TARGETS
) $(PACKAGE_DIR
)/bin
/$(RELS
) $(PACKAGE_DIR
)/releases
/$(REL_VSN
)/$(RELS
).config
136 cp
$(LOCAL_DIR
)/$(RELS
).rel
$@
/releases
/$(REL_VSN
)
137 @echo
"FSLIB_DIR: $(FSLIB_DIR)"
140 @
$(ERL
) -pz
$(FSLIB_DIR
)/ebin \
142 -s fs_lib commandline_apply fs_boot_smithe stage_apps
[\"$(ERLWARE_LIB_PATH
)/*\",\"$(USR_LIBPATH
)/*\"] \
143 \"$(LOCAL_DIR
)/$(RELS
).rel
\" \
147 # ----------------------------------------------------
148 # TARGETS FOR INSTALLATION
149 # ----------------------------------------------------
151 install: $(PACKAGE_DIR
)
152 $(FAXIEN
) install-release
$(PACKAGE_DIR
)