bug.fix.wildcard.2.regex
[tfs.git] / build / rules.make
blobc3148e59ae95f273a5d7c504372fc41c7333be7d
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 # Some more variables. The leading period in the sed expression prevents
11 # thisdir = . from being changed into '..' for the toplevel directory.
13 dots := $(shell echo $(thisdir) |sed -e 's,[^./][^/]*,..,g')
14 topdir := $(dots)
16 VERSION = 0.93
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 = install
26 INSTALL_DATA = $(INSTALL) -c -m 644
27 INSTALL_BIN = $(INSTALL) -c -m 755
28 INSTALL_LIB = $(INSTALL_BIN)
29 MKINSTALLDIRS = $(SHELL) $(topdir)/mkinstalldirs
30 INTERNAL_MCS = mcs
31 INTERNAL_MBAS = mbas
32 INTERNAL_GMCS = gmcs
33 INTERNAL_ILASM = ilasm
34 INTERNAL_RESGEN = resgen
35 corlib = mscorlib.dll
37 depsdir = $(topdir)/build/deps
39 # Make sure these propagate if set manually
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
54 # Get this so the platform.make platform-check rule doesn't become the
55 # default target
57 .DEFAULT: all
58 default: all
60 # Get initial configuration. pre-config is so that the builder can
61 # override PLATFORM or PROFILE
63 include $(topdir)/build/config-default.make
64 -include $(topdir)/build/pre-config.make
66 # Default PLATFORM and PROFILE if they're not already defined.
68 ifndef PLATFORM
69 ifeq ($(OS),Windows_NT)
70 PLATFORM = win32
71 else
72 PLATFORM = linux
73 endif
74 endif
76 # Platform config
78 include $(topdir)/build/platforms/$(PLATFORM).make
80 ifdef PLATFORM_CORLIB
81 corlib = $(PLATFORM_CORLIB)
82 endif
83 # Useful
85 ifeq ($(PLATFORM_RUNTIME),$(RUNTIME))
86 PLATFORM_MONO_NATIVE = yes
87 endif
89 # Rest of the configuration
91 ifndef PROFILE
92 PROFILE = net_2_0
93 endif
95 include $(topdir)/build/profiles/$(PROFILE).make
96 -include $(topdir)/build/config.make
98 ifdef OVERRIDE_TARGET_ALL
99 all: all.override
100 else
101 all: do-all
102 endif
104 STD_TARGETS = test run-test run-test-ondotnet clean install uninstall
106 $(STD_TARGETS): %: do-%
108 do-run-test:
109 ok=:; $(MAKE) run-test-recursive || ok=false; $(MAKE) run-test-local || ok=false; $$ok
111 do-%: %-recursive
112 $(MAKE) $*-local
114 # The way this is set up, any profile-specific subdirs list should
115 # be listed _before_ including rules.make. However, the default
116 # SUBDIRS list can come after, so don't use the eager := syntax when
117 # using the defaults.
118 PROFILE_SUBDIRS := $($(PROFILE)_SUBDIRS)
119 ifndef PROFILE_SUBDIRS
120 PROFILE_SUBDIRS = $(SUBDIRS)
121 endif
123 %-recursive:
124 @set . $$MAKEFLAGS; final_exit=:; \
125 case $$2 in --unix) shift ;; esac; \
126 case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \
127 list='$(PROFILE_SUBDIRS)'; for d in $$list ; do \
128 (cd $$d && $(MAKE) $*) || { final_exit="exit 1"; $$dk; } ; \
129 done; \
130 $$final_exit
132 ifndef DIST_SUBDIRS
133 DIST_SUBDIRS = $(SUBDIRS) $(DIST_ONLY_SUBDIRS)
134 endif
135 dist-recursive: dist-local
136 @case '$(distdir)' in [\\/$$]* | ?:[\\/]* ) reldir='$(distdir)' ;; *) reldir='../$(distdir)' ;; esac ; \
137 list='$(DIST_SUBDIRS)'; for d in $$list ; do \
138 (cd $$d && $(MAKE) distdir=$$reldir/$$d $@) || exit 1 ; \
139 done
141 # The following target can be used like
143 # dist-local: dist-default
144 # ... additional commands ...
146 # Notes:
147 # 1. we invert the test here to not end in an error if ChangeLog doesn't exist.
148 # 2. we error out if we try to dist a nonexistant file.
149 # 3. we pick up Makefile, makefile, or GNUmakefile.
150 dist-default:
151 -mkdir -p $(distdir)
152 test '!' -f ChangeLog || cp ChangeLog $(distdir)
153 if test -f Makefile; then m=M; fi; \
154 if test -f makefile; then m=m; fi; \
155 if test -f GNUmakefile; then m=GNUm; fi; \
156 for f in $${m}akefile $(DISTFILES) ; do \
157 dest=`dirname $(distdir)/$$f` ; \
158 $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1 ; \
159 done
161 # Useful
163 withmcs:
164 $(MAKE) MCS='$(INTERNAL_MCS)' BOOTSTRAP_MCS='$(INTERNAL_MCS)' all
166 dll-sources:
167 echo "../../build/common/Consts.cs" > $(LIBRARY).sources
168 echo "../../build/common/MonoTODOAttribute.cs" >> $(LIBRARY).sources
169 ls */*.cs >> $(LIBRARY).sources
170 cd Test; ls */*.cs > ../$(LIBRARY:.dll=_test.dll).sources; cd ..