xref: /aoo41x/main/solenv/inc/tg_zip.mk (revision 8746300d)
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#######################################################
25cdf0e10cSrcweir# unroll begin
26cdf0e10cSrcweir
27cdf0e10cSrcweir.IF "$(GUI)"=="WNT"
28cdf0e10cSrcweircommand_seperator=&&
29cdf0e10cSrcweir#command_seperator=^
30681b9d08SYuri DarioEQ=
31cdf0e10cSrcweiravoid_cvs_dir=-x "*CVS*" -x "*.svn*"
32cdf0e10cSrcweir.ELIF "$(GUI)"=="OS2"
33cdf0e10cSrcweircommand_seperator=&&
34681b9d08SYuri DarioEQ=\\
35*8746300dSYuri Darioavoid_cvs_dir=-x "*CVS*" -x "*.svn*"
36cdf0e10cSrcweir.ELSE
37cdf0e10cSrcweircommand_seperator=;
38681b9d08SYuri DarioEQ=
39cdf0e10cSrcweiravoid_cvs_dir=-x "*CVS*" -x "*.svn*"
40cdf0e10cSrcweir
41cdf0e10cSrcweir.ENDIF
42cdf0e10cSrcweir
43cdf0e10cSrcweir.IF "$(ZIP$(TNR)TARGET)"!=""
44cdf0e10cSrcweir
45cdf0e10cSrcweirZIP$(TNR)EXT*=.zip
46cdf0e10cSrcweir.IF "$(common_build_zip)"!=""
47cdf0e10cSrcweir.IF "$(ZIP$(TNR)LIST:s/LANGDIR//)" == "$(ZIP$(TNR)LIST)"
48cdf0e10cSrcweirZIP$(TNR)TARGETN=$(COMMONBIN)/$(ZIP$(TNR)TARGET)$(ZIP$(TNR)EXT)
49cdf0e10cSrcweir.ELSE
50cdf0e10cSrcweirZIP$(TNR)TARGETN=$(foreach,i,$(zip$(TNR)alllangiso) $(COMMONBIN)/$(ZIP$(TNR)TARGET)_$i$(ZIP$(TNR)EXT) )
51cdf0e10cSrcweir.ENDIF
52cdf0e10cSrcweir.ELSE			# "$(common_build_zip)"!=""
53cdf0e10cSrcweir.IF "$(ZIP$(TNR)LIST:s/LANGDIR//)" == "$(ZIP$(TNR)LIST)"
54cdf0e10cSrcweirZIP$(TNR)TARGETN=$(BIN)/$(ZIP$(TNR)TARGET)$(ZIP$(TNR)EXT)
55cdf0e10cSrcweir.ELSE
56cdf0e10cSrcweirZIP$(TNR)TARGETN=$(foreach,i,$(zip$(TNR)alllangiso) $(BIN)/$(ZIP$(TNR)TARGET)_$i$(ZIP$(TNR)EXT) )
57cdf0e10cSrcweir.ENDIF
58cdf0e10cSrcweir.ENDIF			# "$(common_build_zip)"!=""
59cdf0e10cSrcweirZIP$(TNR)DEPFILE=$(subst,$(COMMON_OUTDIR),$(OUTPATH) $(subst,/bin/,/misc/ $(ZIP$(TNR)TARGETN:s/$(ZIP$(TNR)EXT)/.dpzz/)))
60cdf0e10cSrcweirZIPDEPFILES+=$(ZIP$(TNR)DEPFILE)
61cdf0e10cSrcweir
62cdf0e10cSrcweirZIP$(TNR)DIR*=$(ZIPDIR)
63cdf0e10cSrcweirZIP$(TNR)FLAGS*=$(ZIPFLAGS)
64cdf0e10cSrcweir.IF "$(zip$(TNR)generatedlangs)"!=""
65cdf0e10cSrcweirzip$(TNR)langdirs*=$(alllangiso)
66cdf0e10cSrcweir.ELSE           # "$(zip$(TNR)generatedlangs)"!=""
67cdf0e10cSrcweirzip$(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/\.\///" )
68cdf0e10cSrcweir.ENDIF          # "$(zip$(TNR)generatedlangs)"!=""
69cdf0e10cSrcweir.IF "$(ZIP$(TNR)FORCEALLLANG)"!=""
70cdf0e10cSrcweirzip$(TNR)alllangiso:=$(foreach,i,$(completelangiso) $(foreach,j,$(zip$(TNR)langdirs) $(eq,$i,$j  $i $(NULL))))
71cdf0e10cSrcweir.ELSE          # "$(ZIP$(TNR)ALLLANG)" != ""
72cdf0e10cSrcweirzip$(TNR)alllangiso*:=$(foreach,i,$(alllangiso) $(foreach,j,$(zip$(TNR)langdirs) $(eq,$i,$j  $i $(NULL))))
73cdf0e10cSrcweir.ENDIF          # "$(ZIP$(TNR)ALLLANG)" != ""
74cdf0e10cSrcweir.ENDIF			# "$(ZIP$(TNR)TARGET)"!=""
75cdf0e10cSrcweir
76cdf0e10cSrcweir.IF "$(ZIP$(TNR)TARGETN)"!=""
77cdf0e10cSrcweir
78cdf0e10cSrcweirZIP$(TNR)TMP:=$(mktmp iii)
79cdf0e10cSrcweir
80cdf0e10cSrcweir$(MISC)/$(TARGET).$(PWD:f).$(ZIP$(TNR)TARGET).dpzz : $(ZIP$(TNR)TARGETN)
81cdf0e10cSrcweir
82cdf0e10cSrcweir.IF "$(common_build_zip)"!=""
83cdf0e10cSrcweirZIP$(TNR)HELPVAR=$(COMMONBIN)/$(ZIP$(TNR)TARGET)
84cdf0e10cSrcweir.ELSE			# "$(common_build_zip)"!=""
85cdf0e10cSrcweirZIP$(TNR)HELPVAR=$(BIN)/$(ZIP$(TNR)TARGET)
86cdf0e10cSrcweir.ENDIF			# "$(common_build_zip)"!=""
87cdf0e10cSrcweir
88cdf0e10cSrcweir$(ZIP$(TNR)DEPFILE) :
89cdf0e10cSrcweir	@echo # > $(MISC)/$(@:f)
90cdf0e10cSrcweir.IF "$(common_build_zip)"!=""
91cdf0e10cSrcweir.IF "$(ZIP$(TNR)DIR)" != ""
92cdf0e10cSrcweir	$(COMMAND_ECHO)-$(MKDIRHIER) $(ZIP$(TNR)DIR)
93681b9d08SYuri Dario	$(COMMAND_ECHO)$(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) $(EQ)"{$(subst,LANGDIR,{$(subst,$(ZIP$(TNR)TARGET)_, $(@:f:b))} $j )}$(EQ)") $(avoid_cvs_dir) >> $(PWD)/$(PRJ)/$(ROUT)/misc/$(@:f)
94cdf0e10cSrcweir.ELSE			# "$(ZIP$(TNR)DIR)" != ""
95681b9d08SYuri Dario	$(COMMAND_ECHO)-$(ZIPDEP) $(ZIP$(TNR)FLAGS) $(subst,$(OUTPATH),$(COMMON_OUTDIR) $(subst,/misc/,/bin/ $(@:s/.dpzz/$(ZIP$(TNR)EXT)/))) $(foreach,j,$(ZIP$(TNR)LIST) $(EQ)"{$(subst,LANGDIR,{$(subst,$(ZIP$(TNR)TARGET)_, $(@:f:b))} $j )}$(EQ)") $(avoid_cvs_dir) >> $(MISC)/$(@:f)
96cdf0e10cSrcweir.ENDIF			# "$(ZIP$(TNR)DIR)" != ""
97cdf0e10cSrcweir.ELSE			# "$(common_build_zip)"!=""
98cdf0e10cSrcweir.IF "$(ZIP$(TNR)DIR)" != ""
99cdf0e10cSrcweir	$(COMMAND_ECHO)-$(MKDIRHIER) $(ZIP$(TNR)DIR)
100681b9d08SYuri Dario	$(COMMAND_ECHO)$(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) $(EQ)"{$(subst,LANGDIR,{$(subst,$(BIN)/$(ZIP$(TNR)TARGET)_, $(subst,/misc/,/bin/ $(@:db)))} $j )}$(EQ)") $(avoid_cvs_dir) >> $(PWD)/$(PRJ)/$(ROUT)/misc/$(@:f)
101cdf0e10cSrcweir.ELSE			# "$(ZIP$(TNR)DIR)" != ""
102681b9d08SYuri Dario	$(COMMAND_ECHO)-$(ZIPDEP) $(ZIP$(TNR)FLAGS) $(subst,/misc/,/bin/ $(@:s/.dpzz/$(ZIP$(TNR)EXT)/)) $(foreach,j,$(ZIP$(TNR)LIST) $(EQ)"{$(subst,LANGDIR,{$(subst,$(BIN)/$(ZIP$(TNR)TARGET)_, $(subst,/misc/,/bin/ $(@:db)))} $j )}$(EQ)") $(avoid_cvs_dir) >> $(MISC)/$(@:f)
103cdf0e10cSrcweir.ENDIF			# "$(ZIP$(TNR)DIR)" != ""
104cdf0e10cSrcweir.ENDIF			# "$(common_build_zip)"!=""
105cdf0e10cSrcweir	@echo $(@:n:s#\#/#) : makefile.mk >> $(MISC)/$(@:f)
106cdf0e10cSrcweir
107cdf0e10cSrcweir
108cdf0e10cSrcweir$(ZIP$(TNR)TARGETN) : delzip $(ZIP$(TNR)DEPS)
109cdf0e10cSrcweir	@echo "Making:   " $(@:f)
110cdf0e10cSrcweir    @@$(!eq,$?,$(?:s/delzip/zzz/) -$(RM) echo) $(uniq $@ $(subst,$(COMMON_OUTDIR),$(OUTPATH) $@))
111cdf0e10cSrcweir	@$(eq,$?,$(?:s/delzip/zzz/) noop echo ) rebuilding zipfiles
112534c536dSYuri Dario.IF "$(GUI)" != "OS2"
113cdf0e10cSrcweir	@echo ------------------------------ $(eq,$?,$(?:s/delzip/zzz/) >&$(NULLDEV) )
114534c536dSYuri Dario.ENDIF
115cdf0e10cSrcweir.IF "$(common_build_zip)"!=""
116cdf0e10cSrcweir.IF "$(ZIP$(TNR)DIR)" != ""
117cdf0e10cSrcweir	@@-$(GNUCOPY) -p $@ $(ZIP$(TNR)TMP).$(ZIP$(TNR)TARGET){$(subst,$(ZIP$(TNR)HELPVAR),_ $(@:db))}$(ZIP$(TNR)EXT)
118cdf0e10cSrcweir	$(COMMAND_ECHO)-$(CDD) $(subst,LANGDIR,{$(subst,$(ZIP$(TNR)HELPVAR)_, $(@:db))} $(ZIP$(TNR)DIR)) $(command_seperator) zip $(ZIP_VERBOSITY) $(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)
119cdf0e10cSrcweir	$(COMMAND_ECHO)$(IFEXIST) $(ZIP$(TNR)TMP).$(ZIP$(TNR)TARGET){$(subst,$(ZIP$(TNR)HELPVAR),_ $(@:db))}$(ZIP$(TNR)EXT) $(THEN) \
120cdf0e10cSrcweir	    $(PERL) -w $(SOLARENV)/bin/cleanzip.pl $(ZIP$(TNR)TMP).$(ZIP$(TNR)TARGET){$(subst,$(ZIP$(TNR)HELPVAR),_ $(@:db))}$(ZIP$(TNR)EXT) \
121cdf0e10cSrcweir	    $(FI)
122cdf0e10cSrcweir    $(COMMAND_ECHO)$(COPY) $(ZIP$(TNR)TMP).$(ZIP$(TNR)TARGET){$(subst,$(ZIP$(TNR)HELPVAR),_ $(@:db))}$(ZIP$(TNR)EXT) $@.$(INPATH)
123cdf0e10cSrcweir    $(COMMAND_ECHO)$(RM) $(ZIP$(TNR)TMP).$(ZIP$(TNR)TARGET){$(subst,$(ZIP$(TNR)HELPVAR),_ $(@:db))}$(ZIP$(TNR)EXT)
124cdf0e10cSrcweir.ELSE			# "$(ZIP$(TNR)DIR)" != ""
125cdf0e10cSrcweir	@@-$(GNUCOPY) -p $@ $(subst,$(COMMON_OUTDIR),$(OUTPATH) $@)
126cdf0e10cSrcweir	$(COMMAND_ECHO)zip $(ZIP_VERBOSITY) $(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)
127cdf0e10cSrcweir	$(COMMAND_ECHO)$(IFEXIST) $(subst,$(COMMON_OUTDIR),$(OUTPATH) $@) $(THEN) \
128cdf0e10cSrcweir	    $(PERL) -w $(SOLARENV)/bin/cleanzip.pl $(subst,$(COMMON_OUTDIR),$(OUTPATH) $@) \
129cdf0e10cSrcweir	    $(FI)
130cdf0e10cSrcweir	@@-$(GNUCOPY) -p $(subst,$(COMMON_OUTDIR),$(OUTPATH) $@) $@.$(INPATH)
131cdf0e10cSrcweir	@-$(RM) $(subst,$(COMMON_OUTDIR),$(OUTPATH) $@)
132cdf0e10cSrcweir.ENDIF			# "$(ZIP$(TNR)DIR)" != ""
133cdf0e10cSrcweir	@@-$(RM) $@
134cdf0e10cSrcweir	@$(IFEXIST) $@.$(INPATH) $(THEN) $(RENAME:s/+//) $@.$(INPATH) $@ $(FI)
135cdf0e10cSrcweir#	@$(IFEXIST) $@ $(THEN) $(TOUCH) $@ $(FI)  # even if it's not used...
136cdf0e10cSrcweir.ELSE			# "$(common_build_zip)"!=""
137cdf0e10cSrcweir.IF "$(ZIP$(TNR)DIR)" != ""
138cdf0e10cSrcweir	@@-$(GNUCOPY) -p $@ $(ZIP$(TNR)TMP).$(ZIP$(TNR)TARGET){$(subst,$(ZIP$(TNR)HELPVAR),_ $(@:db))}$(ZIP$(TNR)EXT)
139cdf0e10cSrcweir	$(COMMAND_ECHO)-$(CDD) $(subst,LANGDIR,{$(subst,$(ZIP$(TNR)HELPVAR)_, $(@:db))} $(ZIP$(TNR)DIR)) $(command_seperator) zip $(ZIP_VERBOSITY) $(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)
140cdf0e10cSrcweir	$(COMMAND_ECHO)$(IFEXIST) $(ZIP$(TNR)TMP).$(ZIP$(TNR)TARGET){$(subst,$(ZIP$(TNR)HELPVAR),_ $(@:db))}$(ZIP$(TNR)EXT) $(THEN) \
141cdf0e10cSrcweir	    $(PERL) -w $(SOLARENV)/bin/cleanzip.pl $(ZIP$(TNR)TMP).$(ZIP$(TNR)TARGET){$(subst,$(ZIP$(TNR)HELPVAR),_ $(@:db))}$(ZIP$(TNR)EXT) \
142cdf0e10cSrcweir	    $(FI)
143cdf0e10cSrcweir    $(COMMAND_ECHO)$(COPY) $(ZIP$(TNR)TMP).$(ZIP$(TNR)TARGET){$(subst,$(ZIP$(TNR)HELPVAR),_ $(@:db))}$(ZIP$(TNR)EXT)  $@
144cdf0e10cSrcweir    $(COMMAND_ECHO)$(RM) $(ZIP$(TNR)TMP).$(ZIP$(TNR)TARGET){$(subst,$(ZIP$(TNR)HELPVAR),_ $(@:db))}$(ZIP$(TNR)EXT)
145cdf0e10cSrcweir.ELSE			# "$(ZIP$(TNR)DIR)" != ""
146cdf0e10cSrcweir	$(COMMAND_ECHO)zip $(ZIP_VERBOSITY) $(ZIP$(TNR)FLAGS) $@ $(foreach,j,$(ZIP$(TNR)LIST) $(subst,LANGDIR,{$(subst,$(BIN)/$(ZIP$(TNR)TARGET)_, $(@:db))} $j )) -x delzip $(avoid_cvs_dir) $(CHECKZIPRESULT)
147cdf0e10cSrcweir	$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
148cdf0e10cSrcweir	    $(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
149cdf0e10cSrcweir	    $(FI)
150cdf0e10cSrcweir.ENDIF			# "$(ZIP$(TNR)DIR)" != ""
151cdf0e10cSrcweir.ENDIF			# "$(common_build_zip)"!=""
152cdf0e10cSrcweir.ENDIF
153cdf0e10cSrcweir
154cdf0e10cSrcweir# unroll end
155cdf0e10cSrcweir#######################################################
156cdf0e10cSrcweir
157