1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: tg_zip.mk,v $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
32 #######################################################
38 avoid_cvs_dir
=-x
"*CVS*" -x
"*.svn*"
43 avoid_cvs_dir
=-x
"*CVS*" -x
"*.svn*"
47 .IF
"$(ZIP$(TNR)TARGET)"!=""
50 .IF
"$(common_build_zip)"!=""
51 .IF
"$(ZIP$(TNR)LIST:s/LANGDIR//)" == "$(ZIP$(TNR)LIST)"
52 ZIP
$(TNR
)TARGETN
=$(COMMONBIN
)/$(ZIP
$(TNR
)TARGET
)$(ZIP
$(TNR
)EXT
)
54 ZIP
$(TNR
)TARGETN
=$(foreach,i
,$(zip
$(TNR
)alllangiso
) $(COMMONBIN
)/$(ZIP
$(TNR
)TARGET
)_
$i$(ZIP
$(TNR
)EXT
) )
56 .ELSE
# "$(common_build_zip)"!=""
57 .IF
"$(ZIP$(TNR)LIST:s/LANGDIR//)" == "$(ZIP$(TNR)LIST)"
58 ZIP
$(TNR
)TARGETN
=$(BIN
)/$(ZIP
$(TNR
)TARGET
)$(ZIP
$(TNR
)EXT
)
60 ZIP
$(TNR
)TARGETN
=$(foreach,i
,$(zip
$(TNR
)alllangiso
) $(BIN
)/$(ZIP
$(TNR
)TARGET
)_
$i$(ZIP
$(TNR
)EXT
) )
62 .ENDIF
# "$(common_build_zip)"!=""
63 ZIP
$(TNR
)DEPFILE
=$(subst,$(COMMON_OUTDIR
),$(OUTPATH
) $(subst,/bin
/,/misc
/ $(ZIP
$(TNR
)TARGETN
:s
/$(ZIP
$(TNR
)EXT
)/.dpzz
/)))
64 ZIPDEPFILES
+=$(ZIP
$(TNR
)DEPFILE
)
66 ZIP
$(TNR
)DIR
*=$(ZIPDIR
)
67 ZIP
$(TNR
)FLAGS
*=$(ZIPFLAGS
)
68 .IF
"$(zip$(TNR)generatedlangs)"!=""
69 zip
$(TNR
)langdirs
*=$(alllangiso
)
70 .ELSE
# "$(zip$(TNR)generatedlangs)"!=""
71 zip
$(TNR
)langdirs
:=$(shell @
-test -d
{$(subst,/$(LANGDIR
), $(null
,$(ZIP
$(TNR
)DIR
) .
$(ZIP
$(TNR
)DIR
)))}/ && find
{$(subst,/$(LANGDIR
), $(null
,$(ZIP
$(TNR
)DIR
) .
$(ZIP
$(TNR
)DIR
)))}/ -type d
! -name CVS
! -name
".svn" ! -name
"." | sed
"s/\.\/\///" | sed
"s/\.\///" )
72 .ENDIF
# "$(zip$(TNR)generatedlangs)"!=""
73 .IF
"$(ZIP$(TNR)FORCEALLLANG)"!=""
74 zip
$(TNR
)alllangiso
:=$(foreach,i
,$(completelangiso
) $(foreach,j
,$(zip
$(TNR
)langdirs
) $(eq
,$i,$j $i $(NULL
))))
75 .ELSE
# "$(ZIP$(TNR)ALLLANG)" != ""
76 zip
$(TNR
)alllangiso
*:=$(foreach,i
,$(alllangiso
) $(foreach,j
,$(zip
$(TNR
)langdirs
) $(eq
,$i,$j $i $(NULL
))))
77 .ENDIF
# "$(ZIP$(TNR)ALLLANG)" != ""
78 .ENDIF
# "$(ZIP$(TNR)TARGET)"!=""
80 .IF
"$(ZIP$(TNR)TARGETN)"!=""
82 ZIP
$(TNR
)TMP
:=$(mktmp iii
)
84 $(MISC
)/$(TARGET
).
$(PWD
:f
).
$(ZIP
$(TNR
)TARGET
).dpzz
: $(ZIP
$(TNR
)TARGETN
)
86 .IF
"$(common_build_zip)"!=""
87 ZIP
$(TNR
)HELPVAR
=$(COMMONBIN
)/$(ZIP
$(TNR
)TARGET
)
88 .ELSE
# "$(common_build_zip)"!=""
89 ZIP
$(TNR
)HELPVAR
=$(BIN
)/$(ZIP
$(TNR
)TARGET
)
90 .ENDIF
# "$(common_build_zip)"!=""
93 echo
# > $(MISC)/$(@:f)
94 .IF
"$(common_build_zip)"!=""
95 .IF
"$(ZIP$(TNR)DIR)" != ""
97 -$(MKDIRHIER
) $(ZIP
$(TNR
)DIR
)
98 $(CDD
) $(subst,LANGDIR
,.
$(subst,/LANGDIR
, $(ZIP
$(TNR
)DIR
))) $(command_seperator
) $(ZIPDEP
) $(ZIP
$(TNR
)FLAGS
) -prefix $(subst,LANGDIR
,.
$(subst,/LANGDIR
, $(ZIP
$(TNR
)DIR
)))/ $(subst,$(OUTPATH
),$(COMMON_OUTDIR
) $(subst,/misc
/,/bin
/ $(@
:s
/.dpzz
/$(ZIP
$(TNR
)EXT
)/))) $(foreach,j
,$(ZIP
$(TNR
)LIST
) "{$(subst,LANGDIR,{$(subst,$(ZIP$(TNR)TARGET)_, $(@:f:b))} $j )}") $(avoid_cvs_dir
) >> $(PWD
)/$(PRJ
)/$(ROUT
)/misc
/$(@
:f
)
99 .ELSE
# "$(ZIP$(TNR)DIR)" != ""
101 -$(ZIPDEP
) $(ZIP
$(TNR
)FLAGS
) $(subst,$(OUTPATH
),$(COMMON_OUTDIR
) $(subst,/misc
/,/bin
/ $(@
:s
/.dpzz
/$(ZIP
$(TNR
)EXT
)/))) $(foreach,j
,$(ZIP
$(TNR
)LIST
) "{$(subst,LANGDIR,{$(subst,$(ZIP$(TNR)TARGET)_, $(@:f:b))} $j )}") $(avoid_cvs_dir
) >> $(MISC
)/$(@
:f
)
102 .ENDIF
# "$(ZIP$(TNR)DIR)" != ""
103 .ELSE
# "$(common_build_zip)"!=""
104 .IF
"$(ZIP$(TNR)DIR)" != ""
106 -$(MKDIRHIER
) $(ZIP
$(TNR
)DIR
)
107 $(CDD
) $(subst,LANGDIR
,.
$(subst,/LANGDIR
, $(ZIP
$(TNR
)DIR
))) $(command_seperator
) $(ZIPDEP
) $(ZIP
$(TNR
)FLAGS
) -prefix $(subst,LANGDIR
,.
$(subst,/LANGDIR
, $(ZIP
$(TNR
)DIR
)))/ $(subst,/misc
/,/bin
/ $(@
:s
/.dpzz
/$(ZIP
$(TNR
)EXT
)/)) $(foreach,j
,$(ZIP
$(TNR
)LIST
) "{$(subst,LANGDIR,{$(subst,$(BIN)/$(ZIP$(TNR)TARGET)_, $(subst,/misc/,/bin/ $(@:db)))} $j )}") $(avoid_cvs_dir
) >> $(PWD
)/$(PRJ
)/$(ROUT
)/misc
/$(@
:f
)
108 .ELSE
# "$(ZIP$(TNR)DIR)" != ""
110 -$(ZIPDEP
) $(ZIP
$(TNR
)FLAGS
) $(subst,/misc
/,/bin
/ $(@
:s
/.dpzz
/$(ZIP
$(TNR
)EXT
)/)) $(foreach,j
,$(ZIP
$(TNR
)LIST
) "{$(subst,LANGDIR,{$(subst,$(BIN)/$(ZIP$(TNR)TARGET)_, $(subst,/misc/,/bin/ $(@:db)))} $j )}") $(avoid_cvs_dir
) >> $(MISC
)/$(@
:f
)
111 .ENDIF
# "$(ZIP$(TNR)DIR)" != ""
112 .ENDIF
# "$(common_build_zip)"!=""
113 @echo
$(@
:n
:s
#\#/#) : makefile.mk >> $(MISC)/$(@:f)
116 $(ZIP
$(TNR
)TARGETN
) : delzip
$(ZIP
$(TNR
)DEPS
)
117 @echo
------------------------------
119 @@
$(!eq
,$?
,$(?
:s
/delzip
/zzz
/) -$(RM
) echo
) $(uniq
$@
$(subst,$(COMMON_OUTDIR
),$(OUTPATH
) $@
))
120 @
$(eq
,$?
,$(?
:s
/delzip
/zzz
/) noop echo
) rebuilding zipfiles
121 @echo
------------------------------ $(eq
,$?
,$(?
:s
/delzip
/zzz
/) >&$(NULLDEV
) )
122 .IF
"$(common_build_zip)"!=""
123 .IF
"$(ZIP$(TNR)DIR)" != ""
124 @@
-$(GNUCOPY
) -p
$@
$(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
)
125 -$(CDD
) $(subst,LANGDIR
,{$(subst,$(ZIP
$(TNR
)HELPVAR
)_
, $(@
:db
))} $(ZIP
$(TNR
)DIR
)) $(command_seperator
) zip
$(ZIP
$(TNR
)FLAGS
) $(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
) $(subst,LANGDIR_away
/, $(ZIP
$(TNR
)LIST
:s
/LANGDIR
/LANGDIR_away
/)) -x delzip
$(avoid_cvs_dir
) $(CHECKZIPRESULT
)
126 $(IFEXIST
) $(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
) $(THEN
) \
127 $(PERL
) -w
$(SOLARENV
)/bin
/cleanzip.pl
$(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
) \
129 $(COPY
) $(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
) $@.
$(INPATH
)
130 $(RM
) $(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
)
131 .ELSE
# "$(ZIP$(TNR)DIR)" != ""
132 @@
-$(GNUCOPY
) -p
$@
$(subst,$(COMMON_OUTDIR
),$(OUTPATH
) $@
)
133 zip
$(ZIP
$(TNR
)FLAGS
) $(subst,$(COMMON_OUTDIR
),$(OUTPATH
) $@
) $(foreach,j
,$(ZIP
$(TNR
)LIST
) $(subst,LANGDIR
,{$(subst,$(ZIP
$(TNR
)HELPVAR
)_
, $(@
:db
))} $j )) -x delzip
$(avoid_cvs_dir
) $(CHECKZIPRESULT
)
134 $(IFEXIST
) $(subst,$(COMMON_OUTDIR
),$(OUTPATH
) $@
) $(THEN
) \
135 $(PERL
) -w
$(SOLARENV
)/bin
/cleanzip.pl
$(subst,$(COMMON_OUTDIR
),$(OUTPATH
) $@
) \
137 @@
-$(GNUCOPY
) -p
$(subst,$(COMMON_OUTDIR
),$(OUTPATH
) $@
) $@.
$(INPATH
)
138 @
-$(RM
) $(subst,$(COMMON_OUTDIR
),$(OUTPATH
) $@
)
139 .ENDIF
# "$(ZIP$(TNR)DIR)" != ""
141 @
$(IFEXIST
) $@.
$(INPATH
) $(THEN
) $(RENAME
:s
/+//) $@.
$(INPATH
) $@
$(FI
)
142 # @$(IFEXIST) $@ $(THEN) $(TOUCH) $@ $(FI) # even if it's not used...
143 .ELSE
# "$(common_build_zip)"!=""
144 .IF
"$(ZIP$(TNR)DIR)" != ""
145 @@
-$(GNUCOPY
) -p
$@
$(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
)
146 -$(CDD
) $(subst,LANGDIR
,{$(subst,$(ZIP
$(TNR
)HELPVAR
)_
, $(@
:db
))} $(ZIP
$(TNR
)DIR
)) $(command_seperator
) zip
$(ZIP
$(TNR
)FLAGS
) $(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
) $(subst,LANGDIR_away
/, $(ZIP
$(TNR
)LIST
:s
/LANGDIR
/LANGDIR_away
/)) -x delzip
$(avoid_cvs_dir
) $(CHECKZIPRESULT
)
147 $(IFEXIST
) $(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
) $(THEN
) \
148 $(PERL
) -w
$(SOLARENV
)/bin
/cleanzip.pl
$(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
) \
150 $(COPY
) $(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
) $@
151 $(RM
) $(ZIP
$(TNR
)TMP
).
$(ZIP
$(TNR
)TARGET
){$(subst,$(ZIP
$(TNR
)HELPVAR
),_
$(@
:db
))}$(ZIP
$(TNR
)EXT
)
152 .ELSE
# "$(ZIP$(TNR)DIR)" != ""
153 zip
$(ZIP
$(TNR
)FLAGS
) $@
$(foreach,j
,$(ZIP
$(TNR
)LIST
) $(subst,LANGDIR
,{$(subst,$(BIN
)/$(ZIP
$(TNR
)TARGET
)_
, $(@
:db
))} $j )) -x delzip
$(avoid_cvs_dir
) $(CHECKZIPRESULT
)
154 $(IFEXIST
) $@
$(THEN
) \
155 $(PERL
) -w
$(SOLARENV
)/bin
/cleanzip.pl
$@ \
157 .ENDIF
# "$(ZIP$(TNR)DIR)" != ""
158 .ENDIF
# "$(common_build_zip)"!=""
162 #######################################################