xref: /trunk/main/solenv/inc/tg_jar.mk (revision 7871dc3e)
1*7871dc3eSAndrew Rist#**************************************************************
2*7871dc3eSAndrew Rist#
3*7871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4*7871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5*7871dc3eSAndrew Rist#  distributed with this work for additional information
6*7871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7*7871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
8*7871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
9*7871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
10*7871dc3eSAndrew Rist#
11*7871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12*7871dc3eSAndrew Rist#
13*7871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
14*7871dc3eSAndrew Rist#  software distributed under the License is distributed on an
15*7871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*7871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
17*7871dc3eSAndrew Rist#  specific language governing permissions and limitations
18*7871dc3eSAndrew Rist#  under the License.
19*7871dc3eSAndrew Rist#
20*7871dc3eSAndrew Rist#**************************************************************
21*7871dc3eSAndrew Rist
22*7871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir
25cdf0e10cSrcweir.IF "$(VERBOSE)"=="FALSE"
26cdf0e10cSrcweirZIP_VERBOSITY=-q
27cdf0e10cSrcweir.ENDIF
28cdf0e10cSrcweir
29cdf0e10cSrcweir.IF "$(JARTARGETN)"!=""
30cdf0e10cSrcweir
31cdf0e10cSrcweir.IF "$(JARCOMPRESS)"==""
32cdf0e10cSrcweirJARCOMPRESS_FLAG=0
33cdf0e10cSrcweir.ENDIF
34cdf0e10cSrcweir
35cdf0e10cSrcweir.IF "$(NEW_JAR_PACK)"!=""
36cdf0e10cSrcweir$(JARTARGETN) : $(JARMANIFEST) $(JAVACLASSFILES) $(JAVATARGET)
37cdf0e10cSrcweir.ENDIF			# "$(NEW_JAR_PACK)"!=""
38cdf0e10cSrcweir
39cdf0e10cSrcweir.IF "$(NEW_JAR_PACK)"!=""
40cdf0e10cSrcweir.IF "$(JARMANIFEST)"!=""
41cdf0e10cSrcweir
42cdf0e10cSrcweir.IF "$(CUSTOMMANIFESTFILE)"!=""
43cdf0e10cSrcweir
44cdf0e10cSrcweirCUSTOMMANIFESTFILEDEP:=$(MISC)/$(TARGET)_$(CUSTOMMANIFESTFILE:f)
45cdf0e10cSrcweir
46cdf0e10cSrcweir$(MISC)/$(TARGET)_$(CUSTOMMANIFESTFILE:f) : $(subst,/,/ $(DMAKE_WORK_DIR))/$(CUSTOMMANIFESTFILE)
47cdf0e10cSrcweir	$(COMMAND_ECHO)-$(RM) $@
48cdf0e10cSrcweir	$(COMMAND_ECHO)$(COPY) $< $@
49cdf0e10cSrcweir.ENDIF			# "$(CUSTOMMANIFESTFILE)"!=""
50cdf0e10cSrcweir
51cdf0e10cSrcweir$(JARMANIFEST) .PHONY : $(CUSTOMMANIFESTFILEDEP)
52cdf0e10cSrcweir	@@-$(MKDIRHIER) $(@:d)
53cdf0e10cSrcweir	@@-$(RM) $@
54cdf0e10cSrcweir	$(COMMAND_ECHO)echo Manifest-Version: 1.0 > $@
55cdf0e10cSrcweir.IF "$(JARCLASSPATH)" != ""
56cdf0e10cSrcweir    $(COMMAND_ECHO)echo $(USQ)Class-Path: $(JARCLASSPATH)$(USQ) >> $@
57cdf0e10cSrcweir.ENDIF
58cdf0e10cSrcweir# $(RSCREVISION) contains chars that must be quoted (for *NIX shells)
59cdf0e10cSrcweir	$(COMMAND_ECHO)echo $(USQ)Solar-Version: $(RSCREVISION)$(USQ) >> $@
60cdf0e10cSrcweir.IF "$(CUSTOMMANIFESTFILE)"!=""
61cdf0e10cSrcweir	$(COMMAND_ECHO)$(TYPE) $(MISC)/$(TARGET)_$(CUSTOMMANIFESTFILE:f) >> $@
62cdf0e10cSrcweir.ENDIF			# "$(CUSTOMMANIFESTFILE)"!=""
63cdf0e10cSrcweir.ENDIF			# "$(JARMANIFEST)"!=""
64cdf0e10cSrcweir.ENDIF			# "$(NEW_JAR_PACK)"!=""
65cdf0e10cSrcweir
66cdf0e10cSrcweir.IF "$(JARCLASSEXCLUDES)" == ""
67cdf0e10cSrcweirZIPJAR_EXCLUDE=
68cdf0e10cSrcweir.ELSE   # "$(JARCLASSEXCLUDES)" == ""
69cdf0e10cSrcweirZIPJAR_EXCLUDE=$(foreach,i,$(JARCLASSEXCLUDES) -x "$i")
70cdf0e10cSrcweir# format:
71cdf0e10cSrcweir# JARCLASSEXCLUDES=foo/* bar/*
72cdf0e10cSrcweir.ENDIF  # "$(JARCLASSEXCLUDES)" == ""
73cdf0e10cSrcweir
74cdf0e10cSrcweir#
75cdf0e10cSrcweir# build jar
76cdf0e10cSrcweir#
77cdf0e10cSrcweir.IF "$(NOJARDEP)"!="" || "$(NEW_JAR_PACK)"!=""
78cdf0e10cSrcweir$(JARTARGETN) .PHONY :
79cdf0e10cSrcweir#  $(JARMANIFEST)
80cdf0e10cSrcweir.ELSE			# "$(NOJARDEP)"!="" || "$(NEW_JAR_PACK)"!=""
81cdf0e10cSrcweir.DIRCACHE = no
82cdf0e10cSrcweir$(JARTARGETN) :
83cdf0e10cSrcweir#$(JARTARGETN) .SETDIR=$(CLASSDIR) .SEQUENTIAL : $(JARTARGETDEP) $(shell @-cat -s $(MISC)/$(JARTARGETN).dep )
84cdf0e10cSrcweir.ENDIF			# "$(NOJARDEP)"!="" || "$(NEW_JAR_PACK)"!=""
85cdf0e10cSrcweir.IF "$(OS)$(CPU)"=="SOLARISS"
86cdf0e10cSrcweir	@-find . -type d -user $(USER) ! -perm -5 -print | xargs test "$$1" != "" && chmod +r $$1
87cdf0e10cSrcweir.ENDIF
88cdf0e10cSrcweir.IF "$(JARMANIFEST)"!=""
89cdf0e10cSrcweir	$(COMMAND_ECHO)cd $(CLASSDIR)/$(TARGET) && zip $(ZIP_VERBOSITY) -u -rX ../$(@:f) $(subst,$(CLASSDIR)/$(TARGET)/, $(JARMANIFEST)) $(ZIPJAR_EXCLUDE) $(CHECKZIPRESULT)
90cdf0e10cSrcweir.ENDIF			# "$(JARMANIFEST)"!=""
91cdf0e10cSrcweir	$(COMMAND_ECHO)cd $(CLASSDIR) && zip $(ZIP_VERBOSITY) -u -rX $(@:f) $(subst,\,/ $(JARCLASSDIRS)) $(ZIPJAR_EXCLUDE) $(CHECKZIPRESULT)
92cdf0e10cSrcweir.ENDIF
93cdf0e10cSrcweir
94