summaryrefslogtreecommitdiff
path: root/support/make/rmic.mk
blob: dd0233e6106cfab36ea6f191260070e0971ea13c (plain) (blame)
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
93
94
95
96
############################################################-*-Makefile-*-####
# RMIC - Generate Stubs for Java Class Files
##############################################################################
# $Id$

##############################################################################
# Usage
#
#   make rmic [target=<target>] {<VARIABLE>=<value>}
#
##############################################################################
# Variables
#
# RMIC_COMPILER		 = compiler name, for example RMIC
# $(RMIC_COMPILER)	 = compiler command
# $(RMIC_COMPILER)_FLAGS = compiler-specific compilation flags
# RMIC_FLAGS		+= compilation flags
# RMIC_CLASSPATH	 = location of user class files
# RMIC_BOOTCLASSPATH	 = location of bootstrap class files
# RMIC_EXTDIRS		 = location of installed extensions
# RMIC_OUTPUTDIR	 = directory where to place generated class files
# RMIC_CLASSES		+= files to compile
#
# All variables may have target specific values which override the
# normal value. Those values are specified by variables whose name is
# prefixed with the target name. For example, to override the value of
# the variable RMIC_CLASSPATH with target COMPILER, one may define the
# variable COMPILER_RMIC_CLASSPATH.
#
##############################################################################
# Examples
#
# Compile file "objects/main/lib/scala/scala/runtime/distributed/ChannelImpl"
#
#   make rmic RMIC_CLASSES=objects/main/lib/scala/scala/runtime/distributed/ChannelImpl
#
#
# Compile the whole runtime
#
#   make rmic target=RUNTIME
#
#
# A Makefile rule that compiles all modified files from the runtime
#
#   .latest-runtime		: $(RUNTIME_RMIC_CLASSES)
#           @$(MAKE) rmic target=RUNTIME RUNTIME_RMIC_CLASSES='$?'
#           touch $@
#
##############################################################################

##############################################################################
# Defaults

RMIC_COMPILER		?= RMIC
CYGWIN_PATH		?= $(1)
CYGWIN_FILE		?= $(1)
RMIC			?= rmic

##############################################################################
# Values

rmic_COMPILER		 = $(call RMIC_LOOKUP,RMIC_COMPILER)
rmic_compiler		 = $(call RMIC_LOOKUP,$(rmic_COMPILER))
rmic_FLAGS		 = $(call RMIC_LOOKUP,RMIC_FLAGS)
rmic_CLASSPATH		 = $(call RMIC_LOOKUP,RMIC_CLASSPATH)
rmic_BOOTCLASSPATH	 = $(call RMIC_LOOKUP,RMIC_BOOTCLASSPATH)
rmic_EXTDIRS		 = $(call RMIC_LOOKUP,RMIC_EXTDIRS)
rmic_OUTPUTDIR		 = $(call RMIC_LOOKUP,RMIC_OUTPUTDIR)
rmic_CLASSES		 = $(call RMIC_LOOKUP,RMIC_CLASSES)

##############################################################################
# Command

rmic			+= $(rmic_compiler)
rmic			+= $(rmic_FLAGS)
rmic			+= $(rmic_CLASSPATH:%=-classpath $(call CYGWIN_PATH,%))
rmic			+= $(rmic_BOOTCLASSPATH:%=-bootclasspath $(call CYGWIN_PATH,%))
rmic			+= $(rmic_EXTDIRS:%=-extdirs $(call CYGWIN_PATH,%))
rmic			+= $(rmic_OUTPUTDIR:%=-d $(call CYGWIN_FILE,%))
rmic			+= $(rmic_CLASSES)

##############################################################################
# Functions

RMIC_LOOKUP		 = $(if $($(target)_$(1)),$($(target)_$(1)),$($(1)))

##############################################################################
# Rules

rmic		:
	@[ -d "$(rmic_OUTPUTDIR)" ] || $(MKDIR) -p "$(rmic_OUTPUTDIR)"
	$(strip $(rmic))

.PHONY		: rmic

##############################################################################