2002-08-15 Tim Coleman <tim@timcoleman.com>
[mono.git] / mcs / class / library.make
1 #USE_SOURCE_RULES=1
2 MCS = mono $(topdir)/mcs/mcs.exe
3 MCS_FLAGS = --target library --noconfig
4 INSTALL = /usr/bin/install
5 prefix = /usr
6
7
8 SOURCES_CMD=find . \
9         ! \( $(SOURCES_INCLUDE:%=! -path '%' ) \) -a    \
10           \( $(SOURCES_EXCLUDE:%=! -path '%' ) \) -a    \
11           ! -path '*/__*.cs'
12
13
14 all: .makefrag $(LIBRARY)
15
16 clean:
17         -rm -rf $(LIBRARY) .response .makefrag library-deps.stamp
18
19
20 ifdef USE_SOURCE_RULES
21
22 .PHONY: .makefrag
23 .makefrag:
24         @echo -n "SOURCES=" >$@
25         @$(SOURCES_CMD) | tee .response | sed -e 's/$$/ \\/' >>$@
26
27 else
28
29 .response: $(LIB_LIST)
30         cat $^ |egrep '\.cs$$' >$@
31
32 .makefrag: $(LIB_LIST) $(topdir)/class/library.make
33         echo -n "library-deps.stamp: " >$@.new
34         cat $< |egrep '\.cs$$' | sed -e 's,\.cs,.cs \\,' >>$@.new
35         cat $@.new |sed -e '$$s, \\$$,,' >$@
36         echo -e "\ttouch library-deps.stamp" >>$@
37         rm -rf $@.new
38
39 endif
40
41 -include .makefrag
42
43 ifdef USE_SOURCE_RULES
44 $(LIBRARY): $(SOURCES) $(topdir)/class/library.make
45 else
46 $(LIBRARY): .response library-deps.stamp
47 endif
48         MONO_PATH=$(MONO_PATH_PREFIX)$(MONO_PATH) $(MCS) $(MCS_FLAGS) -o $(LIBRARY) $(LIB_FLAGS) @.response
49
50 install: all
51         mkdir -p $(prefix)/lib/
52         $(INSTALL) -m 644 $(LIBRARY) $(prefix)/lib/
53