**** Merged from MCS ****
[mono-project.git] / mcs / build / executable.make
blob2085449e23afb61b5903a7cc169ebc1849a46a3c
1 # -*- makefile -*-
3 # The rules for building a program.
5 # I'd rather not create a response file here,
6 # but since on Win32 we need to munge the paths
7 # anyway, we might as well.
9 base_prog = $(shell basename $(PROGRAM))
10 sourcefile = $(base_prog).sources
11 PROGRAM_config := $(wildcard $(PROGRAM).config)
13 ifeq (cat,$(PLATFORM_CHANGE_SEPARATOR_CMD))
14 response = $(sourcefile)
15 else
16 response = $(depsdir)/$(base_prog).response
17 executable_CLEAN_FILES += $(response)
18 endif
20 makefrag = $(depsdir)/$(base_prog).makefrag
21 pdb = $(patsubst %.exe,%.pdb,$(PROGRAM))
22 mdb = $(patsubst %.exe,%.mdb,$(PROGRAM))
23 executable_CLEAN_FILES += $(makefrag) $(pdb) $(mdb)
25 ifndef PROGRAM_INSTALL_DIR
26 PROGRAM_INSTALL_DIR = $(prefix)/bin
27 endif
29 all-local: $(PROGRAM)
31 install-local: $(PROGRAM) $(PROGRAM_config)
32 $(MKINSTALLDIRS) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
33 $(INSTALL_BIN) $(PROGRAM) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
34 -$(INSTALL_BIN) $(PROGRAM).mdb $(DESTDIR)$(PROGRAM_INSTALL_DIR)
35 ifdef PROGRAM_config
36 $(INSTALL_DATA) $(PROGRAM_config) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
37 endif
39 uninstall-local:
40 -rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog) $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog).mdb
42 clean-local:
43 -rm -f *.exe $(BUILT_SOURCES) $(executable_CLEAN_FILES) $(CLEAN_FILES)
45 test-local: $(PROGRAM)
47 run-test-local:
49 run-test-ondotnet-local:
52 DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
54 dist-local: dist-default
55 for f in `cat $(sourcefile)` ; do \
56 dest=`dirname $(distdir)/$$f` ; \
57 $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
58 done
60 ifndef PROGRAM_COMPILE
61 PROGRAM_COMPILE = $(CSCOMPILE)
62 endif
64 $(PROGRAM): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response)
65 $(PROGRAM_COMPILE) /target:exe /out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
67 $(makefrag): $(sourcefile)
68 @echo Creating $@ ...
69 @sed 's,^,$(PROGRAM): ,' $< > $@
71 ifneq ($(response),$(sourcefile))
72 $(response): $(sourcefile)
73 @echo Creating $@ ...
74 @( $(PLATFORM_CHANGE_SEPARATOR_CMD) ) <$< >$@
75 endif
77 -include $(makefrag)
79 all-local: $(makefrag)
80 $(makefrag): $(topdir)/build/executable.make