3 # The rules for building a program.
5 base_prog = $(notdir $(PROGRAM))
7 sourcefile := $(base_prog).sources
9 base_prog_config := $(wildcard $(base_prog).config.$(PROFILE))
10 ifndef base_prog_config
11 base_prog_config := $(wildcard $(base_prog).config)
14 ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
15 response = $(sourcefile)
17 response = $(depsdir)/$(sourcefile).response
18 executable_CLEAN_FILES += $(response)
22 the_libdir = $(topdir)/class/lib/$(PROFILE)/
23 ifdef PROGRAM_USE_INTERMEDIATE_FILE
24 build_libdir = $(the_libdir)tmp/
26 build_libdir = $(the_libdir)
30 ifdef base_prog_config
31 PROGRAM_config := $(build_libdir)$(PROGRAM).config
34 the_lib = $(the_libdir)$(base_prog)
35 build_lib = $(build_libdir)$(base_prog)
37 executable_CLEAN_FILES += $(the_lib) $(the_lib).so $(the_lib).mdb $(the_lib:.exe=.pdb)
38 executable_CLEAN_FILES += $(build_lib) $(build_lib).so $(build_lib).mdb $(build_lib:.exe=.pdb)
40 makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
42 all-local: $(the_lib) $(PROGRAM_config)
44 install-local: all-local
49 install-local uninstall-local:
53 ifndef PROGRAM_INSTALL_DIR
54 PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
58 $(MKINSTALLDIRS) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
59 $(INSTALL_BIN) $(the_lib) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
60 test ! -f $(the_lib).mdb || $(INSTALL_BIN) $(the_lib).mdb $(DESTDIR)$(PROGRAM_INSTALL_DIR)
62 $(INSTALL_DATA) $(PROGRAM_config) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
64 ifdef PLATFORM_AOT_SUFFIX
65 test ! -f $(PROGRAM)$(PLATFORM_AOT_SUFFIX) || $(INSTALL_LIB) $(PROGRAM)$(PLATFORM_AOT_SUFFIX) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
69 -rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog) $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog).mdb $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog).config
73 -rm -f $(executable_CLEAN_FILES) $(CLEAN_FILES) $(tests_CLEAN_FILES)
79 run-test-ondotnet-local:
82 DISTFILES = $(sourcefile) $(base_prog_config) $(EXTRA_DISTFILES)
87 the_assembly = $(PROGRAM)
88 include $(topdir)/build/tests.make
92 DISTFILES += $(test_sourcefile)
95 dist-local: dist-default
96 for f in `cat $(sourcefile)` ; do \
99 *) dest=`dirname "$$f"` ; \
100 case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \
101 cp -p "$$f" $(distdir)/$$dest || exit 1 ;; \
103 for d in . $$subs ; do \
104 case $$d in .) : ;; *) test ! -f $$d/ChangeLog || cp -p $$d/ChangeLog $(distdir)/$$d ;; esac ; done
106 ifndef PROGRAM_COMPILE
107 PROGRAM_COMPILE = $(CSCOMPILE)
110 $(the_lib): $(the_libdir)/.stamp
112 $(build_lib): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response) $(build_libdir:=/.stamp)
113 $(PROGRAM_COMPILE) -target:exe -out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
115 ifdef PROGRAM_USE_INTERMEDIATE_FILE
116 $(the_lib): $(build_lib)
117 $(Q) cp $(build_lib) $@
118 $(Q) test ! -f $(build_lib).mdb || mv $(build_lib).mdb $@.mdb
119 $(Q) test ! -f $(build_lib:.exe=.pdb) || mv $(build_lib:.exe=.pdb) $(the_lib:.exe=.pdb)
123 ifneq ($(base_prog_config),$(PROGRAM_config))
124 executable_CLEAN_FILES += $(PROGRAM_config)
125 $(PROGRAM_config): $(base_prog_config) $(dir $(PROGRAM_config))/.stamp
126 cp $(base_prog_config) $(PROGRAM_config)
130 $(makefrag): $(sourcefile)
131 # @echo Creating $@ ...
132 @sed 's,^,$(build_lib): ,' $< >$@
133 @if test ! -f $(sourcefile).makefrag; then :; else \
134 cat $(sourcefile).makefrag >> $@ ; \
135 echo '$@: $(sourcefile).makefrag' >> $@; \
136 echo '$(sourcefile).makefrag:' >> $@; fi
138 ifneq ($(response),$(sourcefile))
139 $(response): $(sourcefile)
140 @echo Converting $(sourcefile) to $@ ...
141 @cat $(sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
146 all-local: $(makefrag) $(extra_targets)
149 config_file=`basename $(PROGRAM) .exe`-$(PROFILE).input; \
150 echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
152 echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(patsubst %,-r:%,$(LIB_REFS)); \
154 echo $(BUILT_SOURCES_cmdline); \
156 echo $(FRAMEWORK_VERSION); \
158 echo $(response)) > $(topdir)/../msvc/scripts/inputs/$$config_file
161 ifneq ($(response),$(sourcefile))
162 $(response): $(topdir)/build/executable.make $(depsdir)/.stamp
164 $(makefrag): $(topdir)/build/executable.make $(depsdir)/.stamp
169 # Need to be here so it comes after the definition of DEP_DIRS/DEP_LIBS
171 @echo "$(DEPS_TARGET_DIR): $(DEP_DIRS) $(DEP_LIBS)" >> $(DEPS_FILE)