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