2003-01-27 Ville Palo <vi64pa@koti.soon.fi>
[mono.git] / mcs / class / library.make
1 #USE_SOURCE_RULES=1
2 RUNTIME = mono
3 MCS = mcs
4 MCS_FLAGS = --target library --noconfig
5 INSTALL = /usr/bin/install
6 prefix = /usr
7
8
9 SOURCES_CMD=find . \
10         ! \( $(SOURCES_INCLUDE:%=! -path '%' ) \) -a    \
11           \( $(SOURCES_EXCLUDE:%=! -path '%' ) ! -path '/dev/null' \) -a        \
12           ! -path '*/__*.cs'
13
14
15 all: .makefrag $(LIBRARY)
16
17 clean:
18         -rm -rf $(LIBRARY) .response .makefrag library-deps.stamp
19
20
21 ifdef USE_SOURCE_RULES
22
23 .PHONY: .makefrag
24 .makefrag:
25         @echo -n "SOURCES=" >$@
26         @$(SOURCES_CMD) | tee .response | sed -e 's/$$/ \\/' >>$@
27
28 else
29
30 .response: $(LIB_LIST)
31         cat $^ |egrep '\.cs[[:space:]]*$$' >$@
32
33 .makefrag: $(LIB_LIST) $(topdir)/class/library.make
34         echo -n "library-deps.stamp: $(LIB_LIST) " >$@.new
35         cat $< |egrep '\.cs$$' | sed -e 's,\.cs,.cs \\,' >>$@.new
36         cat $@.new |sed -e '$$s, \\$$,,' >$@
37         echo -e "\ttouch library-deps.stamp" >>$@
38         rm -rf $@.new
39
40 endif
41
42 -include .makefrag
43
44 ifdef USE_SOURCE_RULES
45 $(LIBRARY): makefile.gnu $(SOURCES) $(topdir)/class/library.make
46 else
47 $(LIBRARY): .response library-deps.stamp
48 endif
49         MONO_PATH=$(MONO_PATH_PREFIX)$(MONO_PATH) $(MCS) $(MCS_FLAGS) -o $(LIBRARY) $(LIB_FLAGS) @.response
50
51 install: all
52         mkdir -p $(prefix)/lib/
53         $(INSTALL) -m 644 $(LIBRARY) $(prefix)/lib/
54
55 ifdef TEST_DIR
56 test:
57         $(MAKE) -C $(TEST_DIR) -f makefile.gnu $@
58 else
59 test:
60 endif
61