Fix enter/exit critical region visibility.
[mono-project.git] / mcs / build / rules.make
blob5d2d6ee29d51e7168943f057d700b7c9c229cfed
1 # -*- makefile -*-
3 # This is the makefile fragment with default rules
4 # for building things in MCS
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.
10 empty :=
11 space := $(empty) $(empty)
13 # given $(thisdir), we compute the path to the top directory
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)))))
21 VERSION = 0.93
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 $(@))";)
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_MBAS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/mbas/mbas.exe
40 INTERNAL_GMCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/basic/mcs.exe
41 INTERNAL_ILASM = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/ilasm.exe
42 corlib = mscorlib.dll
44 ifndef BUILD_TOOLS_PROFILE
45 BUILD_TOOLS_PROFILE = basic
46 endif
48 INTERNAL_RESGEN = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resgen.exe
50 depsdir = $(topdir)/build/deps
52 # Make sure these propagate if set manually
54 export PLATFORM
55 export PROFILE
56 export MCS
57 export MCS_FLAGS
58 export CC
59 export CFLAGS
60 export INSTALL
61 export MKINSTALLDIRS
62 export TEST_HARNESS
63 export BOOTSTRAP_MCS
64 export DESTDIR
65 export RESGEN
67 # Get this so the platform.make platform-check rule doesn't become the
68 # default target
70 .DEFAULT: all
71 default: all
73 # Get initial configuration. pre-config is so that the builder can
74 # override PLATFORM or PROFILE
76 include $(topdir)/build/config-default.make
77 -include $(topdir)/build/pre-config.make
79 # Default PLATFORM and PROFILE if they're not already defined.
81 ifndef PLATFORM
82 ifeq ($(OS),Windows_NT)
83 PLATFORM = win32
84 else
85 PLATFORM = linux
86 endif
87 endif
89 # Platform config
91 include $(topdir)/build/platforms/$(PLATFORM).make
93 ifdef PLATFORM_CORLIB
94 corlib = $(PLATFORM_CORLIB)
95 endif
96 # Useful
98 ifeq ($(PLATFORM_RUNTIME),$(RUNTIME))
99 PLATFORM_MONO_NATIVE = yes
100 endif
102 # Rest of the configuration
104 ifndef PROFILE
105 PROFILE = net_2_0
106 endif
108 include $(topdir)/build/profiles/$(PROFILE).make
109 -include $(topdir)/build/config.make
111 ifdef OVERRIDE_TARGET_ALL
112 all: all.override
113 else
114 all: do-all
115 endif
117 ifdef NO_INSTALL
118 GACUTIL = :
119 else
120 gacutil = $(topdir)/class/lib/basic/gacutil.exe
121 GACUTIL = MONO_PATH="$(topdir)/class/lib/basic$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil)
122 endif
124 STD_TARGETS = test run-test run-test-ondotnet clean install uninstall doc-update
126 $(STD_TARGETS): %: do-%
128 do-run-test:
129 ok=:; $(MAKE) run-test-recursive || ok=false; $(MAKE) run-test-local || ok=false; $$ok
131 do-%: %-recursive
132 $(MAKE) $*-local
134 .PHONY: all-local $(STD_TARGETS:=-local)
135 all-local $(STD_TARGETS:=-local):
137 csproj: do-csproj
139 # The way this is set up, any profile-specific subdirs list should
140 # be listed _before_ including rules.make. However, the default
141 # SUBDIRS list can come after, so don't use the eager := syntax when
142 # using the defaults.
143 PROFILE_SUBDIRS := $($(PROFILE)_SUBDIRS)
144 ifndef PROFILE_SUBDIRS
145 PROFILE_SUBDIRS = $(SUBDIRS)
146 endif
148 ifndef FRAMEWORK_VERSION_MAJOR
149 FRAMEWORK_VERSION_MAJOR = $(basename $(FRAMEWORK_VERSION))
150 endif
152 %-recursive:
153 @set . $$MAKEFLAGS; final_exit=:; \
154 case $$2 in --unix) shift ;; esac; \
155 case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \
156 list='$(PROFILE_SUBDIRS)'; for d in $$list ; do \
157 (cd $$d && $(MAKE) $*) || { final_exit="exit 1"; $$dk; } ; \
158 done; \
159 $$final_exit
161 ifndef DIST_SUBDIRS
162 DIST_SUBDIRS = $(SUBDIRS) $(DIST_ONLY_SUBDIRS)
163 endif
164 dist-recursive: dist-local
165 @case '$(distdir)' in [\\/$$]* | ?:[\\/]* ) reldir='$(distdir)' ;; *) reldir='../$(distdir)' ;; esac ; \
166 list='$(DIST_SUBDIRS)'; for d in $$list ; do \
167 (cd $$d && $(MAKE) distdir=$$reldir/$$d $@) || exit 1 ; \
168 done
170 # The following target can be used like
172 # dist-local: dist-default
173 # ... additional commands ...
175 # Notes:
176 # 1. we invert the test here to not end in an error if ChangeLog doesn't exist.
177 # 2. we error out if we try to dist a nonexistant file.
178 # 3. we pick up Makefile, makefile, or GNUmakefile.
179 dist-default:
180 -mkdir -p $(distdir)
181 test '!' -f ChangeLog || cp ChangeLog $(distdir)
182 if test -f Makefile; then m=M; fi; \
183 if test -f makefile; then m=m; fi; \
184 if test -f GNUmakefile; then m=GNUm; fi; \
185 for f in $${m}akefile $(DISTFILES) ; do \
186 dest=`dirname "$(distdir)/$$f"` ; \
187 $(MKINSTALLDIRS) $$dest && cp -p "$$f" $$dest || exit 1 ; \
188 done
189 if test -d Documentation ; then \
190 find . -name '*.xml' > .files ; \
191 tar cTf .files - | (cd $(distdir); tar xf -) ; \
192 rm .files ; \
195 %/.stamp:
196 $(MKINSTALLDIRS) $(@D)
197 touch $@
199 ## Documentation stuff
201 Q_MDOC =$(if $(V),,@echo "MDOC [$(PROFILE)] $(notdir $(@))";)
202 MDOC =$(Q_MDOC) MONO_PATH="$(topdir)/class/lib/net_4_0$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" \
203 $(RUNTIME) $(topdir)/tools/mdoc/mdoc.exe