Reverted this:
[mono.git] / mcs / build / executable.make
1 # -*- makefile -*-
2 #
3 # The rules for building a program.
4
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.
8
9 base_prog = $(shell basename $(PROGRAM))
10 sourcefile = $(base_prog).sources
11 PROGRAM_config := $(wildcard $(PROGRAM).config)
12
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
19
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)
24
25 ifndef PROGRAM_INSTALL_DIR
26 PROGRAM_INSTALL_DIR = $(prefix)/bin
27 endif
28
29 all-local: $(PROGRAM)
30
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
38
39 uninstall-local:
40         -rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog) $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog).mdb
41
42 clean-local:
43         -rm -f *.exe $(BUILT_SOURCES) $(executable_CLEAN_FILES) $(CLEAN_FILES)
44
45 test-local: $(PROGRAM)
46         @:
47 run-test-local:
48         @:
49 run-test-ondotnet-local:
50         @:
51
52 DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
53
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
59
60 ifndef PROGRAM_COMPILE
61 PROGRAM_COMPILE = $(CSCOMPILE)
62 endif
63
64 $(PROGRAM): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response)
65         $(PROGRAM_COMPILE) /target:exe /out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
66
67 $(makefrag): $(sourcefile)
68         @echo Creating $@ ...
69         @sed 's,^,$(PROGRAM): ,' $< > $@
70
71 ifneq ($(response),$(sourcefile))
72 $(response): $(sourcefile)
73         @echo Creating $@ ...
74         @( $(PLATFORM_CHANGE_SEPARATOR_CMD) ) <$< >$@
75 endif
76
77 -include $(makefrag)
78
79 all-local: $(makefrag)
80 $(makefrag): $(topdir)/build/executable.make