preserve internal methods of EventInfo
[mono.git] / mcs / build / rules.make
1 # -*- makefile -*-
2 #
3 # This is the makefile fragment with default rules
4 # for building things in MCS
5 #
6 # To customize the build, you should edit config.make.
7 # If you need to edit this file, that's a bug; email
8 # peter@newton.cx about it.
9
10 empty :=
11 space := $(empty) $(empty)
12
13 # given $(thisdir), we compute the path to the top directory
14 #
15 # split_path = $(filter-out .,$(subst /,$(space),$(1)))
16 # make_path = ./$(subst $(space),/,$(1))
17 # dotdottify = $(patsubst %,..,$(1))
18 # topdir = $(call make_path,$(call dotdottify,$(call split_path,$(thisdir))))
19 topdir := ./$(subst $(space),/,$(patsubst %,..,$(filter-out .,$(subst /,$(space),$(thisdir)))))
20
21 VERSION = 0.93
22
23 Q=$(if $(V),,@)
24 # echo -e "\\t" does not work on some systems, so use 5 spaces
25 Q_MCS=$(if $(V),,@echo "MCS     [$(PROFILE)] $(notdir $(@))";)
26
27 USE_MCS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
28 USE_MBAS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MBAS_FLAGS) $(PLATFORM_MBAS_FLAGS) $(PROFILE_MBAS_FLAGS) $(MBAS_FLAGS)
29 USE_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
30 CSCOMPILE = $(Q_MCS) $(MCS) $(USE_MCS_FLAGS)
31 BASCOMPILE = $(MBAS) $(USE_MBAS_FLAGS)
32 CCOMPILE = $(CC) $(USE_CFLAGS)
33 BOOT_COMPILE = $(Q_MCS) $(BOOTSTRAP_MCS) $(USE_MCS_FLAGS)
34 INSTALL = $(SHELL) $(topdir)/../mono/install-sh
35 INSTALL_DATA = $(INSTALL) -c -m 644
36 INSTALL_BIN = $(INSTALL) -c -m 755
37 INSTALL_LIB = $(INSTALL_BIN)
38 MKINSTALLDIRS = $(SHELL) $(topdir)/mkinstalldirs
39 INTERNAL_MCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/mcs.exe
40 INTERNAL_MBAS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/mbas/mbas.exe
41 INTERNAL_GMCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/mcs/gmcs.exe
42 INTERNAL_ILASM = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/ilasm.exe
43 INTERNAL_RESGEN = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BOOTSTRAP_PROFILE)/resgen.exe
44 corlib = mscorlib.dll
45
46 depsdir = $(topdir)/build/deps
47
48 # Make sure these propagate if set manually
49
50 export PLATFORM
51 export PROFILE
52 export MCS
53 export MCS_FLAGS
54 export CC
55 export CFLAGS
56 export INSTALL
57 export MKINSTALLDIRS
58 export TEST_HARNESS
59 export BOOTSTRAP_MCS
60 export DESTDIR
61 export RESGEN
62
63 # Get this so the platform.make platform-check rule doesn't become the
64 # default target
65
66 .DEFAULT: all
67 default: all
68
69 # Get initial configuration. pre-config is so that the builder can
70 # override PLATFORM or PROFILE
71
72 include $(topdir)/build/config-default.make
73 -include $(topdir)/build/pre-config.make
74
75 # Default PLATFORM and PROFILE if they're not already defined.
76
77 ifndef PLATFORM
78 ifeq ($(OS),Windows_NT)
79 PLATFORM = win32
80 else
81 PLATFORM = linux
82 endif
83 endif
84
85 # Platform config
86
87 include $(topdir)/build/platforms/$(PLATFORM).make
88
89 ifdef PLATFORM_CORLIB
90 corlib = $(PLATFORM_CORLIB)
91 endif
92 # Useful
93
94 ifeq ($(PLATFORM_RUNTIME),$(RUNTIME))
95 PLATFORM_MONO_NATIVE = yes
96 endif
97
98 # Rest of the configuration
99
100 ifndef PROFILE
101 PROFILE = net_2_0
102 endif
103
104 include $(topdir)/build/profiles/$(PROFILE).make
105 -include $(topdir)/build/config.make
106
107 ifdef OVERRIDE_TARGET_ALL
108 all: all.override
109 else
110 all: do-all
111 endif
112
113 ifdef NO_INSTALL
114 GACUTIL = :
115 else
116 gacutil = $(topdir)/class/lib/net_1_1_bootstrap/gacutil.exe
117 GACUTIL = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil)
118 endif
119
120 STD_TARGETS = test run-test run-test-ondotnet clean install uninstall doc-update
121
122 $(STD_TARGETS): %: do-%
123
124 do-run-test:
125         ok=:; $(MAKE) run-test-recursive || ok=false; $(MAKE) run-test-local || ok=false; $$ok
126
127 do-%: %-recursive
128         $(MAKE) $*-local
129
130 # The way this is set up, any profile-specific subdirs list should
131 # be listed _before_ including rules.make.  However, the default
132 # SUBDIRS list can come after, so don't use the eager := syntax when
133 # using the defaults.
134 PROFILE_SUBDIRS := $($(PROFILE)_SUBDIRS)
135 ifndef PROFILE_SUBDIRS
136 PROFILE_SUBDIRS = $(SUBDIRS)
137 endif
138
139 ifndef FRAMEWORK_VERSION_MAJOR
140 FRAMEWORK_VERSION_MAJOR = $(basename $(FRAMEWORK_VERSION))
141 endif
142
143 %-recursive:
144         @set . $$MAKEFLAGS; final_exit=:; \
145         case $$2 in --unix) shift ;; esac; \
146         case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \
147         list='$(PROFILE_SUBDIRS)'; for d in $$list ; do \
148             (cd $$d && $(MAKE) $*) || { final_exit="exit 1"; $$dk; } ; \
149         done; \
150         $$final_exit
151
152 ifndef DIST_SUBDIRS
153 DIST_SUBDIRS = $(SUBDIRS) $(DIST_ONLY_SUBDIRS)
154 endif
155 dist-recursive: dist-local
156         @case '$(distdir)' in [\\/$$]* | ?:[\\/]* ) reldir='$(distdir)' ;; *) reldir='../$(distdir)' ;; esac ; \
157         list='$(DIST_SUBDIRS)'; for d in $$list ; do \
158             (cd $$d && $(MAKE) distdir=$$reldir/$$d $@) || exit 1 ; \
159         done
160
161 # The following target can be used like
162 #
163 #   dist-local: dist-default
164 #       ... additional commands ...
165 #
166 # Notes:
167 #  1. we invert the test here to not end in an error if ChangeLog doesn't exist.
168 #  2. we error out if we try to dist a nonexistant file.
169 #  3. we pick up Makefile, makefile, or GNUmakefile.
170 dist-default:
171         -mkdir -p $(distdir)
172         test '!' -f ChangeLog || cp ChangeLog $(distdir)
173         if test -f Makefile; then m=M; fi; \
174         if test -f makefile; then m=m; fi; \
175         if test -f GNUmakefile; then m=GNUm; fi; \
176         for f in $${m}akefile $(DISTFILES) ; do \
177             dest=`dirname $(distdir)/$$f` ; \
178             $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1 ; \
179         done
180         if test -d Documentation ; then \
181                 find . -name '*.xml' > .files ; \
182                 tar cTf .files - | (cd $(distdir); tar xf -) ; \
183                 rm .files ; \
184         fi
185
186 %/.stamp:
187         $(MKINSTALLDIRS) $(@D)
188         touch $@
189
190 # Useful
191
192 withmcs:
193         $(MAKE) MCS='$(INTERNAL_MCS)' BOOTSTRAP_MCS='$(INTERNAL_MCS)' all
194
195 ## Documentation stuff
196
197 Q_MDOC =$(if $(V),,@echo "MDOC    [$(PROFILE)] $(notdir $(@))";)
198 MDOC   =$(Q_MDOC) MONO_PATH="$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_1_1$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(topdir)/tools/mdoc/mdoc.exe
199