summaryrefslogtreecommitdiff
path: root/support/make/ildasm.mk
blob: 1fc85b7d1b0b2b1ec6041413a3ddb270efb34147 (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
############################################################-*-Makefile-*-####
# ILDASM - MSIL Disassembler
##############################################################################
# $Id$

##############################################################################
# Usage
#
#   make idlasm [target=<target>] {<VARIABLE>=<value>}
#
##############################################################################
# Variables
#
# ILDASM_ASSEMBLER	 = assembler name, for example ILDASM
# $(ILDASM_ASSEMBLER)	 = assembler command
# $(ILDASM_ASSEMBLER)_FLAGS = assembler-specific compilation flags
# ILDASM_FLAGS		+= compilation flags
# ILDASM_OUTPUTFILE	 = name of the output assembly file
# ILDASM_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
#
# Disassembly file "lib/scala.dll"
#
#   make ildasm ILDASM_FILES=lib/scala.dll
#
#
##############################################################################

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

ILDASM_DISASSEMBLER	?= $(MSIL_PLATFORM)_ILDASM
CYGWIN_PATH		?= $(1)
CYGWIN_FILE		?= $(1)
MONO_ILDASM		?= monodis
MSCLR_ILDASM		?= ildasm

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

ildasm_DISASSEMBLER	 = $(call ILDASM_LOOKUP,ILDASM_DISASSEMBLER)
ildasm_disassembler	 = $(call ILDASM_LOOKUP,$(ildasm_DISASSEMBLER))
ildasm_disassembler_flags = $(call ILDASM_LOOKUP,$(ildasm_DISASSEMBLER)_FLAGS)
ildasm_FLAGS		 = $(call ILDASM_LOOKUP,ILDASM_FLAGS)
ildasm_OUTPUTFILE	 = $(call ILDASM_LOOKUP,ILDASM_OUTPUTFILE)
ildasm_FILES		 = $(call ILDASM_LOOKUP,ILDASM_FILES)

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

MONO_ILDASM_OUT_FLAG	 = --output=
MSCLR_ILDASM_OUT_FLAG	 = /out=

ILDASM_OUT_FLAG		 = $($(MSIL_PLATFORM)_ILDASM_OUT_FLAG)

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

ildasm			+= $(ildasm_disassembler)
ildasm			+= $(ildasm_disassembler_flags)
ildasm			+= $(ildasm_FLAGS)
ildasm			+= $(ildasm_OUTPUTFILE:%=$(ILDASM_OUT_FLAG)$(call CYGWIN_FILE,%))
ildasm			+= $(ildasm_FILES:%=$(call CYGWIN_FILE,'%'))

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

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

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

ildasm		:
	$(strip $(ildasm))

.PHONY		: ildasm

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