1 #------------------------------------------------------------------------------
2 # Make rules for installing scripts and script-modules.
4 # This file is intended for use in Makefile via the include directive, e.g.
6 # include $(BUILD_DIR)/script_rules.mk
8 # It is assumed that the environment has been set by sourcing the build
9 # resource file (buildrc).
11 # This file defines the following rules for library modules:
13 # all, lib, archive, linked_lib, utest, exe, clean, clean_lib, clean_exe,
14 # clean_depend, depend.
16 # Copyright (C) 2002, WSI Corporation
17 #------------------------------------------------------------------------------
19 # For portability, use the Bourne shell within Makefiles.
20 # There have been problems using the C-shell under Linux.
25 # RULES for installing scripts and script modules
27 # EXE_SRC specifies a list of files that contain executable scripts.
28 # Each file in the list will be installed in the $(BIN_DEST) directory
29 # and will be given executable permissions. If the variable EXE_EXT is
30 # set, this extension will be stripped from the end of the source file
31 # when it is installed, e.g. if EXE_SRC = "foo.pl" and EXE_EXT = ".pl",
32 # the executable installed in BIN_DEST will be named "foo".
34 # Installation of library modules works in a similiar fashion, with the
35 # variables MOD_SRC and MOD_EXT taking the place of EXE_SRC and EXE_EXT.
36 # In addition, the Makefile *MUST* specify a destination directory for
37 # installation. Typically, this is set to a subdirectory of BASE_DIR,
38 # e.g. MOD_DEST = $(BASE_DIR)/perllib for perl modules.
40 # The EXE_SRC variable only needs to be set executable scripts need to be
41 # built. Likewise MOD_SRC determines if script modules should be built.
42 # The logic to set "src" to "invalid" is used to prevent shell errors
43 # if either or both of these variables are not set.
45 # However, if MOD_SRC is set, MOD_DEST must also be set to the location
46 # of a valid directory. The same is also true for EXE_SRC and BIN_DEST,
47 # but BIN_DEST is properly set when the buildrc resource file is sourced.
53 if
[ -z
"$${src}" ]; then \
55 else if
[ -z
"$(BIN_DEST)" ]; then \
56 echo
"Error: Binary installation directory BIN_DEST not set" 1>&2;\
58 else if
[ ! -d
"$(BIN_DEST)" ]; then \
59 echo
"Error: BIN_DEST directory $(BIN_DEST) not found" 1>&2 ;\
62 for s in
$${src}; do \
63 if
[ "$${s}" = "invalid" ]; then \
66 out
=`echo $${s} | egrep '.*\.cgi'` > /dev
/null
2>&1; \
67 if
[ "$${out}" != "" ]; then \
70 e
=`echo $$s | sed -e 's/\..*//'` ; \
72 echo
" Installing $$e in $(BIN_DEST)" ; \
73 cp
-f
$$s $(BIN_DEST
)/$$e ; \
74 chmod
555 $(BIN_DEST
)/$$e ; \
79 if
[ -z
"$${src}" ]; then \
81 else if
[ -z
"$(MOD_DEST)" ]; then \
82 echo
"Error: Module installation directory MOD_DEST not set" 1>&2;\
84 else if
[ ! -d
"$(MOD_DEST)" ]; then \
85 echo
"Error: MOD_DEST directory $(MOD_DEST) not found" 1>&2 ;\
88 for s in
$${src}; do \
89 if
[ "$${s}" = "invalid" ]; then \
92 e
=`basename $$s $(MOD_EXT)` ; \
93 echo
" Installing $$e in $(MOD_DEST)" ; \
94 cp
-f
$$s $(MOD_DEST
)/$$e ; \
95 chmod
444 $(MOD_DEST
)/$$e ; \
99 # Include rules for installation of configuration files.
101 include $(BUILD_DIR
)/config_rules.mk
104 # RULES that are not implemented.
106 archive linked_lib
: .FORCE
107 @echo
" make $@ is not implemented for script modules" 1>&2
110 # RULE for building unit test programs.
113 @if
[ -d utest
] ; then \
114 echo
"Making unit tests for `pwd`"; \
123 # RULES for cleaning up derived files.
125 # 'clean' removes any extraneous artifacts of producing script modules or
126 # executables. make clean also removes files core files and backup
129 # 'clean_lib' removes the installed libraries or modules
130 # 'clean_exe' removes the installed executable scripts
132 # A subsequent make will recreate the shared library from the compiled
136 @src
="$(EXE_SRC)" ; \
137 if
[ -z
"$${src}" ]; then \
139 else if
[ -z
"$(BIN_DEST)" ]; then \
140 echo
"Error: Binary installation directory BIN_DEST not set" 1>&2;\
142 else if
[ ! -d
"$(BIN_DEST)" ]; then \
143 echo
"Error: BIN_DEST directory $(BIN_DEST) not found" 1>&2 ;\
146 for s in
$${src}; do \
147 if
[ "$${s}" = "invalid" ]; then \
150 e
=`echo $$s | sed -e 's/\..*//'` ;\
151 echo
" Removing $$e from $(BIN_DEST)" ; \
152 rm -f
$(BIN_DEST
)/$$e ; \
156 @src
="$(MOD_SRC)" ; \
157 if
[ -z
"$${src}" ]; then \
159 else if
[ -z
"$(MOD_DEST)" ]; then \
160 echo
"Error: Module installation directory MOD_DEST not set" 1>&2;\
162 else if
[ ! -d
"$(MOD_DEST)" ]; then \
163 echo
"Error: MOD_DEST directory $(MOD_DEST) not found" 1>&2 ;\
166 for s in
$${src}; do \
167 if
[ "$${s}" = "invalid" ]; then \
170 e
=`basename $$s $(MOD_EXT)` ; \
171 echo
" Removing $$e from $(MOD_DEST)" ; \
172 rm -f
$(MOD_DEST
)/$$e ; \
176 @echo
" Cleaning up script directory `pwd`" ;\
177 /bin
/rm -f Makefile.bak core
*~
#*#
180 # Rules for making dependencies.
181 # These are not implemented for scripts, so the rules do nothing.
183 depend clean_depend
: .FORCE
186 # DO NOT DELETE THIS LINE -- make depend depends on it.