[profiler] Don't call mono_gc_base_init () before loading profilers.
[mono-project.git] / mcs / build / executable.make
blob902697219b4e6b84bb791bc4a74fab9239f32e6f
1 # -*- makefile -*-
3 # The rules for building a program.
5 base_prog = $(notdir $(PROGRAM))
6 ifndef sourcefile
7 sourcefile := $(base_prog).sources
8 endif
9 base_prog_config := $(wildcard $(base_prog).config.$(PROFILE))
10 ifndef base_prog_config
11 base_prog_config := $(wildcard $(base_prog).config)
12 endif
14 ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
15 response = $(sourcefile)
16 else
17 response = $(depsdir)/$(sourcefile).response
18 executable_CLEAN_FILES += $(response)
19 endif
21 ifndef the_libdir
22 the_libdir = $(topdir)/class/lib/$(PROFILE_DIRECTORY)/
23 ifdef PROGRAM_USE_INTERMEDIATE_FILE
24 build_libdir = $(the_libdir)tmp/
25 else
26 build_libdir = $(the_libdir)
27 endif
28 endif
30 ifdef base_prog_config
31 PROGRAM_config := $(build_libdir)$(PROGRAM).config
32 endif
34 sn = $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/sn.exe
35 SN = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn) -q
37 the_lib = $(the_libdir)$(base_prog)
38 build_lib = $(build_libdir)$(base_prog)
40 executable_CLEAN_FILES += $(the_lib) $(the_lib).so $(the_lib).mdb $(the_lib:.exe=.pdb)
41 executable_CLEAN_FILES += $(build_lib) $(build_lib).so $(build_lib).mdb $(build_lib:.exe=.pdb)
43 makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
45 MCS_REFERENCES = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS))
46 MCS_REFERENCES += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.exe,$(EXE_REFS))
48 ifndef NO_BUILD
49 all-local: $(the_lib) $(PROGRAM_config)
50 endif
52 install-local: all-local
53 test-local: all-local
54 uninstall-local:
56 ifdef NO_INSTALL
57 install-local uninstall-local:
59 else
61 ifndef PROGRAM_INSTALL_DIR
62 PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
63 endif
65 install-local:
66 $(MKINSTALLDIRS) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
67 $(INSTALL_BIN) $(the_lib) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
68 test ! -f $(the_lib).mdb || $(INSTALL_BIN) $(the_lib).mdb $(DESTDIR)$(PROGRAM_INSTALL_DIR)
69 test ! -f $(the_lib:.exe=.pdb) || $(INSTALL_BIN) $(the_lib:.exe=.pdb) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
70 ifdef PROGRAM_config
71 $(INSTALL_DATA) $(PROGRAM_config) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
72 endif
73 ifdef PLATFORM_AOT_SUFFIX
74 test ! -f $(PROGRAM)$(PLATFORM_AOT_SUFFIX) || $(INSTALL_LIB) $(PROGRAM)$(PLATFORM_AOT_SUFFIX) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
75 endif
77 uninstall-local:
78 -rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog) $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog).mdb \
79 $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog:.exe=.pdb) $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog).config
80 endif
82 clean-local:
83 -rm -f $(executable_CLEAN_FILES) $(CLEAN_FILES) $(tests_CLEAN_FILES)
85 test-local:
87 run-test-local:
89 run-test-ondotnet-local:
92 DISTFILES = $(sourcefile) $(base_prog_config) $(EXTRA_DISTFILES)
94 ifdef HAS_NUNIT_TEST
95 ASSEMBLY = $(PROGRAM)
96 ASSEMBLY_EXT = .exe
97 the_assembly = $(PROGRAM)
98 include $(topdir)/build/tests.make
99 endif
101 ifdef HAVE_CS_TESTS
102 DISTFILES += $(test_sourcefile)
103 endif
105 dist-local: dist-default
106 for f in `cat $(sourcefile)` ; do \
107 case $$f in \
108 ../*) : ;; \
109 *) dest=`dirname "$$f"` ; \
110 case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
111 cp -p "$$f" $(distdir)/$$dest || exit 1 ;; \
112 esac ; done ; \
113 for d in . $$subs ; do \
114 case $$d in .) : ;; *) test ! -f $$d/ChangeLog || cp -p $$d/ChangeLog $(distdir)/$$d ;; esac ; done
116 ifndef PROGRAM_COMPILE
117 PROGRAM_COMPILE = $(CSCOMPILE)
118 endif
120 $(the_lib): $(the_libdir)/.stamp $(if $(PROFILE_PLATFORM),$(if $(filter $(HOST_PLATFORM),$(BUILD_PLATFORM)),$(topdir)/class/lib/$(PROFILE)/.stamp))
122 ifdef PROFILE_PLATFORM
123 $(topdir)/class/lib/$(PROFILE)/.stamp: | $(topdir)/class/lib/$(PROFILE)-$(HOST_PLATFORM)/.stamp
124 $(if $(filter $(HOST_PLATFORM),$(BUILD_PLATFORM)),$(if $(filter $(BUILD_PLATFORM),win32),CYGWIN=winsymlinks:nativestrict) ln -s $(abspath $(topdir)/class/lib/$(PROFILE)-$(BUILD_PLATFORM)) $(abspath $(topdir)/class/lib/$(PROFILE)))
125 endif
127 $(build_lib): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response) $(build_libdir:=/.stamp)
128 $(PROGRAM_COMPILE) $(MCS_REFERENCES) -target:exe -out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
129 ifdef PROGRAM_SNK
130 $(Q) $(SN) -R $@ $(PROGRAM_SNK)
131 endif
133 ifdef PROGRAM_USE_INTERMEDIATE_FILE
134 $(the_lib): $(build_lib)
135 $(Q) cp $(build_lib) $@
136 $(Q) test ! -f $(build_lib).mdb || mv $(build_lib).mdb $@.mdb
137 $(Q) test ! -f $(build_lib:.exe=.pdb) || mv $(build_lib:.exe=.pdb) $(the_lib:.exe=.pdb)
138 endif
140 ifdef PROGRAM_config
141 ifneq ($(base_prog_config),$(PROGRAM_config))
142 executable_CLEAN_FILES += $(PROGRAM_config)
143 $(PROGRAM_config): $(base_prog_config) $(dir $(PROGRAM_config))/.stamp
144 cp $(base_prog_config) $(PROGRAM_config)
145 endif
146 endif
148 $(makefrag): $(sourcefile)
149 # @echo Creating $@ ...
150 @sed 's,^,$(build_lib): ,' $< >$@
151 @if test ! -f $(sourcefile).makefrag; then :; else \
152 cat $(sourcefile).makefrag >> $@ ; \
153 echo '$@: $(sourcefile).makefrag' >> $@; \
154 echo '$(sourcefile).makefrag:' >> $@; fi
156 ifneq ($(response),$(sourcefile))
157 $(response): $(sourcefile)
158 @echo Converting $(sourcefile) to $@ ...
159 @cat $(sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
160 endif
162 -include $(makefrag)
164 all-local: $(makefrag) $(extra_targets)
166 ifdef BUILT_SOURCES
167 library_CLEAN_FILES += $(BUILT_SOURCES)
168 ifeq (cat, $(PLATFORM_CHANGE_SEPARATOR_CMD))
169 BUILT_SOURCES_cmdline = $(BUILT_SOURCES)
170 else
171 BUILT_SOURCES_cmdline = `echo $(BUILT_SOURCES) | $(PLATFORM_CHANGE_SEPARATOR_CMD)`
172 endif
173 endif
175 csproj-local:
176 config_file=`basename $(PROGRAM) .exe`-$(PROFILE).input; \
177 echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
178 (echo $(is_boot); \
179 echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(patsubst %,-r:%,$(LIB_REFS)); \
180 echo $(PROGRAM); \
181 echo $(BUILT_SOURCES_cmdline); \
182 echo $(build_lib); \
183 echo $(FRAMEWORK_VERSION); \
184 echo $(PROFILE); \
185 echo $(RESOURCE_DEFS); \
186 echo $(response)) > $(topdir)/../msvc/scripts/inputs/$$config_file
189 ifneq ($(response),$(sourcefile))
190 $(response): $(topdir)/build/executable.make $(depsdir)/.stamp
191 endif
192 $(makefrag): $(topdir)/build/executable.make $(depsdir)/.stamp
194 doc-update-local:
197 # Need to be here so it comes after the definition of DEP_DIRS/DEP_LIBS
198 gen-deps:
199 @echo "$(DEPS_TARGET_DIR): $(DEP_DIRS) $(DEP_LIBS)" >> $(DEPS_FILE)