#
# The rules for building a program.
-# I'd rather not create a response file here,
-# but since on Win32 we need to munge the paths
-# anyway, we might as well.
-
base_prog = $(shell basename $(PROGRAM))
sourcefile = $(base_prog).sources
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-response = $(depsdir)/$(base_prog).response
-else
+base_prog_config := $(wildcard $(base_prog).config)
+ifdef base_prog_config
+PROGRAM_config := $(PROGRAM).config
+endif
+
+executable_CLEAN_FILES = *.exe $(PROGRAM) $(PROGRAM).mdb $(BUILT_SOURCES)
+
+ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
response = $(sourcefile)
+else
+response = $(depsdir)/$(base_prog).response
+executable_CLEAN_FILES += $(response)
endif
-stampfile = $(depsdir)/$(base_prog).stamp
-makefrag = $(depsdir)/$(base_prog).makefrag
+
+makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
pdb = $(patsubst %.exe,%.pdb,$(PROGRAM))
+mdb = $(patsubst %.exe,%.mdb,$(PROGRAM))
+executable_CLEAN_FILES += $(makefrag) $(pdb) $(mdb)
-all-local: $(PROGRAM)
+all-local: $(PROGRAM) $(PROGRAM_config)
-install-local:
- $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/bin
- $(INSTALL_BIN) $(PROGRAM) $(DESTDIR)$(prefix)/bin
+install-local: all-local
+test-local: all-local
+uninstall-local:
-clean-local:
- -rm -f *.exe $(BUILT_SOURCES) $(CLEAN_FILES) $(pdb) $(stampfile) $(makefrag)
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
- -rm -f $(response)
+ifdef NO_INSTALL
+install-local uninstall-local:
+ @:
+else
+
+ifndef PROGRAM_INSTALL_DIR
+PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
+endif
+
+install-local: $(PROGRAM) $(PROGRAM_config)
+ $(MKINSTALLDIRS) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
+ $(INSTALL_BIN) $(PROGRAM) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
+ test ! -f $(PROGRAM).mdb || $(INSTALL_BIN) $(PROGRAM).mdb $(DESTDIR)$(PROGRAM_INSTALL_DIR)
+ifdef PROGRAM_config
+ $(INSTALL_DATA) $(PROGRAM_config) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
+endif
+
+uninstall-local:
+ -rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog) $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog).mdb $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog).config
endif
-ifndef HAS_TEST
-test-local: $(PROGRAM)
+clean-local:
+ -rm -f $(executable_CLEAN_FILES) $(CLEAN_FILES)
+test-local:
+ @:
run-test-local:
-endif
+ @:
+run-test-ondotnet-local:
+ @:
-DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
+DISTFILES = $(sourcefile) $(base_prog_config) $(EXTRA_DISTFILES)
dist-local: dist-default
for f in `cat $(sourcefile)` ; do \
dest=`dirname $(distdir)/$$f` ; \
- $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
+ $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1 ; \
done
-# Changing makefile probably means changing the
-# sources, so let's be safe and add a Makefile dep
+ifndef PROGRAM_COMPILE
+PROGRAM_COMPILE = $(CSCOMPILE)
+endif
-$(PROGRAM): $(makefrag) $(response) $(stampfile)
- $(CSCOMPILE) /target:exe /out:$@ $(BUILT_SOURCES) @$(response)
+$(PROGRAM): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response)
+ $(PROGRAM_COMPILE) /target:exe /out:$(base_prog) $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
+ifneq ($(base_prog),$(PROGRAM))
+ mv $(base_prog) $(PROGRAM)
+ test ! -f $(base_prog).mdb || mv $(base_prog).mdb $(PROGRAM).mdb
+endif
+
+ifdef PROGRAM_config
+ifneq ($(base_prog_config),$(PROGRAM_config))
+executable_CLEAN_FILES += $(PROGRAM_config)
+$(PROGRAM_config): $(base_prog_config)
+ cp $(base_prog_config) $(PROGRAM_config)
+endif
+endif
$(makefrag): $(sourcefile)
@echo Creating $@ ...
- @echo "HAVE_MAKEFRAG = yes" >$@.new
- @echo "$(stampfile): $(BUILT_SOURCES) \\" >>$@.new
- @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
- @cat $@.new |sed -e '$$s, \\$$,,' >$@
- @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
- @rm -rf $@.new
-
-ifdef PLATFORM_CHANGE_SEPARATOR_CMD
+ @sed 's,^,$(PROGRAM): ,' $< > $@
+
+ifneq ($(response),$(sourcefile))
$(response): $(sourcefile)
@echo Creating $@ ...
- @cat $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
+ @( $(PLATFORM_CHANGE_SEPARATOR_CMD) ) <$< >$@
endif
-include $(makefrag)
-ifndef HAVE_MAKEFRAG
-$(stampfile):
- touch $@
-endif
-
+all-local: $(makefrag)
+$(makefrag): $(topdir)/build/executable.make