summaryrefslogtreecommitdiff
path: root/support/make/ilasm.mk
blob: 26b48674e0a0c81519e500c1f266a5a92509614b (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
############################################################-*-Makefile-*-####
# ILASM - MSIL Assembler
##############################################################################
# $Id$

##############################################################################
# Usage
#
#   make ilasm [target=<target>] {<VARIABLE>=<value>}
#
##############################################################################
# Variables
#
# ILASM_ASSEMBLER	 = assembler name, for example ILASM
# $(ILASM_ASSEMBLER)	 = assembler command
# $(ILASM_ASSEMBLER)_FLAGS = assembler-specific compilation flags
# ILASM_FLAGS		+= compilation flags
# ILASM_OUTPUTFILE	 = name of the output assembly file
# ILASM_KEYFILE		 = key file
# ILASM_FILES		+= 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 SC_CLASSPATH with target LIBRARY, one may define the
# variable LIBRARY_SC_CLASSPATH.
#
##############################################################################
# Examples
#
# Compile file "scala.il"
#
#   make ilasm ILASM_FILES=scala.il
#
#
##############################################################################

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

ILASM_ASSEMBLER		?= $(MSIL_PLATFORM)_ILASM
CYGWIN_PATH		?= $(1)
CYGWIN_FILE		?= $(1)
MONO_ILASM		?= ilasm
MSCLR_ILASM		?= ilasm

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

ilasm_ASSEMBLER		 = $(call ILASM_LOOKUP,ILASM_ASSEMBLER)
ilasm_assembler		 = $(call ILASM_LOOKUP,$(ilasm_ASSEMBLER))
ilasm_assembler_flags	 = $(call ILASM_LOOKUP,$(ilasm_ASSEMBLER)_FLAGS)
ilasm_FLAGS		 = $(call ILASM_LOOKUP,ILASM_FLAGS)
ilasm_OUTPUTFILE	 = $(call ILASM_LOOKUP,ILASM_OUTPUTFILE)
ilasm_KEYFILE		 = $(call ILASM_LOOKUP,ILASM_KEYFILE)
ilasm_FILES		 = $(call ILASM_LOOKUP,ILASM_FILES)


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

MONO_OUT_FLAG		 = /output:
MONO_KEY_FLAG		 = /key:

MSCLR_OUT_FLAG		 = /out=
MSCLR_KEY_FLAG		 = /key=

OUT_FLAG		 = $($(MSIL_PLATFORM)_OUT_FLAG)
KEY_FLAG		 = $($(MSIL_PLATFORM)_KEY_FLAG)

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

ilasm			+= $(ilasm_assembler)
ilasm			+= $(ilasm_assembler_flags)
ilasm			+= $(ilasm_FLAGS)
ilasm			+= $(ilasm_OUTPUTFILE:%=$(OUT_FLAG)$(call CYGWIN_FILE,%))
ilasm			+= $(ilasm_KEYFILE:%=$(KEY_FLAG)$(call CYGWIN_FILE,%))
ilasm			+= $(ilasm_FILES:%=$(call CYGWIN_FILE,'%'))

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

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

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

ilasm		:
	$(strip $(ilasm))

.PHONY		: ilasm

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