2004-06-13 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / build / executable.make
index 189f91cd45b8aa22536b6b441297e32dd57e08f6..6bb38a9bc76a7060d5dbc1bff644b1c077aaa3d1 100644 (file)
@@ -6,66 +6,65 @@
 # but since on Win32 we need to munge the paths
 # anyway, we might as well.
 
-sourcefile = $(PROGRAM).sources
+base_prog = $(shell basename $(PROGRAM))
+sourcefile = $(base_prog).sources
 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
-response = $(depsdir)/$(PROGRAM).response
+response = $(depsdir)/$(base_prog).response
 else
 response = $(sourcefile)
 endif
-stampfile = $(depsdir)/$(PROGRAM).stamp
-makefrag = $(depsdir)/$(PROGRAM).makefrag
+makefrag = $(depsdir)/$(base_prog).makefrag
+pdb = $(patsubst %.exe,%.pdb,$(PROGRAM))
+
+ifndef PROGRAM_INSTALL_DIR
+PROGRAM_INSTALL_DIR = $(prefix)/bin
+endif
 
 all-local: $(PROGRAM)
 
-install-local:
-       $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/bin
-       $(INSTALL_BIN) $(PROGRAM) $(DESTDIR)$(prefix)/bin
+install-local: $(PROGRAM)
+       $(MKINSTALLDIRS) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
+       $(INSTALL_BIN) $(PROGRAM) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
+
+uninstall-local:
+       -rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog)
 
 clean-local:
-       -rm -f *.exe $(BUILT_SOURCES) $(CLEAN_FILES) $(stampfile) $(makefrag)
+       -rm -f *.exe $(BUILT_SOURCES) $(CLEAN_FILES) $(pdb) $(makefrag)
 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
        -rm -f $(response)
 endif
 
-ifndef HAS_TEST
 test-local: $(PROGRAM)
-
+       @:
 run-test-local:
-endif
+       @:
+run-test-ondotnet-local:
+       @:
 
 DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
 
 dist-local: dist-default
-       cat $(sourcefile) |xargs -n 20 \
-           $(SHELL) -c 'for f in $$* ; do \
-               dest=`dirname $(distdir)/$$f` ; \
-               $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
-           done' dollar0
+       for f in `cat $(sourcefile)` ; do \
+           dest=`dirname $(distdir)/$$f` ; \
+           $(MKINSTALLDIRS) $$dest && cp $$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): $(makefrag) $(BUILT_SOURCES) $(response)
+       $(PROGRAM_COMPILE) /target:exe /out:$@ $(BUILT_SOURCES) @$(response)
 
 $(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
+       @sed 's,^,$(PROGRAM): ,' $< > $@
 
 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
 $(response): $(sourcefile)
-       cat $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
+       @echo Creating $@ ...
+       @cat $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
 endif
 
 -include $(makefrag)
-
-ifndef HAVE_MAKEFRAG
-$(stampfile):
-       touch $@
-endif
-