try to use cross-mingw if we can find it with WINDOZE=1
[k8jam.git] / defaults / Jambase.install
blobea89dbf6b79d44aa39c210b2d87f6dad1be8aa2a
2 # various install rules
4 rule AddSlash {
5   local _ttt = [ Split "$(<[1])" ] ;
6   local _len = [ ListLength $(_ttt) ];
7   if $(_len) != "0" && $(_ttt[$(_len)]) != "/" { _ttt = "$(<[1])/" ; } else { _ttt = $(<[1]) ; }
8   return $(_ttt) ;
12 rule InstallDestDir {
13   local ddd = [ AddSlash $(DESTDIR) ] ;
14   local spl = [ Split $(<) ] ;
16   if $(spl[1]) != "/" {
17     local ppp = [ AddSlash $(PREFIX) ] ;
18     if ! $(ppp) { ppp = "/usr/local/" ; }
19     if $(ddd) { ppp = $(ddd)$(ppp) ; }
20     return $(ppp)$(<);
21   } else {
22     return $(ddd)$(<) ;
23   }
27 # InstallInto dir : sources ;
28 rule InstallInto {
29   local i t ddir ;
31   t = $(>:G=$(INSTALLGRIST)) ;
32   ddir = [ InstallDestDir $(<) ] ;
34   # Arrange for jam install
35   # Arrange for jam uninstall
36   # sources are in SEARCH_SOURCE
37   # targets are in dir
39   Depends install : $(t) ;
40   Clean uninstall : $(t) ;
41   SEARCH on $(ddir) = $(SEARCH_SOURCE) ;
42   MakeLocate $(t) : $(ddir) ;
44   # For each source, make gristed target name
45   # and Install, Chmod, Chown, and Chgrp
46   for i in $(>) {
47     local tt = $(i:G=$(INSTALLGRIST)) ;
49     Depends $(tt) : $(i) ;
50     Install $(tt) : $(i) ;
51     Chmod $(tt) ;
53     if $(OWNER) && $(CHOWN) {
54       Chown $(tt) ;
55       OWNER on $(tt) = $(OWNER) ;
56     }
57     if $(GROUP) && $(CHGRP) {
58       Chgrp $(tt) ;
59       GROUP on $(tt) = $(GROUP) ;
60     }
61   }
65 # /InstallBin dir : sources ;
67 # Copy _sources_ into _dir_ with mode $(EXEMODE)
69 rule InstallBin {
70   local _t = [ FAppendSuffix $(>) : $(SUFEXE) ] ;
72   InstallInto $(<) : $(_t) ;
73   MODE on $(_t:G=$(INSTALLGRIST)) = $(EXEMODE) ;
77 # /InstallFile dir : sources ;
79 # Copy _sources_ into _dir_ with mode $(FILEMODE)
81 rule InstallFile {
82   InstallInto $(<) : $(>) ;
83   MODE on $(>:G=$(INSTALLGRIST)) = $(FILEMODE) ;
87 # /InstallLib dir : sources ;
89 # Copy _sources_ into _dir_ with mode $(FILEMODE)
91 rule InstallLib {
92   InstallInto $(<) : $(>) ;
93   MODE on $(>:G=$(INSTALLGRIST)) = $(FILEMODE) ;
97 # /InstallMan dir : sources ;
99 #  Copy _sources_ into the appropriate subdirectory of _dir_ with mode
100 #  $(FILEMODE). The subdirectory is manS, where S is the suffix of each of
101 #  sources.
103 rule InstallMan {
104   # Really this just strips the . from the suffix
105   local i s d ;
107   for i in $(>) {
108     switch $(i:S) {
109       case .1 : s = 1 ; case .2 : s = 2 ; case .3 : s = 3 ;
110       case .4 : s = 4 ; case .5 : s = 5 ; case .6 : s = 6 ;
111       case .7 : s = 7 ; case .8 : s = 8 ; case .l : s = l ;
112       case .n : s = n ; case .man : s = 1 ;
113     }
114     d = man$(s) ;
115     InstallInto $(d:R=$(<)) : $(i) ;
116   }
117   MODE on $(>:G=$(INSTALLGRIST)) = $(FILEMODE) ;
121 # /InstallShell dir : sources ;
123 # Copy _sources_ into _dir_ with mode $(SHELLMODE)
125 rule InstallShell {
126   InstallInto $(<) : $(>) ;
127   MODE on $(>:G=$(INSTALLGRIST)) = $(SHELLMODE) ;
131 actions Install {
132   $(CP) $(>) $(<)