[2759] | 1 | #------------------------------------------------------------------------------ |
---|
| 2 | # Make rules for installing binary files to a specified destination |
---|
| 3 | # |
---|
| 4 | # This file is intended for use in Makefile via the include directive, e.g. |
---|
| 5 | # |
---|
| 6 | # include $(BUILD_DIR)/binary_rules.mk |
---|
| 7 | # |
---|
| 8 | # It is assumed that the environment has been set by sourcing the build |
---|
| 9 | # resource file (buildrc). |
---|
| 10 | # |
---|
| 11 | # This file defines the following rules for binary files: |
---|
| 12 | # |
---|
| 13 | # all, binary, utest, exe, clean, clean_lib, clean_exe, |
---|
| 14 | # clean_depend, depend. |
---|
| 15 | # |
---|
| 16 | # Copyright (C) 2002, WSI Corporation |
---|
| 17 | #------------------------------------------------------------------------------ |
---|
| 18 | # |
---|
| 19 | # For portability, use the Bourne shell within Makefiles. |
---|
| 20 | # There have been problems using the C-shell under Linux. |
---|
| 21 | # |
---|
| 22 | SHELL=/bin/sh |
---|
| 23 | |
---|
| 24 | # |
---|
| 25 | # RULES for installing scripts and script modules |
---|
| 26 | # |
---|
| 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". |
---|
| 33 | # |
---|
| 34 | # For tcl packages, MOD_SRC specifies a list of files that contain the |
---|
| 35 | # source code that will make up the package. MOD_NAME specifies the |
---|
| 36 | # file name for the package (this is typically the module name with a |
---|
| 37 | # ".tcl" extension). In addition, the Makefile *MUST* specify a |
---|
| 38 | # destination directory for installation. Typically, this is set to a |
---|
| 39 | # subdirectory of BASE_DIR, e.g. MOD_DEST = $(BASE_DIR)/perllib for perl |
---|
| 40 | # modules. |
---|
| 41 | # |
---|
| 42 | # The EXE_SRC variable only needs to be set executable scripts need to be |
---|
| 43 | # built. Likewise MOD_SRC determines if script modules should be built. |
---|
| 44 | # The logic to set "src" to "invalid" is used to prevent shell errors |
---|
| 45 | # if either or both of these variables are not set. |
---|
| 46 | # |
---|
| 47 | # However, if MOD_SRC is set, MOD_DEST must also be set to the location |
---|
| 48 | # of a valid directory. The same is also true for EXE_SRC and BIN_DEST, |
---|
| 49 | # but BIN_DEST is properly set when the buildrc resource file is sourced. |
---|
| 50 | # |
---|
| 51 | all : binary |
---|
| 52 | |
---|
| 53 | binary: |
---|
| 54 | @src="$(BIN_SRC)" ; \ |
---|
| 55 | if [ -z "$${src}" ]; then \ |
---|
| 56 | src="invalid" ;\ |
---|
| 57 | else if [ -z "$(BIN_DEST)" ]; then \ |
---|
| 58 | echo "Error: Binary installation directory BIN_DEST not set" 1>&2;\ |
---|
| 59 | src="invalid" ;\ |
---|
| 60 | fi; fi; \ |
---|
| 61 | for s in $${src}; do \ |
---|
| 62 | if [ -f $(BIN_DEST)/$${s} ]; then \ |
---|
| 63 | echo " Removing $(BIN_DEST)/$${s}"; \ |
---|
| 64 | rm -f $(BIN_DEST)/$${s}; \ |
---|
| 65 | fi; \ |
---|
| 66 | if [ "$${s}" = "invalid" ]; then \ |
---|
| 67 | continue;\ |
---|
| 68 | fi;\ |
---|
| 69 | echo " Copying $$s to $(BIN_DEST)/$${s}" ; \ |
---|
| 70 | cp $$s $(BIN_DEST)/$${s} ; \ |
---|
| 71 | done; \ |
---|
| 72 | |
---|
| 73 | # |
---|
| 74 | # Include rules for installation of configuration files. |
---|
| 75 | # |
---|
| 76 | include $(BUILD_DIR)/config_rules.mk |
---|
| 77 | |
---|
| 78 | # |
---|
| 79 | # RULES that are not implemented. |
---|
| 80 | # |
---|
| 81 | archive linked_lib: .FORCE |
---|
| 82 | @echo " make $@ is not implemented for binary modules" 1>&2 |
---|
| 83 | |
---|
| 84 | # |
---|
| 85 | # RULE for building unit test programs. |
---|
| 86 | # |
---|
| 87 | utest: .FORCE |
---|
| 88 | @echo " make $@ is not implemented for binary modules" 1>&2 |
---|
| 89 | |
---|
| 90 | .FORCE: |
---|
| 91 | |
---|
| 92 | # |
---|
| 93 | # RULES for cleaning up derived files. |
---|
| 94 | # |
---|
| 95 | # 'clean' removes any extraneous artifacts of producing script modules or |
---|
| 96 | # executables. make clean also removes files core files and backup |
---|
| 97 | # files. |
---|
| 98 | # |
---|
| 99 | # 'clean_lib' removes the installed libraries or modules |
---|
| 100 | # 'clean_exe' removes the installed executable scripts |
---|
| 101 | # |
---|
| 102 | # A subsequent make will recreate the shared library from the compiled |
---|
| 103 | # object files. |
---|
| 104 | # |
---|
| 105 | clean_exe: |
---|
| 106 | @echo " make $@ is not implemented for binary modules" 1>&2 |
---|
| 107 | |
---|
| 108 | clean_lib: |
---|
| 109 | @echo " make $@ is not implemented for binary modules" 1>&2 |
---|
| 110 | |
---|
| 111 | clean: |
---|
| 112 | @echo " Cleaning up binary directory `pwd`" ;\ |
---|
| 113 | /bin/rm -f Makefile.bak core *~ #*# |
---|
| 114 | |
---|
| 115 | # |
---|
| 116 | # Rules for making dependencies. |
---|
| 117 | # These are not implemented for scripts, so the rules do nothing. |
---|
| 118 | # |
---|
| 119 | depend clean_depend: .FORCE |
---|
| 120 | @: |
---|
| 121 | |
---|
| 122 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
---|