1 #*************************************************************************
3 # $RCSfile: Makefile,v $
7 # last change: $Author: rt $ $Date: 2008-07-11 14:16:30 $
9 # The Contents of this file are made available subject to the terms of
12 # Copyright (c) 2003 by Sun Microsystems, Inc.
13 # All rights reserved.
15 # Redistribution and use in source and binary forms, with or without
16 # modification, are permitted provided that the following conditions
18 # 1. Redistributions of source code must retain the above copyright
19 # notice, this list of conditions and the following disclaimer.
20 # 2. Redistributions in binary form must reproduce the above copyright
21 # notice, this list of conditions and the following disclaimer in the
22 # documentation and/or other materials provided with the distribution.
23 # 3. Neither the name of Sun Microsystems, Inc. nor the names of its
24 # contributors may be used to endorse or promote products derived
25 # from this software without specific prior written permission.
27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
34 # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #**************************************************************************
41 # Builds the ProtocolHandlerAddon C++ component example of the SDK.
44 SETTINGS
=$(PRJ
)/settings
46 include $(SETTINGS
)/settings.mk
47 include $(SETTINGS
)/std.mk
48 include $(SETTINGS
)/dk.mk
50 # Define non-platform/compiler specific settings
51 COMP_NAME
=ProtocolHandlerAddon_cpp
52 COMP_IMPL_NAME
=$(COMP_NAME
).uno.
$(SHAREDLIB_EXT
)
53 OUT_COMP_INC
=$(OUT_INC
)/$(COMP_NAME
)
54 OUT_COMP_GEN
=$(OUT_MISC
)/$(COMP_NAME
)
55 OUT_COMP_SLO
=$(OUT_SLO
)/$(COMP_NAME
)
56 COMP_PACKAGE
= $(OUT_BIN
)/$(COMP_NAME
).
$(UNOOXT_EXT
)
57 COMP_PACKAGE_URL
= $(subst \\,\
,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
58 COMP_UNOPKG_MANIFEST
= $(OUT_COMP_GEN
)/$(COMP_NAME
)/META-INF
/manifest.xml
59 COMP_MAPFILE
= $(OUT_COMP_GEN
)/$(COMP_NAME
).uno.map
61 REGISTERFLAG
= $(OUT_MISC
)/cpp_
$(COMP_NAME
)_register_component.flag
63 CXXFILES
= component.
cxx \
66 SLOFILES
= $(patsubst %.
cxx,$(OUT_COMP_SLO
)/%.
$(OBJ_EXT
),$(CXXFILES
))
73 include $(SETTINGS
)/stdtarget.mk
75 $(OUT_COMP_SLO
)/%.
$(OBJ_EXT
) : %.
cxx $(SDKTYPEFLAG
)
76 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
77 $(CC
) $(CC_FLAGS
) $(CC_INCLUDES
) -I
$(OUT_COMP_INC
) $(CC_DEFINES
) $(CC_OUTPUT_SWITCH
)$(subst /,$(PS
),$@
) $<
79 $(COMP_MAPFILE
) : $(SLOFILES
)
80 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
81 cat
$(PRJ
)/settings
/component.uno.map
> $(COMP_MAPFILE
)
83 nm
-gx
$(SLOFILES
) |
$(ADDSYMBOLS
) >> $(COMP_MAPFILE
)
87 $(SHAREDLIB_OUT
)/%.
$(SHAREDLIB_EXT
) : $(SLOFILES
)
88 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
89 -$(MKDIR
) $(subst /,$(PS
),$(OUT_COMP_GEN
))
90 $(LINK
) $(COMP_LINK_FLAGS
) /OUT
:$@ \
91 /MAP
:$(OUT_COMP_GEN
)/$(subst $(SHAREDLIB_EXT
),map
,$(@F
)) $(SLOFILES
) \
92 $(CPPUHELPERLIB
) $(CPPULIB
) $(SALLIB
) $(STLPORTLIB
) msvcrt.lib kernel32.lib
93 $(LINK_MANIFEST_VC8_ONLY
)
95 $(SHAREDLIB_OUT
)/%.
$(SHAREDLIB_EXT
) : $(SLOFILES
) $(COMP_MAPFILE
)
96 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
97 $(LINK
) $(COMP_LINK_FLAGS
) $(LINK_LIBS
) -o
$@
$(SLOFILES
) \
98 $(CPPUHELPERLIB
) $(CPPULIB
) $(SALLIB
) $(STLPORTLIB
) $(STC
++LIB
) $(CPPUHELPERDYLIB
) $(CPPUDYLIB
) $(SALDYLIB
)
100 $(INSTALL_NAME_URELIBS
) $@
104 # rule for component package manifest
105 $(OUT_COMP_GEN
)/%/manifest.xml
:
106 -$(MKDIR
) $(subst /,$(PS
),$(@D
))
107 @echo
$(OSEP
)?xml version
="$(QM)1.0$(QM)" encoding
="$(QM)UTF-8$(QM)"?
$(CSEP
) > $@
108 @echo
$(OSEP
)!DOCTYPE manifest
:manifest PUBLIC
"$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP
) >> $@
109 @echo
$(OSEP
)manifest
:manifest xmlns
:manifest
="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP
) >> $@
110 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
111 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)Addons.xcu$(QM)"/$(CSEP
) >> $@
112 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
113 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)ProtocolHandler.xcu$(QM)"/$(CSEP
) >> $@
114 @echo
$(SQM
) $(SQM
)$(OSEP
)manifest
:file-entry manifest
:media-type
="$(QM)application/vnd.sun.star.uno-component;type=native;platform=$(UNOPKG_PLATFORM)$(QM)" >> $@
115 @echo
$(SQM
) $(SQM
)manifest
:full-path
="$(QM)$(subst /META-INF,,$(subst $(OUT_COMP_GEN)/,,$(UNOPKG_PLATFORM)/$(@D))).uno.$(SHAREDLIB_EXT)$(QM)"/$(CSEP
) >> $@
116 @echo
$(OSEP
)/manifest
:manifest
$(CSEP
) >> $@
118 # rule for component package file
119 $(COMP_PACKAGE
) : $(SHAREDLIB_OUT
)/$(COMP_IMPL_NAME
) Addons.xcu ProtocolHandler.xcu
$(COMP_UNOPKG_MANIFEST
)
120 -$(MKDIR
) $(subst /,$(PS
),$(@D
)) && $(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
121 -$(MKDIR
) $(subst /,$(PS
),$(OUT_COMP_GEN
)/$(UNOPKG_PLATFORM
))
122 $(COPY
) $(subst /,$(PS
),$<) $(subst /,$(PS
),$(OUT_COMP_GEN
)/$(UNOPKG_PLATFORM
))
123 cd
$(subst /,$(PS
),$(OUT_COMP_GEN
)) && $(SDK_ZIP
) ..
/..
/bin
/$(@F
) $(UNOPKG_PLATFORM
)/$(<F
)
124 $(SDK_ZIP
) -u
$@ Addons.xcu ProtocolHandler.xcu
125 cd
$(subst /,$(PS
),$(OUT_COMP_GEN
)/$(subst .
$(UNOOXT_EXT
),,$(@F
))) && $(SDK_ZIP
) -u ..
/..
/..
/bin
/$(@F
) META-INF
/manifest.xml
127 $(REGISTERFLAG
) : $(COMP_PACKAGE
)
128 ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES"
129 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$@
))
130 $(DEPLOYTOOL
) $(COMP_PACKAGE_URL
)
131 @echo flagged
> $(subst /,$(PS
),$@
)
133 @echo
--------------------------------------------------------------------------------
134 @echo If you want to
install your component automatically
, please set the environment
135 @echo variable SDK_AUTO_DEPLOYMENT
= YES. But note that auto deployment is only
136 @echo possible if no office instance is running.
137 @echo
--------------------------------------------------------------------------------
140 Example
: $(REGISTERFLAG
)
141 @echo
--------------------------------------------------------------------------------
142 @echo The
"$(QM)ProtocolHandler$(QM)" addon component was installed if SDK_AUTO_DEPLOYMENT
= YES.
143 @echo You can use this component inside your office installation
, see the example
145 @echo
--------------------------------------------------------------------------------
149 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_INC
))
150 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_GEN
))
151 -$(DELRECURSIVE
) $(subst /,$(PS
),$(OUT_COMP_SLO
))
152 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(COMP_PACKAGE_URL
)))
153 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(REGISTERFLAG
)))
154 -$(DEL
) $(subst \\,\
,$(subst /,$(PS
),$(SHAREDLIB_OUT
)/$(COMP_NAME
).
*))