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 OfficeDevPathSettingsTest example of the Developers Guide.
23 
24 PRJ=../../../..
25 SETTINGS=$(PRJ)/settings
26 
27 include $(SETTINGS)/settings.mk
28 include $(SETTINGS)/std.mk
29 include $(SETTINGS)/dk.mk
30 
31 # Define non-platform/compiler specific settings
32 EXAMPLE_NAME=OfficeDevPathSubstitutionTest
33 OUT_APP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME)
34 
35 APP1_NAME=PathSubstitutionTest
36 APP1_JAR=$(OUT_APP_CLASS)/$(APP1_NAME).jar
37 
38 SDK_CLASSPATH=$(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
39 		$(PATH_SEPARATOR)$(OUT_APP_CLASS))
40 
41 
42 # Targets
43 .PHONY: ALL
44 ALL : $(EXAMPLE_NAME)
45 
46 include $(SETTINGS)/stdtarget.mk
47 
48 $(OUT_APP_CLASS)/%.class : %.java
49 	-$(MKDIR) $(subst /,$(PS),$(@D))
50 	$(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_APP_CLASS) $<
51 
52 $(OUT_APP_CLASS)/%.mf :
53 	-$(MKDIR) $(subst /,$(PS),$(@D))
54 	@echo Main-Class: com.sun.star.lib.loader.Loader> $@
55 	$(ECHOLINE)>> $@
56 	@echo Name: com/sun/star/lib/loader/Loader.class>> $@
57 	@echo Application-Class: $*>> $@
58 
59 $(OUT_APP_CLASS)/%.jar : $(OUT_APP_CLASS)/%.mf $(OUT_APP_CLASS)/%.class
60 	-$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
61 	-$(MKDIR) $(subst /,$(PS),$(@D))
62 	+cd $(subst /,$(PS),$(OUT_APP_CLASS)) && $(SDK_JAR) cvfm $(@F) $*.mf $*.class
63 	+$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
64 
65 $(APP1_JAR) : $(OUT_APP_CLASS)/$(APP1_NAME).mf $(OUT_APP_CLASS)/$(APP1_NAME).class
66 
67 $(EXAMPLE_NAME) : $(APP1_JAR)
68 	@echo --------------------------------------------------------------------------------
69 	@echo Please use the following commands to execute the examples!
70 	@echo -
71 	@echo $(MAKE) $(APP1_NAME).run
72 	@echo --------------------------------------------------------------------------------
73 
74 %.run: $(OUT_APP_CLASS)/%.jar
75 	$(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
76 
77 .PHONY: clean
78 clean :
79 	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_CLASS))
80