Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / odk / examples / cpp / custompanel / Makefile
blobfcbcd20dcedf8584cc10e8d03e14aa318f8dce5d
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 # Builds the custom-tool-panel C++ component example of the SDK.
21 PRJ=../../..
22 SETTINGS=$(PRJ)/settings
24 include $(SETTINGS)/settings.mk
25 include $(SETTINGS)/std.mk
26 include $(SETTINGS)/dk.mk
28 # Define non-platform/compiler specific settings
29 COMP_NAME=custom-tool-panel
30 COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT)
31 OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME)
32 OUT_COMP_GEN=$(OUT_MISC)/$(COMP_NAME)
33 OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME)
34 COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT)
35 COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)")
36 COMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMP_NAME)/META-INF/manifest.xml
37 COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map
38 COMP_COMPONENTS = $(OUT_COMP_GEN)/$(COMP_NAME).components
39 COMP_TYPEFLAG = $(OUT_MISC)/cpp_$(COMP_NAME)_types.flag
41 # Allow deploying the extension when running it
43 #this should be in odk/settings/std.mk
44 OUT_DEPLOY=$(OUT)/deploy
46 OUT_COMP_DEPLOY=$(OUT_DEPLOY)/$(COMP_NAME)
47 OUT_DEPLOY_DIR=$(subst /,$(PS),$(OUT_COMP_DEPLOY))
48 OUT_DEPLOY_URL=$(URLPREFIX)$(OUT_COMP_DEPLOY)
49 ENV_USER_INSTALL=-env:"UserInstallation=$(OUT_DEPLOY_URL)"
50 OFFICE_START_OPTIONS=-nologo -norestore -writer
51 OXT_DEPLOYEDFLAG=$(OUT_MISC)/cpp_$(COMP_NAME)_deployed_oxt.flag
53 CXXFILES = \
54 ctp_factory.cxx \
55 ctp_panel.cxx \
56 ctp_services.cxx
58 SLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(CXXFILES))
60 # Add OSL_DEBUG_LEVEL to compiler the flags (for OSL_TRACE et. al.)
61 ifeq "$(DEBUG)" "yes"
62 CC_FLAGS += -DOSL_DEBUG_LEVEL=2
63 endif
65 # Targets
66 .PHONY: ALL
67 ALL : \
68 CustomToolPanelExample
70 include $(SETTINGS)/stdtarget.mk
72 $(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG)
73 -$(MKDIR) $(subst /,$(PS),$(@D))
74 $(CC) $(CC_FLAGS) $(STL_INCLUDES) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $<
77 #$(COMP_MAPFILE) : $(SLOFILES)
78 # -$(MKDIR) $(subst /,$(PS),$(@D))
79 # cat $(PRJ)/settings/component.uno.map > $(COMP_MAPFILE)
80 #ifeq "$(OS)" "MACOSX"
81 # nm -gx $(SLOFILES) | $(ADDSYMBOLS) >> $(COMP_MAPFILE)
82 #endif
84 ifeq "$(OS)" "WIN"
85 $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
86 -$(MKDIR) $(subst /,$(PS),$(@D))
87 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN))
88 $(LINK) $(COMP_LINK_FLAGS) /OUT:$@ \
89 /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) $(SLOFILES) \
90 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) msvcrt.lib kernel32.lib
91 $(LINK_MANIFEST)
92 else
93 #$(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES) $(COMP_MAPFILE)
94 $(SHAREDLIB_OUT)/%.$(SHAREDLIB_EXT) : $(SLOFILES)
95 -$(MKDIR) $(subst /,$(PS),$(@D))
96 $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(SLOFILES) \
97 $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB)
98 ifeq "$(OS)" "MACOSX"
99 $(INSTALL_NAME_URELIBS) $@
100 endif
101 endif
103 # rule for component package manifest
104 $(OUT_COMP_GEN)/%/manifest.xml :
105 -$(MKDIR) $(subst /,$(PS),$(@D))
106 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
107 @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@
108 @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@
109 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
110 @echo $(SQM) $(SQM)manifest:full-path="$(QM)CalcWindowState.xcu$(QM)"/$(CSEP) >> $@
111 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
112 @echo $(SQM) $(SQM)manifest:full-path="$(QM)DrawWindowState.xcu$(QM)"/$(CSEP) >> $@
113 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
114 @echo $(SQM) $(SQM)manifest:full-path="$(QM)ImpressWindowState.xcu$(QM)"/$(CSEP) >> $@
115 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
116 @echo $(SQM) $(SQM)manifest:full-path="$(QM)WriterWindowState.xcu$(QM)"/$(CSEP) >> $@
117 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.configuration-data$(QM)" >> $@
118 @echo $(SQM) $(SQM)manifest:full-path="$(QM)Factories.xcu$(QM)"/$(CSEP) >> $@
119 @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components;platform=$(UNOPKG_PLATFORM)$(QM)">> $@
120 @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_NAME).components$(QM)"/$(CSEP)>> $@
121 @echo $(OSEP)/manifest:manifest$(CSEP) >> $@
123 $(COMP_COMPONENTS) :
124 -$(MKDIR) $(subst /,$(PS),$(@D))
125 @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@
126 @echo $(OSEP)components xmlns="$(QM)http://openoffice.org/2010/uno-components$(QM)"$(CSEP) >> $@
127 @echo $(SQM) $(SQM)$(OSEP)component loader="$(QM)com.sun.star.loader.SharedLibrary$(QM)" uri="$(QM)$(UNOPKG_PLATFORM)/$(COMP_IMPL_NAME)$(QM)"$(CSEP) >> $@
128 @echo $(SQM) $(SQM)$(OSEP)implementation name="$(QM)org.openoffice.comp.example.custompanel.ToolPanelFactory$(QM)"$(CSEP) >> $@
129 @echo $(SQM) $(SQM)$(OSEP)service name="$(QM)org.openoffice.example.colorpanel.ToolPanelFactory$(QM)"/$(CSEP) >> $@
130 @echo $(SQM) $(SQM)$(OSEP)/implementation$(CSEP) >> $@
131 @echo $(SQM) $(SQM)$(OSEP)/component$(CSEP) >> $@
132 @echo $(OSEP)/components$(CSEP) >> $@
134 # rule for component package file
135 $(COMP_PACKAGE) : $(SHAREDLIB_OUT)/$(COMP_IMPL_NAME) WriterWindowState.xcu CalcWindowState.xcu DrawWindowState.xcu ImpressWindowState.xcu Factories.xcu $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS)
136 -$(MKDIR) $(subst /,$(PS),$(@D)) && $(DEL) $(subst \\,\,$(subst /,$(PS),$@))
137 -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM))
138 $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM))
139 cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_NAME).components
140 cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u ../../bin/$(@F) $(UNOPKG_PLATFORM)/$(<F)
141 $(SDK_ZIP) -u $@ WriterWindowState.xcu CalcWindowState.xcu DrawWindowState.xcu ImpressWindowState.xcu Factories.xcu panel.png
142 cd $(subst /,$(PS),$(OUT_COMP_GEN)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml
144 CustomToolPanelExample : $(COMP_PACKAGE)
145 @echo --------------------------------------------------------------------------------
146 @echo Please use the following command to deploy the example!
147 @echo -
148 @echo $(MAKE) CustomToolPanelExample.run
149 @echo -
150 @echo --------------------------------------------------------------------------------
152 CustomToolPanelExample.run: $(OXT_DEPLOYEDFLAG)
153 "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(OFFICE_START_OPTIONS) $(ENV_USER_INSTALL)
155 $(OXT_DEPLOYEDFLAG) : $(COMP_PACKAGE)
156 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
157 -$(MKDIR) $(subst /,$(PS),$(OUT_DEPLOY))
158 -$(MKDIR) $(subst /,$(PS),$(OUT_DEPLOY_DIR))
159 $(DEPLOYTOOL) $(COMP_PACKAGE_URL) $(ENV_USER_INSTALL)
160 @echo flagged > $(subst /,$(PS),$@)
162 .PHONY: clean
163 clean :
164 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC))
165 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN))
166 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO))
167 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_DEPLOY_DIR))
168 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL)))
169 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_TYPEFLAG)))
170 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(OXT_DEPLOYEDFLAG)))
171 -$(DEL) $(subst \\,\,$(subst /,$(PS),$(SHAREDLIB_OUT)/$(COMP_NAME).*))