xref: /trunk/main/solenv/inc/tg_jar.mk (revision cdf0e10c)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28
29.IF "$(VERBOSE)"=="FALSE"
30ZIP_VERBOSITY=-q
31.ENDIF
32
33.IF "$(JARTARGETN)"!=""
34
35.IF "$(JARCOMPRESS)"==""
36JARCOMPRESS_FLAG=0
37.ENDIF
38
39.IF "$(NEW_JAR_PACK)"!=""
40$(JARTARGETN) : $(JARMANIFEST) $(JAVACLASSFILES) $(JAVATARGET)
41.ENDIF			# "$(NEW_JAR_PACK)"!=""
42
43.IF "$(NEW_JAR_PACK)"!=""
44.IF "$(JARMANIFEST)"!=""
45
46.IF "$(CUSTOMMANIFESTFILE)"!=""
47
48CUSTOMMANIFESTFILEDEP:=$(MISC)/$(TARGET)_$(CUSTOMMANIFESTFILE:f)
49
50$(MISC)/$(TARGET)_$(CUSTOMMANIFESTFILE:f) : $(subst,/,/ $(DMAKE_WORK_DIR))/$(CUSTOMMANIFESTFILE)
51	$(COMMAND_ECHO)-$(RM) $@
52	$(COMMAND_ECHO)$(COPY) $< $@
53.ENDIF			# "$(CUSTOMMANIFESTFILE)"!=""
54
55$(JARMANIFEST) .PHONY : $(CUSTOMMANIFESTFILEDEP)
56	@@-$(MKDIRHIER) $(@:d)
57	@@-$(RM) $@
58	$(COMMAND_ECHO)echo Manifest-Version: 1.0 > $@
59.IF "$(JARCLASSPATH)" != ""
60    $(COMMAND_ECHO)echo $(USQ)Class-Path: $(JARCLASSPATH)$(USQ) >> $@
61.ENDIF
62# $(RSCREVISION) contains chars that must be quoted (for *NIX shells)
63	$(COMMAND_ECHO)echo $(USQ)Solar-Version: $(RSCREVISION)$(USQ) >> $@
64.IF "$(CUSTOMMANIFESTFILE)"!=""
65	$(COMMAND_ECHO)$(TYPE) $(MISC)/$(TARGET)_$(CUSTOMMANIFESTFILE:f) >> $@
66.ENDIF			# "$(CUSTOMMANIFESTFILE)"!=""
67.ENDIF			# "$(JARMANIFEST)"!=""
68.ENDIF			# "$(NEW_JAR_PACK)"!=""
69
70.IF "$(JARCLASSEXCLUDES)" == ""
71ZIPJAR_EXCLUDE=
72.ELSE   # "$(JARCLASSEXCLUDES)" == ""
73ZIPJAR_EXCLUDE=$(foreach,i,$(JARCLASSEXCLUDES) -x "$i")
74# format:
75# JARCLASSEXCLUDES=foo/* bar/*
76.ENDIF  # "$(JARCLASSEXCLUDES)" == ""
77
78#
79# build jar
80#
81.IF "$(NOJARDEP)"!="" || "$(NEW_JAR_PACK)"!=""
82$(JARTARGETN) .PHONY :
83#  $(JARMANIFEST)
84.ELSE			# "$(NOJARDEP)"!="" || "$(NEW_JAR_PACK)"!=""
85.DIRCACHE = no
86$(JARTARGETN) :
87#$(JARTARGETN) .SETDIR=$(CLASSDIR) .SEQUENTIAL : $(JARTARGETDEP) $(shell @-cat -s $(MISC)/$(JARTARGETN).dep )
88.ENDIF			# "$(NOJARDEP)"!="" || "$(NEW_JAR_PACK)"!=""
89.IF "$(OS)$(CPU)"=="SOLARISS"
90	@-find . -type d -user $(USER) ! -perm -5 -print | xargs test "$$1" != "" && chmod +r $$1
91.ENDIF
92.IF "$(JARMANIFEST)"!=""
93	$(COMMAND_ECHO)cd $(CLASSDIR)/$(TARGET) && zip $(ZIP_VERBOSITY) -u -rX ../$(@:f) $(subst,$(CLASSDIR)/$(TARGET)/, $(JARMANIFEST)) $(ZIPJAR_EXCLUDE) $(CHECKZIPRESULT)
94.ENDIF			# "$(JARMANIFEST)"!=""
95	$(COMMAND_ECHO)cd $(CLASSDIR) && zip $(ZIP_VERBOSITY) -u -rX $(@:f) $(subst,\,/ $(JARCLASSDIRS)) $(ZIPJAR_EXCLUDE) $(CHECKZIPRESULT)
96.ENDIF
97
98