1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20#************************************************************** 21 22# Builds the Database examples of the Developers Guide. 23 24PRJ=../../.. 25SETTINGS=$(PRJ)/settings 26 27include $(SETTINGS)/settings.mk 28include $(SETTINGS)/std.mk 29include $(SETTINGS)/dk.mk 30 31# Define non-platform/compiler specific settings 32EXAMPLE_NAME=DataBaseExamples 33OUT_APP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME) 34 35APP1_NAME=CodeSamples 36APP1_JAR=$(OUT_APP_CLASS)/$(APP1_NAME).jar 37APP2_NAME=OpenQuery 38APP2_JAR=$(OUT_APP_CLASS)/$(APP2_NAME).jar 39APP3_NAME=RowSet 40APP3_JAR=$(OUT_APP_CLASS)/$(APP3_NAME).jar 41 42APP1_JAVAFILES = \ 43 Sales.java \ 44 SalesMan.java \ 45 CodeSamples.java \ 46 sdbcx.java 47 48APP3_JAVAFILES = \ 49 RowSetEventListener.java \ 50 RowSet.java 51 52APP1_CLASSFILES = $(patsubst %.java,$(OUT_APP_CLASS)/%.class,$(APP1_JAVAFILES)) 53APP1_CLASSNAMES = $(patsubst %.java,%.class,$(APP1_JAVAFILES)) 54 55APP3_CLASSFILES = $(patsubst %.java,$(OUT_APP_CLASS)/%.class,$(APP3_JAVAFILES)) 56APP3_CLASSNAMES = $(patsubst %.java,%.class,$(APP3_JAVAFILES)) 57 58SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ 59 $(PATH_SEPARATOR)$(OUT_APP_CLASS)) 60 61# Targets 62.PHONY: ALL 63ALL : \ 64 $(EXAMPLE_NAME) 65 66include $(SETTINGS)/stdtarget.mk 67 68$(APP1_CLASSFILES) : $(APP1_JAVAFILES) 69 -$(MKDIR) $(subst /,$(PS),$(@D)) 70 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_APP_CLASS) $(APP1_JAVAFILES) 71 72$(APP3_CLASSFILES) : $(APP3_JAVAFILES) 73 -$(MKDIR) $(subst /,$(PS),$(@D)) 74 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_APP_CLASS) $(APP3_JAVAFILES) 75 76$(OUT_APP_CLASS)/%.class : %.java 77 -$(MKDIR) $(subst /,$(PS),$(@D)) 78 $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_APP_CLASS) $< 79 80$(OUT_APP_CLASS)/%.mf : 81 -$(MKDIR) $(subst /,$(PS),$(@D)) 82 @echo Main-Class: com.sun.star.lib.loader.Loader> $@ 83 $(ECHOLINE)>> $@ 84 @echo Name: com/sun/star/lib/loader/Loader.class>> $@ 85 @echo Application-Class: $*>> $@ 86 87$(APP1_JAR) : $(OUT_APP_CLASS)/$(APP1_NAME).mf $(APP1_CLASSFILES) 88 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 89 -$(MKDIR) $(subst /,$(PS),$(@D)) 90 +cd $(subst /,$(PS),$(OUT_APP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(basename $(@F)).mf $(APP1_CLASSNAMES) 91 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) 92 93$(APP2_JAR) : $(OUT_APP_CLASS)/$(APP2_NAME).mf $(OUT_APP_CLASS)/$(APP2_NAME).class 94 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 95 -$(MKDIR) $(subst /,$(PS),$(@D)) 96 +cd $(subst /,$(PS),$(OUT_APP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(basename $(@F)).mf $(basename $(@F)).class 97 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) 98 99$(APP3_JAR) : $(OUT_APP_CLASS)/$(APP3_NAME).mf $(APP3_CLASSFILES) 100 -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) 101 -$(MKDIR) $(subst /,$(PS),$(@D)) 102 +cd $(subst /,$(PS),$(OUT_APP_CLASS)) && $(SDK_JAR) cvfm $(@F) $(basename $(@F)).mf $(APP3_CLASSNAMES) 103 +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) 104 105$(EXAMPLE_NAME) : $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) 106 @echo -------------------------------------------------------------------------------- 107 @echo This examples needs a running database with name "$(QM)MYDB0$(QM)". Make sure that you 108 @echo have created such a database and have established a connection to it. 109 @echo Please use one of the following commands to execute the examples! 110 @echo - 111 @echo $(MAKE) CodeSamples.run 112 @echo $(MAKE) OpenQuery.run 113 @echo $(MAKE) RowSet.run 114 @echo -------------------------------------------------------------------------------- 115 116%.run: $(OUT_APP_CLASS)/%.jar 117 $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< 118 119.PHONY: clean 120clean : 121 -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_CLASS)) 122