* PagedDataSource.cs:
[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 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
12 response = $(depsdir)/$(base_prog).response
13 else
14 response = $(sourcefile)
15 endif
16 stampfile = $(depsdir)/$(base_prog).stamp
17 makefrag = $(depsdir)/$(base_prog).makefrag
18 pdb = $(patsubst %.exe,%.pdb,$(PROGRAM))
19
20 all-local: $(PROGRAM)
21
22 install-local: $(PROGRAM)
23         $(MKINSTALLDIRS) $(DESTDIR)$(prefix)/bin
24         $(INSTALL_BIN) $(PROGRAM) $(DESTDIR)$(prefix)/bin
25
26 uninstall-local:
27         -rm -f $(DESTDIR)$(prefix)/bin/$(base_prog)
28
29 clean-local:
30         -rm -f *.exe $(BUILT_SOURCES) $(CLEAN_FILES) $(pdb) $(stampfile) $(makefrag)
31 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
32         -rm -f $(response)
33 endif
34
35 ifndef HAS_TEST
36 test-local: $(PROGRAM)
37
38 run-test-local:
39 endif
40
41 DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
42
43 dist-local: dist-default
44         for f in `cat $(sourcefile)` ; do \
45             dest=`dirname $(distdir)/$$f` ; \
46             $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
47         done
48
49 # Changing makefile probably means changing the
50 # sources, so let's be safe and add a Makefile dep
51
52 $(PROGRAM): $(makefrag) $(response) $(stampfile)
53         $(CSCOMPILE) /target:exe /out:$@ $(BUILT_SOURCES) @$(response)
54
55 $(makefrag): $(sourcefile)
56         @echo Creating $@ ...
57         @echo "HAVE_MAKEFRAG = yes" >$@.new
58         @echo "$(stampfile): $(BUILT_SOURCES) \\" >>$@.new
59         @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
60         @cat $@.new |sed -e '$$s, \\$$,,' >$@
61         @$(ECHO_ESCAPE) "\ttouch \$$@" >>$@
62         @rm -rf $@.new
63
64 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
65 $(response): $(sourcefile)
66         @echo Creating $@ ...
67         @cat $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
68 endif
69
70 -include $(makefrag)
71
72 ifndef HAVE_MAKEFRAG
73 $(stampfile):
74         touch $@
75 endif
76