This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[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
59 # Get initial configuration. pre-config is so that the builder can
60 # override PLATFORM or PROFILE
61
62 include $(topdir)/build/config-default.make
63 -include $(topdir)/build/pre-config.make
64
65 # Default PLATFORM and PROFILE if they're not already defined.
66
67 ifndef PLATFORM
68 ifeq ($(OS),Windows_NT)
69 PLATFORM = win32
70 else
71 PLATFORM = linux
72 endif
73 endif
74
75 # Platform config
76
77 include $(topdir)/build/platforms/$(PLATFORM).make
78
79 ifdef PLATFORM_CORLIB
80 corlib = $(PLATFORM_CORLIB)
81 endif
82 # Useful
83
84 ifeq ($(PLATFORM_RUNTIME),$(RUNTIME))
85 PLATFORM_MONO_NATIVE = yes
86 endif
87
88 # Rest of the configuration
89
90 ifndef PROFILE
91 PROFILE = default
92 endif
93
94 include $(topdir)/build/profiles/$(PROFILE).make
95 -include $(topdir)/build/config.make
96
97 # Simple rules
98
99 %-recursive:
100         @set . $$MAKEFLAGS; \
101         case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \
102         list='$(SUBDIRS)'; for d in $$list ; do \
103             (cd $$d && $(MAKE) $*) || $$dk ; \
104         done
105
106 # note: dist-local dep, extra subdirs, $* has become $@
107
108 dist-recursive: dist-local
109         @list='$(SUBDIRS) $(DIST_ONLY_SUBDIRS)'; for d in $$list ; do \
110             (cd $$d && $(MAKE) $@) || exit 1 ; \
111         done
112
113 # We do this manually to not have a make[1]: blah message (That is,
114 # instead of using a '%: %-recursive %-local' construct.)
115 #
116 # Let the makefile override these for special situations (running checks
117 # in the toplevel makefile, or a directory that needs to be built before
118 # its subdirectories).
119
120 ifndef OVERRIDE_BARE_TARGETS
121
122 all: all-recursive all-local
123
124 install: install-recursive install-local
125
126 test: test-recursive test-local
127
128 run-test: run-test-recursive test-local run-test-local
129
130 run-test-ondotnet: run-test-ondotnet-recursive test-local run-test-ondotnet-local
131
132 clean: clean-recursive clean-local
133
134 uninstall: uninstall-recursive uninstall-local
135
136 endif
137
138 # Can only do this from the top dir
139 # ## dist: dist-recursive dist-local
140
141 # We invert the test here to not end in an error
142 # if ChangeLog doesn't exist.
143 #
144 # Note that we error out if we try to dist a nonexistant
145 # file. Seems reasonable to me.
146
147 dist-default:
148         -mkdir $(distdir)
149         test '!' -f ChangeLog || cp ChangeLog $(distdir)
150         for f in Makefile $(DISTFILES) ; do \
151             dest=`dirname $(distdir)/$$f` ; \
152             $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
153         done
154
155 # Useful
156
157 withmcs:
158         $(MAKE) MCS='$(INTERNAL_MCS)' BOOTSTRAP_MCS='$(INTERNAL_MCS)' all