* SerializationCodeGenerator.cs: Generate correct "HasValue" check for
[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 # Some more variables. The leading period in the sed expression prevents
11 # thisdir = . from being changed into '..' for the toplevel directory.
12
13 dots := $(shell echo $(thisdir) |sed -e 's,[^./][^/]*,..,g')
14 topdir := $(dots)
15
16 VERSION = 0.93
17
18 USE_MCS_FLAGS = $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
19 USE_MBAS_FLAGS = $(LOCAL_MBAS_FLAGS) $(PLATFORM_MBAS_FLAGS) $(PROFILE_MBAS_FLAGS) $(MBAS_FLAGS)
20 USE_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
21 CSCOMPILE = $(MCS) $(USE_MCS_FLAGS)
22 BASCOMPILE = $(MBAS) $(USE_MBAS_FLAGS)
23 CCOMPILE = $(CC) $(USE_CFLAGS)
24 BOOT_COMPILE = $(BOOTSTRAP_MCS) $(USE_MCS_FLAGS)
25 INSTALL_DATA = $(INSTALL) -m 644
26 INSTALL_BIN = $(INSTALL) -m 755
27 INSTALL_LIB = $(INSTALL_BIN)
28 MKINSTALLDIRS = $(SHELL) $(topdir)/mkinstalldirs
29 INTERNAL_MCS = $(RUNTIME) $(topdir)/mcs/mcs.exe
30 INTERNAL_MBAS = $(RUNTIME) $(topdir)/mbas/mbas.exe
31 INTERNAL_GMCS = $(RUNTIME) $(topdir)/gmcs/gmcs.exe
32 INTERNAL_ILASM = $(RUNTIME) $(topdir)/ilasm/ilasm.exe
33 INTERNAL_RESGEN = $(RUNTIME) $(topdir)/monoresgen/monoresgen.exe
34 corlib = mscorlib.dll
35
36 depsdir = $(topdir)/build/deps
37 distdir = $(dots)/$(package)/$(thisdir)
38
39 # Make sure these propagate if set manually
40
41 export PLATFORM
42 export PROFILE
43 export MCS
44 export MCS_FLAGS
45 export CC
46 export CFLAGS
47 export INSTALL
48 export MKINSTALLDIRS
49 export TEST_HARNESS
50 export BOOTSTRAP_MCS
51 export DESTDIR
52 export RESGEN
53
54 # Get this so the platform.make platform-check rule doesn't become the
55 # default target
56
57 .DEFAULT: all
58 default: all
59
60 # Get initial configuration. pre-config is so that the builder can
61 # override PLATFORM or PROFILE
62
63 include $(topdir)/build/config-default.make
64 -include $(topdir)/build/pre-config.make
65
66 # Default PLATFORM and PROFILE if they're not already defined.
67
68 ifndef PLATFORM
69 ifeq ($(OS),Windows_NT)
70 PLATFORM = win32
71 else
72 PLATFORM = linux
73 endif
74 endif
75
76 # Platform config
77
78 include $(topdir)/build/platforms/$(PLATFORM).make
79
80 ifdef PLATFORM_CORLIB
81 corlib = $(PLATFORM_CORLIB)
82 endif
83 # Useful
84
85 ifeq ($(PLATFORM_RUNTIME),$(RUNTIME))
86 PLATFORM_MONO_NATIVE = yes
87 endif
88
89 # Rest of the configuration
90
91 ifndef PROFILE
92 PROFILE = default
93 endif
94
95 include $(topdir)/build/profiles/$(PROFILE).make
96 -include $(topdir)/build/config.make
97
98 ifdef OVERRIDE_TARGET_ALL
99 all: all.override
100 else
101 all: all.real
102 endif
103
104 all.real: all-recursive
105         $(MAKE) all-local
106
107 STD_TARGETS = test run-test run-test-ondotnet clean install uninstall
108
109 $(STD_TARGETS): %: %-recursive
110         $(MAKE) $@-local
111
112 %-recursive:
113         @set . $$MAKEFLAGS; \
114         case $$2 in --unix) shift ;; esac; \
115         case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \
116         list='$(SUBDIRS)'; for d in $$list ; do \
117             (cd $$d && $(MAKE) $*) || $$dk ; \
118         done
119
120 # note: dist-local dep, extra subdirs, we invoke dist-recursive in the subdir too
121 dist-recursive: dist-local
122         @list='$(SUBDIRS) $(DIST_ONLY_SUBDIRS)'; for d in $$list ; do \
123             (cd $$d && $(MAKE) $@) || exit 1 ; \
124         done
125
126 # Can only do this from the top dir
127 # ## dist: dist-recursive dist-local
128
129 # We invert the test here to not end in an error
130 # if ChangeLog doesn't exist.
131 #
132 # Note that we error out if we try to dist a nonexistant
133 # file. Seems reasonable to me.
134
135 dist-default:
136         -mkdir $(distdir)
137         test '!' -f ChangeLog || cp ChangeLog $(distdir)
138         for f in Makefile $(DISTFILES) ; do \
139             dest=`dirname $(distdir)/$$f` ; \
140             $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
141         done
142
143 # Useful
144
145 withmcs:
146         $(MAKE) MCS='$(INTERNAL_MCS)' BOOTSTRAP_MCS='$(INTERNAL_MCS)' all