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