xref: /trunk/main/solenv/inc/unitools.mk (revision 86e1cf34)
17871dc3eSAndrew Rist#**************************************************************
27871dc3eSAndrew Rist#
37871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
47871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
57871dc3eSAndrew Rist#  distributed with this work for additional information
67871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
77871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
87871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
97871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
107871dc3eSAndrew Rist#
117871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
127871dc3eSAndrew Rist#
137871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
147871dc3eSAndrew Rist#  software distributed under the License is distributed on an
157871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
167871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
177871dc3eSAndrew Rist#  specific language governing permissions and limitations
187871dc3eSAndrew Rist#  under the License.
197871dc3eSAndrew Rist#
207871dc3eSAndrew Rist#**************************************************************
217871dc3eSAndrew Rist
227871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir# Common tools - move this to the end / consolidate
25cdf0e10cSrcweirTRANSEX*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/transex3
26cdf0e10cSrcweirULFEX*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/ulfex
27cdf0e10cSrcweirXMLEX*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/xmlex
28cdf0e10cSrcweirXRMEX*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/xrmex
29cdf0e10cSrcweirCFGEX*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/cfgex
30cdf0e10cSrcweirAUTODOC*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/autodoc
31cdf0e10cSrcweirLOCALIZE_SL*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/localize_sl
32cdf0e10cSrcweirGSICHECK*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/gsicheck
33cdf0e10cSrcweir
34cdf0e10cSrcweir.IF "$(SYSTEM_LIBXSLT)"!="YES"
35cdf0e10cSrcweirXSLTPROC*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/xsltproc
36cdf0e10cSrcweir.ELSE			# "$(SYSTEM_LIBXSLT)"!="YES"
37cdf0e10cSrcweirXSLTPROC*=$(AUGMENT_LIBRARY_PATH) xsltproc
38cdf0e10cSrcweir.ENDIF			# "$(SYSTEM_LIBXSLT)"!="YES"
39cdf0e10cSrcweir
40cdf0e10cSrcweirULFCONV*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/ulfconv
41cdf0e10cSrcweir
42cdf0e10cSrcweirMAKEDEPEND*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/makedepend
43cdf0e10cSrcweir
44cdf0e10cSrcweirSCP_CHECK_TOOL:=checkscp$E
45cdf0e10cSrcweir
46cdf0e10cSrcweir# iz32110: Calling a cygwin application from a non-cygwin shell requires
47cdf0e10cSrcweir# backslashes to be escaped by another backslash: EES .. extra escape slash
48cdf0e10cSrcweirEES:=
49cdf0e10cSrcweir
50cdf0e10cSrcweir# iz29675: 4nt must not quote special characters, but tcsh has to.
51cdf0e10cSrcweir# *NIX shells needs to use " quotes, but 4nt must not.
52cdf0e10cSrcweir# EMQ .. extra meta quote (\\ at line end is \)
53cdf0e10cSrcweir# USQ .. unix shell  quote
54cdf0e10cSrcweirEMQ:=\\
55cdf0e10cSrcweirUSQ:="
56cdf0e10cSrcweir
57534c536dSYuri Dario.IF "$(GUI)" == "OS2"
58534c536dSYuri DarioNULLDEV:=NUL
59534c536dSYuri Dario.ELSE
60cdf0e10cSrcweirNULLDEV:=/dev/null
61534c536dSYuri Dario.ENDIF
62cdf0e10cSrcweir
63cdf0e10cSrcweir
64cdf0e10cSrcweir# iz29609 helpmacro to check if file exists
65cdf0e10cSrcweirIFEXIST:=if [ -f
6672ef7eedSAndre FischerIFDIREXIST:=if [ -d
67cdf0e10cSrcweirIFNOTEXIST:= if ! test -f
68cdf0e10cSrcweirTHEN:= ] ; then
69cdf0e10cSrcweirFI:= ; fi
70cdf0e10cSrcweirPIPEERROR=2>&1 |
71cdf0e10cSrcweir
72cdf0e10cSrcweir# iz31658
73cdf0e10cSrcweirCHECKZIPRESULT:=|| ret=$$?; if [[ "$$ret" != "12" && "$$ret" != "1" ]] ; then exit $$ret ; fi && echo "Nothing to update for zip"
74cdf0e10cSrcweir
75cdf0e10cSrcweir# Platform specific
76cdf0e10cSrcweir.IF "$(GUI)"=="WNT"
77cdf0e10cSrcweirAWK*=awk
78cdf0e10cSrcweirSORT*=sort
79cdf0e10cSrcweirSED*=sed
80cdf0e10cSrcweirGNUPATCH*=patch
81cdf0e10cSrcweir# change drive and directory
82cdf0e10cSrcweirCDD=cd
83cdf0e10cSrcweir# expect cygwin tools to exist
84cdf0e10cSrcweirCOPY*=cp
85cdf0e10cSrcweirCOPYRECURSE=-r
86cdf0e10cSrcweirDEREFERENCE=-L
87cdf0e10cSrcweirCOPYUPDATE=-u
88cdf0e10cSrcweirECHON=echo -n
89cdf0e10cSrcweirECHONL=echo
90cdf0e10cSrcweirFIND*=find
91cdf0e10cSrcweirFLIPCMD*=$(PERL) $(SOLARENV)/bin/slfl.pl
92cdf0e10cSrcweirGNUCOPY*=cp
93cdf0e10cSrcweirGNUMAKE*=make
94cdf0e10cSrcweirGREP*=grep
95cdf0e10cSrcweirLS*=ls
96cdf0e10cSrcweirPERL*:=perl
97cdf0e10cSrcweir.EXPORT : PERL
98cdf0e10cSrcweirRENAME*=mv
99cdf0e10cSrcweirTOUCH*=touch
100cdf0e10cSrcweirTYPE*=cat
101cdf0e10cSrcweirDUMPBIN*=dumpbin
102cdf0e10cSrcweir
103cdf0e10cSrcweir.ELIF "$(GUI)"=="UNX"	# "$(GUI)"=="WNT"
104cdf0e10cSrcweirSED*=sed
105cdf0e10cSrcweirSORT*=sort
106cdf0e10cSrcweirPERL*=perl
107cdf0e10cSrcweir.EXPORT : PERL
108cdf0e10cSrcweirTYPE=cat
109cdf0e10cSrcweirCDD=cd
110cdf0e10cSrcweirCOPY=cp -f
11162840caaSPedro Giffuni.IF "$(OS)"=="MACOSX" || "$(OS)"=="FREEBSD"
112cdf0e10cSrcweirCOPYRECURSE=-R
11362840caaSPedro Giffuni.ELSE # Not BSD based
114cdf0e10cSrcweirCOPYRECURSE=-r
115cdf0e10cSrcweir.ENDIF
116cdf0e10cSrcweir.IF "$(OS)"=="SOLARIS"
117cdf0e10cSrcweirAWK*=nawk
118cdf0e10cSrcweirGNUCOPY*=gnucp
119cdf0e10cSrcweirGNUPATCH*=gnupatch
120cdf0e10cSrcweirGNUTAR*=/usr/sfw/bin/gtar
121cdf0e10cSrcweirDEREFERENCE=
122cdf0e10cSrcweir.ELSE			# "$(OS)"=="SOLARIS"
123cdf0e10cSrcweirAWK*=awk
124cdf0e10cSrcweir# this is not true, as BSD does not default to a GNU cp, but BSD cp
125cdf0e10cSrcweir# so in dmake makefiles one should be restricted to use the subset
126cdf0e10cSrcweir# of features that both BSD and GNU make support.
127cdf0e10cSrcweir# as the GNU make build system requires GNUCOPY to really be a GNU copy
128cdf0e10cSrcweir# we work around that for now by not setting GNUCOPY in sdev300.ini
129cdf0e10cSrcweir# for fbsd for now, but for all other platforms it is set.
130cdf0e10cSrcweirGNUCOPY*=cp
131cdf0e10cSrcweirGNUPATCH*=patch
13223ba173dSPedro GiffuniGPERF*=gperf
133cdf0e10cSrcweirDEREFERENCE=-L
134cdf0e10cSrcweir.ENDIF			# "$(OS)"=="SOLARIS"
135cdf0e10cSrcweir.IF "$(OS)"=="LINUX" || "$(OS)"=="MACOSX"
136cdf0e10cSrcweirGNUMAKE*=make
137cdf0e10cSrcweir.ELSE			# "$(OS)"=="LINUX" || "$(OS)"=="MACOSX"
138cdf0e10cSrcweirGNUMAKE*=gmake
139cdf0e10cSrcweir.ENDIF			# "$(OS)"=="LINUX" || "$(OS)"=="MACOSX"
140cdf0e10cSrcweirTOUCH=touch
141cdf0e10cSrcweirRENAME=mv
142cdf0e10cSrcweirGREP=grep
143cdf0e10cSrcweirFIND=find
144cdf0e10cSrcweirLS=ls
145cdf0e10cSrcweirECHON=echo -n
146cdf0e10cSrcweirECHONL=echo
147cdf0e10cSrcweir.ELIF "$(GUI)"=="OS2"
148dcefce6cSYuri DarioGPERF*=gperf
149cdf0e10cSrcweirSED*=sed
150cdf0e10cSrcweirSORT*=sort
151cdf0e10cSrcweirPERL*=perl
152cdf0e10cSrcweirTYPE=cat
153cdf0e10cSrcweirCDD=@cd
154534c536dSYuri DarioCOPY=cp -f
155534c536dSYuri DarioCOPYRECURSE=-r
156534c536dSYuri DarioCOPYUPDATE=-u
157cdf0e10cSrcweirDELAY=sleep
1582b25ddf3SYuri DarioECHON*=echo -n
159534c536dSYuri DarioECHONL=echo
160cdf0e10cSrcweirAWK*=awk
161cdf0e10cSrcweirGNUCOPY*=cp
162cdf0e10cSrcweirGNUPATCH*=gnupatch
163cdf0e10cSrcweirGNUMAKE*=make
164534c536dSYuri DarioTOUCH=touch
165cdf0e10cSrcweir#YD rename doesn't work across different drives!
166cdf0e10cSrcweirRENAME=mv
167cdf0e10cSrcweirGREP=grep
168cdf0e10cSrcweirFIND=find
169cdf0e10cSrcweirLS=ls
170cdf0e10cSrcweirDUMPBIN=echo
171cdf0e10cSrcweir
172cdf0e10cSrcweir.ENDIF			# "$(GUI)"=="UNX"
173cdf0e10cSrcweir
174cdf0e10cSrcweir# (Global) Set if not set before
175cdf0e10cSrcweirDELAY*=sleep
176cdf0e10cSrcweirMKDIR*=mkdir$E
177cdf0e10cSrcweirMKDIRHIER*=mkdir$E -p
178cdf0e10cSrcweirRMDIR*=rmdir
179cdf0e10cSrcweirXARGS*=xargs
180cdf0e10cSrcweirGNUTAR*:=tar
181cdf0e10cSrcweir
182cdf0e10cSrcweirRM+=$(RMFLAGS)
183cdf0e10cSrcweirADJUSTVISIBILITY*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/adjustvisibility
184cdf0e10cSrcweirCONVERT*:=$(PERL) $(SOLARENV)/bin/leconvert.pl
185cdf0e10cSrcweirEXECTEST := $(PERL) -w $(SOLARENV)/bin/exectest.pl
186cdf0e10cSrcweirGCCINSTLIB:=$(PERL) -w $(SOLARENV)/bin/gccinstlib.pl
187cdf0e10cSrcweir
188*86e1cf34SPedro Giffuni# The dmake $(PWD) apparently produces paths with symlinks resolved, while the
189cdf0e10cSrcweir# bash pwd command by default produces paths with unresolved symlinks, so that
190cdf0e10cSrcweir# computing PATH_IN_MODULE in settings.mk would fail without the -P flag to the
191cdf0e10cSrcweir# bash pwd command:
192cdf0e10cSrcweirPWDFLAGS = -P
193