summaryrefslogtreecommitdiff
path: root/odk/examples/java/ToDo/Makefile
blob: 91209954160cecbfe4d81a469d071551fde1cbd8 (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Builds the java demo component.

PRJ=..$(PS)..$(PS)..
SETTINGS=../../../settings

include $(SETTINGS)/settings.mk

include $(SETTINGS)/dk.mk
include $(SETTINGS)/std.mk

# Define non-platform/compiler specific settings

REGISTERFLAG = $(OUT_MISC)$(PS)todo_register_component.flag
COMPONENTJARFLAG = $(OUT_MISC)$(PS)todo_create_component_jar.flag
TYPEFLAG= $(OUT_MISC)$(PS)todo_type_generation.flag
JAVAFLAG= $(OUT_MISC)$(PS)todo_javac.flag

OUT_COMPONENT = $(OUT_CLASS)$(PS)todo
COMPONENT_RDB = $(OUT_BIN)$(PS)ToDo.rdb

COMPONENT_JAR = $(OUT_CLASS)$(PS)ToDo.jar
COMPONENT_MANIFESTFILE = Manifest

IDLFILES = XToDo.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$(PS)OpenOffice

JAVAFILES  =	ToDo.java

GENJAVAFILES = $(patsubst %.idl,$(OUT_MISC)$(PS)$(PACKAGE)$(PS)%.java,$(IDLFILES) )
GENURDFILES = $(patsubst %.idl,$(OUT_MISC)$(PS)%.urd,$(IDLFILES) )

CLASSFILES = $(patsubst %.java,$(OUT_COMPONENT)$(PS)%.class,$(JAVAFILES) )

CLASSFILES += $(patsubst %.java,$(OUT_COMPONENT)$(PS)$(PACKAGE)$(PS)%.class,$(GENJAVAFILES) )

DK_CLASSPATH =	$(subst $(EMPTYSTRING) $(EMPTYSTRING),, \
		$(CLASSES_DIR)$(PS)jurt.jar\
		$(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)unoil.jar\
		$(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)ridl.jar\
		$(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)sandbox.jar\
		$(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)java_uno.jar\
		$(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)juh.jar\
		$(PATH_SEPARATOR)$(CLASSES_DIR)$(PS)jut.jar\
		$(PATH_SEPARATOR)$(OUT_COMPONENT) \
		)

OFFICE_FILEURL = $(subst \,/,$(OFFICE_PROGRAM_PATH))
OFFICE_CLASSPATH = $(subst $(CLASSES_DIR),$(OFFICE_PROGRAM_PATH)$(PS)classes, $(DK_CLASSPATH))


# Targets
.PHONY: ALL
ALL : register

include $(SETTINGS)/stdtarget.mk

$(OUT_COMPONENT) : $(OUT) $(OUT_CLASS)
	$(MKDIR) $@

$(TYPEFLAG) : $(IDLFILES)
	$(BIN_DIR)$(PS)idlc -I. -I$(IDL_DIR) -O$(OUT_MISC) $^
	$(BIN_DIR)$(PS)regmerge $(COMPONENT_RDB) /UCR $(GENURDFILES)
	$(BIN_DIR)$(PS)regmerge $(COMPONENT_RDB) / $(BIN_DIR)$(PS)$(DKREGISTRYNAME)
	$(BIN_DIR)$(PS)javamaker -BUCR -Torg.OpenOffice.XToDo -O$(OUT_MISC) $(COMPONENT_RDB)
	@echo bla > $@

$(JAVAFLAG) : $(OUT_COMPONENT) $(TYPEFLAG) $(JAVAFILES)
	javac -classpath $(DK_CLASSPATH) -d $(OUT_COMPONENT) $(GENJAVAFILES) $(JAVAFILES)
	@echo bla > $@

$(COMPONENTJARFLAG) : $(JAVAFLAG)
	jar cvfm $(COMPONENT_JAR) $(COMPONENT_MANIFESTFILE) -C $(OUT_COMPONENT) .
	-$(DEL) $(REGISTERFLAG)
	@echo bla > $@

$(REGISTERFLAG) : $(COMPONENTJARFLAG)
ifneq "$(OFFICE_PROGRAM_PATH)" ""
	$(BIN_DIR)$(PS)regmerge $(OFFICE_PROGRAM_PATH)$(PS)applicat.rdb /UCR $(GENURDFILES)
	$(COPY) $(COMPONENT_JAR) $(OFFICE_PROGRAM_PATH)$(PS)classes
	java -classpath $(OFFICE_CLASSPATH) com.sun.star.tools.uno.RegComp "$(URLPREFIX)$(OFFICE_FILEURL)/applicat.rdb" register "$(URLPREFIX)$(OFFICE_FILEURL)/classes/ToDo.jar" com.sun.star.loader.Java2
	@echo bla > $@
else
	@echo --------------------------------------------------------------------------------
	@echo  If you want to install your component automatically, please set an 
	@echo  OFFICE_PROGRAM_PATH environment variable to a valid office installation.
	@echo --------------------------------------------------------------------------------
endif

register: $(REGISTERFLAG)