xref: /aoo42x/main/odk/examples/java/Drawing/Makefile (revision 122c3632)
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 Java Drawing example of the SDK.
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=JavaDrawingExample
33OUT_APP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME)
34
35APP1_NAME=SDraw
36APP1_JAR=$(OUT_APP_CLASS)/$(APP1_NAME).jar
37
38SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
39		$(PATH_SEPARATOR)$(OUT_APP_CLASS))
40
41# Targets
42.PHONY: ALL
43ALL : \
44    $(EXAMPLE_NAME)
45
46include $(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
55	@echo Main-Class: com.sun.star.lib.loader.Loader> $@
56	$(ECHOLINE)>> $@
57	@echo Name: com/sun/star/lib/loader/Loader.class>> $@
58	@echo Application-Class: $*>> $@
59
60$(OUT_APP_CLASS)/%.jar : $(OUT_APP_CLASS)/%.mf $(OUT_APP_CLASS)/%.class
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 command to execute the example!
70	@echo -
71	@echo $(MAKE) SDraw.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
78clean :
79	-$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_CLASS))
80