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 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
12 response = $(depsdir)/$(base_prog).response
14 response = $(sourcefile)
16 stampfile = $(depsdir)/$(base_prog).stamp
17 makefrag = $(depsdir)/$(base_prog).makefrag
18 pdb = $(patsubst %.exe,%.pdb,$(PROGRAM))
20 ifndef PROGRAM_INSTALL_DIR
21 PROGRAM_INSTALL_DIR = $(prefix)/bin
26 install-local: $(PROGRAM)
27 $(MKINSTALLDIRS) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
28 $(INSTALL_BIN) $(PROGRAM) $(DESTDIR)$(PROGRAM_INSTALL_DIR)
31 -rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/$(base_prog)
34 -rm -f *.exe $(BUILT_SOURCES) $(CLEAN_FILES) $(pdb) $(stampfile) $(makefrag)
35 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
40 test-local: $(PROGRAM)
45 DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
47 dist-local: dist-default
48 for f in `cat $(sourcefile)` ; do \
49 dest=`dirname $(distdir)/$$f` ; \
50 $(MKINSTALLDIRS) $$dest && cp $$f $$dest || exit 1 ; \
53 # Changing makefile probably means changing the
54 # sources, so let's be safe and add a Makefile dep
56 ifndef PROGRAM_COMPILE
57 PROGRAM_COMPILE = $(CSCOMPILE)
60 $(PROGRAM): $(makefrag) $(response) $(stampfile)
61 $(PROGRAM_COMPILE) /target:exe /out:$@ $(BUILT_SOURCES) @$(response)
63 # warning: embedded tab in the 'echo touch' line
64 $(makefrag): $(sourcefile)
66 @echo "HAVE_MAKEFRAG = yes" >$@.new
67 @echo "$(stampfile): $(BUILT_SOURCES) \\" >>$@.new
68 @cat $< |sed -e 's,\.cs[ \t]*$$,\.cs \\,' >>$@.new
69 @cat $@.new |sed -e '$$s, \\$$,,' >$@
70 @echo " touch \$$@" >>$@
73 ifdef PLATFORM_CHANGE_SEPARATOR_CMD
74 $(response): $(sourcefile)
76 @cat $< |$(PLATFORM_CHANGE_SEPARATOR_CMD) >$@