Add VS project files for test project
[mono-project.git] / mcs / build / executable.make
blobb9935a42927135136f670b6acddb75052484c100
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 executable_CLEAN_FILES = *.exe $(PROGRAM) $(PROGRAM).mdb $(BUILT_SOURCES)
16 ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
17 response = $(sourcefile)
18 else
19 response = $(depsdir)/$(sourcefile).response
20 executable_CLEAN_FILES += $(response)
21 endif
23 ifndef the_libdir
24 the_libdir = $(topdir)/class/lib/$(PROFILE)/
25 ifdef PROGRAM_USE_INTERMEDIATE_FILE
26 build_libdir = $(the_libdir)tmp/
27 else
28 build_libdir = $(the_libdir)
29 endif
30 endif
32 ifdef base_prog_config
33 PROGRAM_config := $(build_libdir)$(PROGRAM).config
34 endif
36 the_lib = $(the_libdir)$(base_prog)
37 build_lib = $(build_libdir)$(base_prog)
39 makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
40 pdb = $(patsubst %.exe,%.pdb,$(PROGRAM))
41 mdb = $(patsubst %.exe,%.mdb,$(PROGRAM))
42 executable_CLEAN_FILES += $(makefrag) $(pdb) $(mdb)
44 all-local: $(the_lib) $(PROGRAM_config)
46 install-local: all-local
47 test-local: all-local
48 uninstall-local:
50 ifdef NO_INSTALL
51 install-local uninstall-local:
53 else
55 ifndef PROGRAM_INSTALL_DIR
56 PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
57 endif
59 install-local:
60 $(MKINSTALLDIRS) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
61 $(INSTALL_BIN) $(the_lib) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
62 test ! -f $(the_lib).mdb || $(INSTALL_BIN) $(the_lib).mdb $(DESTDIR)$(PROGRAM_INSTALL_DIR)
63 ifdef PROGRAM_config
64 $(INSTALL_DATA) $(PROGRAM_config) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
65 endif
66 ifdef PLATFORM_AOT_SUFFIX
67 test ! -f $(PROGRAM)$(PLATFORM_AOT_SUFFIX) || $(INSTALL_LIB) $(PROGRAM)$(PLATFORM_AOT_SUFFIX) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
68 endif
70 uninstall-local:
71 -rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog) $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog).mdb $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog).config
72 endif
74 clean-local:
75 -rm -f $(executable_CLEAN_FILES) $(CLEAN_FILES) $(tests_CLEAN_FILES)
77 test-local:
79 run-test-local:
81 run-test-ondotnet-local:
84 DISTFILES = $(sourcefile) $(base_prog_config) $(EXTRA_DISTFILES)
86 ifdef HAS_NUNIT_TEST
87 ASSEMBLY = $(PROGRAM)
88 ASSEMBLY_EXT = .exe
89 the_assembly = $(PROGRAM)
90 include $(topdir)/build/tests.make
91 endif
93 ifdef HAVE_CS_TESTS
94 DISTFILES += $(test_sourcefile)
95 endif
97 dist-local: dist-default
98 for f in `cat $(sourcefile)` ; do \
99 case $$f in \
100 ../*) : ;; \
101 *) dest=`dirname "$$f"` ; \
102 case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
103 cp -p "$$f" $(distdir)/$$dest || exit 1 ;; \
104 esac ; done ; \
105 for d in . $$subs ; do \
106 case $$d in .) : ;; *) test ! -f $$d/ChangeLog || cp -p $$d/ChangeLog $(distdir)/$$d ;; esac ; done
108 ifndef PROGRAM_COMPILE
109 PROGRAM_COMPILE = $(CSCOMPILE)
110 endif
112 $(the_lib): $(the_libdir)/.stamp
114 $(build_lib): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response) $(build_libdir:=/.stamp)
115 $(PROGRAM_COMPILE) -target:exe -out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
117 ifdef PROGRAM_USE_INTERMEDIATE_FILE
118 $(the_lib): $(build_lib)
119 $(Q) cp $(build_lib) $@
120 $(Q) test ! -f $(build_lib).mdb || mv $(build_lib).mdb $@.mdb
121 $(Q) test ! -f $(build_lib:.exe=.pdb) || mv $(build_lib:.exe=.pdb) $(the_lib:.exe=.pdb)
122 endif
124 ifdef PROGRAM_config
125 ifneq ($(base_prog_config),$(PROGRAM_config))
126 executable_CLEAN_FILES += $(PROGRAM_config)
127 $(PROGRAM_config): $(base_prog_config) $(dir $(PROGRAM_config))/.stamp
128 cp $(base_prog_config) $(PROGRAM_config)
129 endif
130 endif
132 $(makefrag): $(sourcefile)
133 # @echo Creating $@ ...
134 @sed 's,^,$(build_lib): ,' $< >$@
135 @if test ! -f $(sourcefile).makefrag; then :; else \
136 cat $(sourcefile).makefrag >> $@ ; \
137 echo '$@: $(sourcefile).makefrag' >> $@; \
138 echo '$(sourcefile).makefrag:' >> $@; fi
140 ifneq ($(response),$(sourcefile))
141 $(response): $(sourcefile)
142 @echo Converting $(sourcefile) to $@ ...
143 @cat $(sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
144 endif
146 -include $(makefrag)
148 all-local: $(makefrag) $(extra_targets)
150 csproj-local:
151 config_file=`basename $(PROGRAM) .exe`-$(PROFILE).input; \
152 echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
153 (echo $(is_boot); \
154 echo $(MCS); \
155 echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS); \
156 echo $(PROGRAM); \
157 echo $(BUILT_SOURCES_cmdline); \
158 echo $(build_lib); \
159 echo $(FRAMEWORK_VERSION); \
160 echo $(response)) > $(topdir)/../msvc/scripts/inputs/$$config_file
163 ifneq ($(response),$(sourcefile))
164 $(response): $(topdir)/build/executable.make $(depsdir)/.stamp
165 endif
166 $(makefrag): $(topdir)/build/executable.make $(depsdir)/.stamp
168 doc-update-local: