* COMException.cs: Added missing colon in ToString.
[mono.git] / mcs / build / executable.make
index 767267aa5ce3949f112978b2ee1d414001309fde..f3113385a5ccf9c7cd8eeb44b56a3e17ce7246c2 100644 (file)
@@ -3,7 +3,7 @@
 # The rules for building a program.
 
 base_prog = $(notdir $(PROGRAM))
-prog_dir = $(dir $(PROGRAM))
+prog_dir := $(filter-out . ./, $(dir $(PROGRAM)))
 sourcefile = $(base_prog).sources
 base_prog_config := $(wildcard $(base_prog).config.$(PROFILE))
 ifndef base_prog_config
@@ -22,6 +22,12 @@ response = $(depsdir)/$(base_prog).response
 executable_CLEAN_FILES += $(response)
 endif
 
+ifdef KEEP_OUTPUT_FILE_COPY
+       COPY_CMD = cp
+else
+       COPY_CMD = mv
+endif
+
 makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
 pdb = $(patsubst %.exe,%.pdb,$(PROGRAM))
 mdb = $(patsubst %.exe,%.mdb,$(PROGRAM))
@@ -81,14 +87,17 @@ ifndef PROGRAM_COMPILE
 PROGRAM_COMPILE = $(CSCOMPILE)
 endif
 
-$(prog_dir):
-       $(MKINSTALLDIRS) $@
+ifdef prog_dir
+$(prog_dir)/.stamp:
+       $(MKINSTALLDIRS) $(@D)
+       touch $@
+endif
 
-$(PROGRAM): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response) | $(prog_dir)
+$(PROGRAM): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response) $(prog_dir:=/.stamp)
        $(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
+       $(COPY_CMD) $(base_prog) $(PROGRAM)
+       test ! -f $(base_prog).mdb || $(COPY_CMD) $(base_prog).mdb $(PROGRAM).mdb
 endif
 
 ifdef PROGRAM_config
@@ -112,4 +121,8 @@ endif
 -include $(makefrag)
 
 all-local: $(makefrag)
-$(makefrag): $(topdir)/build/executable.make
+
+ifneq ($(response),$(sourcefile))
+$(response): $(topdir)/build/executable.make $(depsdir)/.stamp
+endif
+$(makefrag): $(topdir)/build/executable.make $(depsdir)/.stamp