diff options
author | Rüdiger Timm <rt@openoffice.org> | 2005-01-31 16:11:51 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2005-01-31 16:11:51 +0000 |
commit | 3591f746db91959e911668f03e43a3744190eef3 (patch) | |
tree | 575c2dbee1e7232290a168cd2d93bff5e7e5e185 /odk/examples/java | |
parent | 107a35b08ba243327a3f7368fd78b7762b8beb4f (diff) |
INTEGRATION: CWS sdksample (1.17.4); FILE MERGED
2005/01/28 10:06:25 jsc 1.17.4.16: #i29308# prepare path for del command (windows only)
2004/11/11 10:33:56 jsc 1.17.4.15: #i29308# adapted
2004/10/29 07:33:55 jsc 1.17.4.14: #i29308# cleanup
2004/10/27 11:34:28 jsc 1.17.4.13: #i29308# change laoding of sample documents
2004/10/22 13:05:54 jsc 1.17.4.12: #i35871# adapt for Java 5.0
2004/10/22 11:57:52 jsc 1.17.4.11: #i35871# adapt for Java 5.0
2004/10/22 09:40:48 jsc 1.17.4.10: #i35871# adapt for Java 5.0
2004/10/08 13:58:43 jsc 1.17.4.9: #i29308# insert package manifest
2004/08/24 15:04:26 jsc 1.17.4.8: #i29308# use of new UNO package extension
2004/07/30 14:30:09 jsc 1.17.4.7: #i29308# use quotes for unopath option
2004/07/30 08:36:31 jsc 1.17.4.6: #i29308# adjust ECHOLINE for windows
2004/07/29 12:22:52 jsc 1.17.4.5: #i29308# insert ECHOLINE macro to dump an empty line in manifest files
2004/06/25 15:47:59 jsc 1.17.4.4: #i29308# use of new UNO features
2004/06/07 15:54:52 jsc 1.17.4.3: #i29308# use new bootstrap feature
2004/06/07 12:23:55 jsc 1.17.4.2: #i29308# modify dependcies
2004/06/04 14:50:02 jsc 1.17.4.1: #i29308# use of new UNO features
Diffstat (limited to 'odk/examples/java')
-rw-r--r-- | odk/examples/java/Inspector/Makefile | 195 |
1 files changed, 127 insertions, 68 deletions
diff --git a/odk/examples/java/Inspector/Makefile b/odk/examples/java/Inspector/Makefile index 116a84a080df..dc4efd95b8fd 100644 --- a/odk/examples/java/Inspector/Makefile +++ b/odk/examples/java/Inspector/Makefile @@ -2,9 +2,9 @@ # # $RCSfile: Makefile,v $ # -# $Revision: 1.17 $ +# $Revision: 1.18 $ # -# last change: $Author: rt $ $Date: 2004-05-18 13:30:59 $ +# last change: $Author: rt $ $Date: 2005-01-31 17:11:51 $ # # The Contents of this file are made available subject to the terms of # the BSD license. @@ -48,89 +48,145 @@ include $(SETTINGS)/std.mk include $(SETTINGS)/dk.mk # Define non-platform/compiler specific settings -COMPONENT_NAME=InstanceInspector -OUT_COMP_CLASS=$(OUT_CLASS)/$(COMPONENT_NAME) -OUT_COMP_GEN=$(OUT_MISC)/$(COMPONENT_NAME) -COMPONENT_RDB_NAME=$(COMPONENT_NAME).uno.rdb -COMPONENT_RDB=$(OUT_COMP_GEN)/$(COMPONENT_RDB_NAME) -COMPONENT_PACKAGE=$(OUT_BIN)/$(COMPONENT_NAME).uno.zip -COMPONENT_PACKAGE_URL=$(subst \\,\,"$(COMPONENT_PACKAGE_DIR)$(PS)$(COMPONENT_NAME).uno.zip") -COMPONENT_JAR_NAME=$(COMPONENT_NAME).uno.jar -COMPONENT_JAR=$(OUT_CLASS)/$(COMPONENT_JAR_NAME) -COMPONENT_MANIFESTFILE=$(OUT_COMP_CLASS)/$(COMPONENT_NAME).uno.Manifest -REGISTERFLAG=$(OUT_MISC)$(PS)java_$(COMPONENT_NAME)_register_component.flag - -IDLFILES = XInstanceInspector.idl - -# normally the idl file should be stored in a directory tree fitting the module structure, -# for the example we know the module structure -PACKAGE = org/OpenOffice - -JAVAFILES = InstanceInspector.java \ - Test.java - -GENJAVAFILES = $(patsubst %.idl,$(OUT_COMP_GEN)/$(PACKAGE)/%.java,$(IDLFILES)) -GENURDFILES = $(patsubst %.idl,$(OUT_COMP_GEN)/%.urd,$(IDLFILES)) - -CLASSFILES = $(patsubst %.java,$(OUT_COMP_CLASS)/%.class,$(JAVAFILES)) -CLASSFILES += $(subst $(OUT_COMP_GEN),$(OUT_COMP_CLASS),$(GENJAVAFILES:.java=.class)) - -$(COMPONENT_NAME)_CLASSFILES = $(COMPONENT_NAME).class \ - $(COMPONENT_NAME)$(QUOTE)$$_$(COMPONENT_NAME).class \ - $(COMPONENT_NAME)$(QUOTE)$$1.class \ - $(COMPONENT_NAME)$(QUOTE)$$2.class \ - $(COMPONENT_NAME)$(QUOTE)$$3.class \ - $(COMPONENT_NAME)$(QUOTE)$$4.class - -$(COMPONENT_NAME)_CLASSFILES += $(subst $(OUT_COMP_GEN)/,,$(GENJAVAFILES:.java=.class)) +# we use the sample directory name dor separating this example +# from others in the output directory +SAMPLE_NAME=InstanceInspector +SAMPLE_CLASS_OUT=$(OUT_CLASS)/$(SAMPLE_NAME) +SAMPLE_GEN_OUT=$(OUT_MISC)/$(SAMPLE_NAME) + +# some special macro names for separating the component jar stuff +COMP_NAME=Inspector +COMP_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(COMP_NAME) +COMP_GEN_OUT=$(SAMPLE_GEN_OUT)/$(COMP_NAME) +COMP_RDB_NAME=$(COMP_NAME).uno.rdb +COMP_RDB=$(COMP_GEN_OUT)/$(COMP_RDB_NAME) +COMP_PACKAGE=$(OUT_BIN)/$(COMP_NAME).$(UNOPKG_EXT) +COMP_PACKAGE_URL=$(subst \\,\,"$(COMP_PACKAGE_DIR)$(PS)$(COMP_NAME).$(UNOPKG_EXT)") +COMP_JAR_NAME=$(COMP_NAME).uno.jar +COMP_JAR=$(SAMPLE_CLASS_OUT)/$(COMP_JAR_NAME) +COMP_JAR_MANIFEST=$(COMP_GEN_OUT)/$(COMP_NAME).uno.Manifest +COMP_UNOPKG_MANIFEST = $(COMP_GEN_OUT)/META-INF/manifest.xml +COMP_REGISTERFLAG=$(COMP_GEN_OUT)$(PS)java_$(COMP_NAME)_register_component.flag + +# some special macro names for separating the example jar stuff +APP1_NAME=TestInspector +APP1_CLASS_OUT=$(SAMPLE_CLASS_OUT)/$(APP1_NAME) +APP1_GEN_OUT=$(SAMPLE_GEN_OUT)/$(APP1_NAME) +APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar +APP1_JAR_MANIFEST=$(APP1_GEN_OUT)/$(APP1_NAME).mf + + +IDLFILES = InstanceInspector.idl \ + XInstanceInspector.idl + +# normally the idl file should be stored in a directory tree fitting the +# module structure, for the example we know the module structure +PACKAGE = org/openoffice + +COMP_JAVAFILES = Inspector.java +COMP_CLASSFILES = $(patsubst %.java,$(COMP_CLASS_OUT)/%.class,$(COMP_JAVAFILES)) + +GEN_CLASSFILES = $(patsubst %.idl,$(SAMPLE_CLASS_OUT)/$(PACKAGE)/%.class,$(IDLFILES)) +GEN_TYPELIST = $(subst /,.,$(patsubst %.idl,-T$(PACKAGE)/% ,$(IDLFILES))) +GEN_URDFILES = $(patsubst %.idl,$(SAMPLE_GEN_OUT)/%.urd,$(IDLFILES)) + +# the generated types are necessary for the component and the application jar +GEN_CLASSFILENAMES = $(subst $(SAMPLE_CLASS_OUT)/,,$(GEN_CLASSFILES)) SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ - $(PATH_SEPARATOR)$(OUT_COMP_CLASS)) + $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT)\ + $(PATH_SEPARATOR)$(COMP_CLASS_OUT)\ + $(PATH_SEPARATOR)$(APP1_CLASS_OUT)) # Targets .PHONY: ALL -ALL : JavaInstanceInspectorExample +ALL : JavaInspectorExample include $(SETTINGS)/stdtarget.mk -$(OUT_COMP_CLASS)/%.Manifest : +# rule for component manifest file +$(COMP_GEN_OUT)/%.Manifest : -$(MKDIR) $(subst /,$(PS),$(@D)) @echo RegistrationClassName: $(basename $(basename $(@F)))> $@ -$(OUT_COMP_GEN)/%.urd : %.idl +# rule for compiling the IDL files +$(SAMPLE_GEN_OUT)/%.urd : %.idl + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(IDLC) -C -I. -I$(IDL_DIR) -O$(SAMPLE_GEN_OUT) $< + +# rule for creating the component rdb file +$(COMP_GEN_OUT)/%.rdb : $(GEN_URDFILES) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(REGMERGE) $@ /UCR $(GEN_URDFILES) + +# rule for creating IDL dependent class files +$(GEN_CLASSFILES) : $(COMP_RDB) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(IDLC) -C -I. -I$(IDL_DIR) -O$(OUT_COMP_GEN) $< + $(JAVAMAKER) -BUCR -nD $(GEN_TYPELIST) -O$(SAMPLE_CLASS_OUT) $(COMP_RDB) $(OFFICE_TYPE_LIBRARY) -$(OUT_COMP_GEN)/%.rdb : $(GENURDFILES) +# component as well as application are dependent from the generated types +# rule for component class files +$(COMP_CLASS_OUT)/%.class : %.java $(GEN_CLASSFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) - -$(DEL) $(subst /,$(PS),$@) - $(REGMERGE) $@ /UCR $(GENURDFILES) + $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(COMP_CLASS_OUT) $< -$(OUT_COMP_GEN)/%.java : $(COMPONENT_RDB) +# rule for example application class files +$(APP1_CLASS_OUT)/%.class : %.java $(GEN_CLASSFILES) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(JAVAMAKER) -BUCR -nD -T$(subst /,.,$(patsubst $(OUT_COMP_GEN)/%.java,%,$@)) -O$(OUT_COMP_GEN) $(COMPONENT_RDB) $(OFFICE_TYPE_LIBRARY) + $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(APP1_CLASS_OUT) $< -$(CLASSFILES) : $(JAVAFILES) $(GENJAVAFILES) +# rule for client/example application manifest file +$(APP1_GEN_OUT)/%.mf : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo Main-Class: com.sun.star.lib.loader.Loader> $@ + $(ECHOLINE)>> $@ + @echo Name: com/sun/star/lib/loader/Loader.class>> $@ + @echo Application-Class: $*>> $@ + +# rule for client/example application jar file +$(APP1_JAR) : $(APP1_JAR_MANIFEST) $(APP1_CLASS_OUT)/$(APP1_NAME).class $(GEN_CLASSFILES) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_COMP_CLASS) $(GENJAVAFILES) $(JAVAFILES) + $(SDK_JAR) cvfm $@ $< -C $(APP1_CLASS_OUT) . + +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) uvf $(@F) $(GEN_CLASSFILENAMES) + +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) -$(COMPONENT_JAR) : $(COMPONENT_MANIFESTFILE) $(CLASSFILES) +# rule for component jar file +$(COMP_JAR) : $(COMP_JAR_MANIFEST) $(COMP_CLASSFILES) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - cd $(subst /,$(PS),$(OUT_COMP_CLASS)) && $(SDK_JAR) cvfm ../$(@F) $(<F) $($(basename $(basename $(@F)))_CLASSFILES) + $(SDK_JAR) cvfm $@ $< -C $(COMP_CLASS_OUT) . + +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) uvf $(@F) $(GEN_CLASSFILENAMES) -$(COMPONENT_PACKAGE) : $(COMPONENT_RDB) $(COMPONENT_JAR) +# rule for component package manifest +$(COMP_GEN_OUT)/%/manifest.xml : -$(MKDIR) $(subst /,$(PS),$(@D)) - $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_CLASS)) - cd $(subst /,$(PS),$(OUT_CLASS)) && $(SDK_JAR) cvfM ../bin/$(@F) $(^F) - $(DEL) $(subst /,$(PS),$(OUT_CLASS)/$(<F)) + @echo $(OSEP)?xml version="$(QM)1.0$(QM)" encoding="$(QM)UTF-8$(QM)"?$(CSEP) > $@ + @echo $(OSEP)!DOCTYPE manifest:manifest PUBLIC "$(QM)-//OpenOffice.org//DTD Manifest 1.0//EN$(QM)" "$(QM)Manifest.dtd$(QM)"$(CSEP) >> $@ + @echo $(OSEP)manifest:manifest xmlns:manifest="$(QM)http://openoffice.org/2001/manifest$(QM)"$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-typelibrary;type=RDB$(QM)" >> $@ + @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.rdb$(QM)"/$(CSEP) >> $@ + @echo $(SQM) $(SQM)$(OSEP)manifest:file-entry manifest:media-type="$(QM)application/vnd.sun.star.uno-component;type=Java$(QM)" >> $@ + @echo $(SQM) $(SQM)manifest:full-path="$(QM)$(subst /META-INF,,$(subst $(SAMPLE_GEN_OUT)/,,$(@D))).uno.jar$(QM)"/$(CSEP) >> $@ + @echo $(OSEP)/manifest:manifest$(CSEP) >> $@ + +# rule for component package file +$(COMP_PACKAGE) : $(COMP_RDB) $(COMP_JAR) $(COMP_UNOPKG_MANIFEST) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) + -$(MKDIR) $(subst /,$(PS),$(@D)) + cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) ../../../bin/$(@F) $(COMP_RDB_NAME) + + cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_ZIP) -u ../../bin/$(@F) $(COMP_JAR_NAME) + cd $(subst /,$(PS),$(COMP_GEN_OUT)) && $(SDK_ZIP) -u ../../../bin/$(@F) META-INF/manifest.xml -$(REGISTERFLAG) : $(COMPONENT_PACKAGE) +$(COMP_REGISTERFLAG) : $(COMP_PACKAGE) ifeq "$(SDK_AUTO_DEPLOYMENT)" "YES" + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) -$(MKDIR) $(subst /,$(PS),$(@D)) - -$(DEL) $(subst /,$(PS),$@) - $(DEPLOYTOOL) $(COMPONENT_PACKAGE_URL) + $(DEPLOYTOOL) $(COMP_PACKAGE_URL) @echo flagged > $(subst /,$(PS),$@) else @echo -------------------------------------------------------------------------------- @@ -140,24 +196,27 @@ else @echo -------------------------------------------------------------------------------- endif -JavaInstanceInspectorExample : $(REGISTERFLAG) +JavaInspectorExample : $(COMP_REGISTERFLAG) $(APP1_JAR) @echo -------------------------------------------------------------------------------- @echo Please use the following command to execute the example! @echo - - @echo make Test.run + @echo make $(APP1_NAME).run @echo ------ @echo The InstanceInspector component was installed if SDK_AUTO_DEPLOYMENT = YES. @echo You can use this component inside your office installation, see the example - @echo description. + @echo document. + @echo - + @echo make InstanceInspectorTest.odt.load @echo -------------------------------------------------------------------------------- -%.run: $(OUT_COMP_CLASS)/%.class - $(SDK_JAVA) -classpath "$(SDK_CLASSPATH)" $(basename $@) +%.run: $(SAMPLE_CLASS_OUT)/%.jar + $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< + +InstanceInspectorTest.odt.load : $(COMP_REGISTERFLAG) + "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(basename $@) .PHONY: clean clean : - -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_CLASS)) - -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_PACKAGE_URL))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMPONENT_JAR))) - -$(DEL) $(subst \\,\,$(subst /,$(PS),$(REGISTERFLAG))) + -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) + -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT)) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$(COMP_PACKAGE_URL))) |