| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
PRJ=../../../.. |
| 38 |
SETTINGS=$(PRJ)/settings |
| 39 |
|
| 40 |
include $(SETTINGS)/settings.mk |
| 41 |
include $(SETTINGS)/std.mk |
| 42 |
|
| 43 |
|
| 44 |
SAMPLE_NAME=DevGuideChartExample |
| 45 |
SAMPLE_CLASS_OUT = $(OUT_CLASS)/$(SAMPLE_NAME) |
| 46 |
SAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME) |
| 47 |
|
| 48 |
APP1_NAME=ChartInCalc |
| 49 |
APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar |
| 50 |
APP2_NAME=ChartInDraw |
| 51 |
APP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar |
| 52 |
APP3_NAME=ChartInWriter |
| 53 |
APP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar |
| 54 |
APP4_NAME=ListenAtCalcRangeInDraw |
| 55 |
APP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar |
| 56 |
APP5_NAME=SelectionChangeListener |
| 57 |
APP5_JAR=$(SAMPLE_CLASS_OUT)/$(APP5_NAME).jar |
| 58 |
|
| 59 |
COMP_NAME=JavaSampleChartAddIn |
| 60 |
COMP_PACKAGE = $(OUT_BIN)/$(COMP_NAME).$(UNOOXT_EXT) |
| 61 |
COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOOXT_EXT)") |
| 62 |
COMP_JAR_NAME = $(COMP_NAME).uno.jar |
| 63 |
COMP_JAR = $(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME) |
| 64 |
COMP_MANIFESTFILE = $(SAMPLE_CLASS_OUT)/$(COMP_NAME).uno.Manifest |
| 65 |
COMP_UNOPKG_MANIFEST = $(SAMPLE_CLASS_OUT)/$(COMP_NAME)/META-INF/manifest.xml |
| 66 |
COMP_REGISTERFLAG = $(SAMPLE_GEN_OUT)/devguide_$(COMP_NAME)_register_component.flag |
| 67 |
COMP_COMPONENTS=$(COMP_NAME).components |
| 68 |
|
| 69 |
COMPJAVAFILES = \ |
| 70 |
JavaSampleChartAddIn.java |
| 71 |
|
| 72 |
APP_JAVAFILES = \ |
| 73 |
Helper.java \ |
| 74 |
CalcHelper.java \ |
| 75 |
ChartHelper.java |
| 76 |
|
| 77 |
COMPCLASSFILES= $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(COMPJAVAFILES)) |
| 78 |
|
| 79 |
APP_CLASSFILES= $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(APP_JAVAFILES)) |
| 80 |
APP_CLASSNAMES= $(patsubst %.java,%.class,$(APP_JAVAFILES)) |
| 81 |
|
| 82 |
$(COMP_NAME)_CLASSFILES = $(COMP_NAME).class |
| 83 |
|
| 84 |
SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ |
| 85 |
$(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)) |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
.PHONY: ALL |
| 90 |
ALL : $(SAMPLE_NAME) |
| 91 |
|
| 92 |
include $(SETTINGS)/stdtarget.mk |
| 93 |
|
| 94 |
$(SAMPLE_CLASS_OUT)/%.Manifest : |
| 95 |
-$(MKDIR) $(subst /,$(PS),$(@D)) |
| 96 |
@echo RegistrationClassName: $(basename $(basename $(@F)))> $@ |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
$(SAMPLE_CLASS_OUT)/%.class : %.java $(APP_JAVAFILES) |
| 101 |
-$(MKDIR) $(subst /,$(PS),$(@D)) |
| 102 |
$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $< $(APP_JAVAFILES) |
| 103 |
|
| 104 |
$(COMPCLASSFILES) : $(JAVAFILES) |
| 105 |
-$(MKDIR) $(subst /,$(PS),$(@D)) |
| 106 |
$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $(COMPJAVAFILES) |
| 107 |
|
| 108 |
|
| 109 |
$(SAMPLE_CLASS_OUT)/%.mf : |
| 110 |
-$(MKDIR) $(subst /,$(PS),$(@D)) |
| 111 |
@echo Main-Class: com.sun.star.lib.loader.Loader> $@ |
| 112 |
$(ECHOLINE)>> $@ |
| 113 |
@echo Name: com/sun/star/lib/loader/Loader.class>> $@ |
| 114 |
@echo Application-Class: $*>> $@ |
| 115 |
|
| 116 |
|
| 117 |
$(SAMPLE_CLASS_OUT)/%.jar : $(SAMPLE_CLASS_OUT)/%.mf $(SAMPLE_CLASS_OUT)/%.class |
| 118 |
-$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) |
| 119 |
-$(MKDIR) $(subst /,$(PS),$(@D)) |
| 120 |
+cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $*.mf $**.class $(APP_CLASSNAMES) |
| 121 |
|
| 122 |
+$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) |
| 123 |
|
| 124 |
|
| 125 |
$(COMP_JAR) : $(COMP_MANIFESTFILE) $(COMPCLASSFILES) |
| 126 |
-$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) |
| 127 |
-$(MKDIR) $(subst /,$(PS),$(@D)) |
| 128 |
cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES) |
| 129 |
|
| 130 |
|
| 131 |
$(SAMPLE_CLASS_OUT)/%/manifest.xml : |
| 132 |
-$(MKDIR) $(subst /,$(PS),$(@D)) |
| 133 |
@echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ |
| 134 |
@echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@ |
| 135 |
@echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@ |
| 136 |
@echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-components$(QM)">> $@ |
| 137 |
@echo $(SQM) $(SQM)manifest:full-path="$(QM)$(COMP_COMPONENTS)$(QM)"/$(CSEP)>> $@ |
| 138 |
@echo $(OSEP)/manifest:manifest$(CSEP) >> $@ |
| 139 |
|
| 140 |
|
| 141 |
$(COMP_PACKAGE) : $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) $(COMP_COMPONENTS) |
| 142 |
-$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) |
| 143 |
-$(MKDIR) $(subst /,$(PS),$(@D)) |
| 144 |
$(SDK_ZIP) $@ $(COMP_COMPONENTS) |
| 145 |
cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) ../../bin/$(@F) -u $(<F) |
| 146 |
cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)/$(subst .$(UNOOXT_EXT),,$(@F))) && $(SDK_ZIP) ../../../bin/$(@F) -u META-INF/manifest.xml |
| 147 |
|
| 148 |
$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) |
| 149 |
ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" |
| 150 |
-$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) |
| 151 |
-$(MKDIR) $(subst /,$(PS),$(@D)) |
| 152 |
$(DEPLOYTOOL) $(COMP_PACKAGE_URL) |
| 153 |
@echo flagged > $(subst /,$(PS),$@) |
| 154 |
else |
| 155 |
@echo -------------------------------------------------------------------------------- |
| 156 |
@echo If you want to install your component automatically, please set the environment |
| 157 |
@echo variable SDK_AUTO_DEPLOYMENT = YES. But note that auto deployment is only |
| 158 |
@echo possible if no office instance is running. |
| 159 |
@echo -------------------------------------------------------------------------------- |
| 160 |
endif |
| 161 |
|
| 162 |
$(APP1_JAR) : $(SAMPLE_CLASS_OUT)/$(APP1_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP1_NAME).class |
| 163 |
$(APP2_JAR) : $(SAMPLE_CLASS_OUT)/$(APP2_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP2_NAME).class |
| 164 |
$(APP3_JAR) : $(SAMPLE_CLASS_OUT)/$(APP3_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP3_NAME).class |
| 165 |
$(APP4_JAR) : $(SAMPLE_CLASS_OUT)/$(APP4_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP4_NAME).class |
| 166 |
$(APP5_JAR) : $(SAMPLE_CLASS_OUT)/$(APP5_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP5_NAME).class |
| 167 |
|
| 168 |
$(SAMPLE_NAME) : $(COMP_REGISTERFLAG) $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) $(APP4_JAR) $(APP5_JAR) |
| 169 |
@echo -------------------------------------------------------------------------------- |
| 170 |
@echo When you run the "$(QM)$(APP5_NAME)$(QM)" example please select the |
| 171 |
@echo legend or the title to add a $(APP5_NAME). The example terminates |
| 172 |
@echo when the document is closed. |
| 173 |
@echo - |
| 174 |
@echo Please use the following commands to execute the examples! |
| 175 |
@echo - |
| 176 |
@echo $(MAKE) $(APP1_NAME).run |
| 177 |
@echo $(MAKE) $(APP2_NAME).run |
| 178 |
@echo $(MAKE) $(APP3_NAME).run |
| 179 |
@echo $(MAKE) $(APP4_NAME).run |
| 180 |
@echo $(MAKE) $(APP5_NAME).run |
| 181 |
@echo -------- |
| 182 |
@echo The Chart add-in component was installed if SDK_AUTO_DEPLOYMENT = YES. |
| 183 |
@echo Load the "$(QM)AddInChart.ods$(QM)" document in your office to see the new chart type, |
| 184 |
@echo and see the example description. |
| 185 |
@echo - |
| 186 |
@echo $(MAKE) AddInChart.ods.load |
| 187 |
@echo -------------------------------------------------------------------------------- |
| 188 |
|
| 189 |
%.run: $(SAMPLE_CLASS_OUT)/%.jar |
| 190 |
$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< |
| 191 |
|
| 192 |
AddInChart.ods.load : $(REGISTERFLAG) |
| 193 |
"$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@) |
| 194 |
|
| 195 |
.PHONY: clean |
| 196 |
clean : |
| 197 |
-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) |
| 198 |
-$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT)) |
| 199 |
-$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) |