[build] Add llvm folder to SUBDIRS/DIST_SUBDIRS
[mono.git] / Makefile.am
1 ACLOCAL_AMFLAGS = -I m4
2
3 AM_CFLAGS = $(WERROR_CFLAGS)
4
5 MONOTOUCH_SUBDIRS = $(libgc_dir) eglib/src mono
6
7 if CROSS_COMPILING
8 SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples msvc $(docs_dir) acceptance-tests llvm
9 # Keep in sync with SUBDIRS
10 ## 'tools' is not normally built
11 DIST_SUBDIRS = m4 po $(libgc_dir) eglib mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
12 else
13 SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples msvc $(docs_dir) acceptance-tests llvm
14 # Keep in sync with SUBDIRS
15 ## 'tools' is not normally built
16 DIST_SUBDIRS = m4 po $(libgc_dir) eglib mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
17 endif
18
19 all: update_submodules
20
21 SUBMODULE_ERROR='Could not recursively update all git submodules. You may experience compilation problems if some submodules are out of date'
22 update_submodules:
23         @$(srcdir)/scripts/update_submodules
24
25 .PHONY: update_submodules
26
27 EXTRA_DIST= \
28         README.md               \
29         LICENSE                 \
30         autogen.sh              \
31         mkinstalldirs           \
32         mono-uninstalled.pc.in  \
33         winconfig.h             \
34         code_of_conduct.md      \
35         external                \
36         mcs/class/referencesource
37
38 DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
39
40 # Distribute the 'mcs' tree too
41 GIT_DIR ?= $(srcdir)/.git
42 dist-hook:
43         test -d $(distdir)/mcs || mkdir $(distdir)/mcs
44         d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) distdir=$$d dist-recursive
45         rm -rf `find $(top_distdir)/external -path '*\.git'`
46         rm -f `find $(top_distdir)/external -path '*\.exe'`
47         rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*'`
48         cp mcs/class/lib/basic/System.Configuration.dll mcs/class/lib/monolite/
49         cp mcs/class/lib/basic/System.Security.dll mcs/class/lib/monolite/
50 # Disable this for now because it is very slow and causes wrench to timeout:
51 #       test ! -d $(GIT_DIR) || ./scripts/commits-to-changelog.py --root=$(distdir) last-commit-with-compulsory-changelog-entry
52
53 pkgconfigdir = $(libdir)/pkgconfig
54 noinst_DATA = mono-uninstalled.pc
55 DISTCLEANFILES= mono-uninstalled.pc
56
57 # building with monolite
58 mcslib = $(mcs_topdir)/class/lib
59 monolite = $(mcslib)/monolite
60 mono_corlib_version = $(shell sed -n "s/\#define MONO_CORLIB_VERSION //p" $(srcdir)/mono/metadata/appdomain.c)
61 monolite_url = http://download.mono-project.com/monolite/monolite-$(mono_corlib_version)-latest.tar.gz
62 .PHONY: get-monolite-latest 
63 get-monolite-latest:
64         -rm -fr $(mcslib)/monolite-*
65         -mkdir -p $(mcslib)
66         test ! -d $(monolite) || test ! -d $(monolite).old || rm -fr $(monolite).old
67         test ! -d $(monolite) || mv -f $(monolite) $(monolite).old
68         cd $(mcslib) && { (wget -O- $(monolite_url) || curl $(monolite_url)) | gzip -d | tar xf - ; }
69         cd $(mcslib) && mv -f monolite-* monolite
70
71 .PHONY: validate do-build-mono-mcs mcs-do-clean mcs-do-tests
72 validate: do-build-mono-mcs
73         $(MAKE) mcs-do-tests
74 do-build-mono-mcs: mcs-do-clean
75         $(MAKE) all
76 mcs-do-clean:
77         cd runtime && $(MAKE) clean-local
78         cd mono/tests && $(MAKE) clean
79 mcs-do-tests:
80         cd runtime && $(MAKE) check-local
81         cd mono/tests && $(MAKE) check
82
83 .PHONY: compiler-tests mcs-do-compiler-tests
84 compiler-tests:
85         $(MAKE) test_select='TEST_SUBDIRS="tests errors"' validate
86 mcs-do-compiler-tests:
87         $(MAKE) test_select='TEST_SUBDIRS="tests errors"' mcs-do-tests
88
89 .PHONY: bootstrap-world
90 bootstrap-world: compiler-tests
91         $(MAKE) install
92
93 if INSTALL_MONOTOUCH
94 monotouch-do-build: config.h
95         @list='$(MONOTOUCH_SUBDIRS)'; for subdir in $$list; do \
96           case "x$$subdir" in \
97                 xmono ) target="monotouch-do-build";; \
98                 * ) target="all";; \
99           esac; \
100           echo "Making $$target in $$subdir"; \
101           (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
102         done;
103         (cd runtime && $(MAKE) $(AM_MAKEFLAGS) monotouch-do-build)
104
105 monotouch-do-clean:
106         @list='$(MONOTOUCH_SUBDIRS)'; for subdir in $$list; do \
107           case "x$$subdir" in \
108                 xmono ) target="monotouch-do-clean";; \
109                 * ) target="clean";; \
110           esac; \
111           echo "Making $$target in $$subdir"; \
112           (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
113         done;
114         (cd runtime && $(MAKE) $(AM_MAKEFLAGS) monotouch-do-clean)
115
116 endif
117
118 win32getdeps:
119         wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
120         wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip 
121         wget http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip 
122         wget http://www.go-mono.com/archive/libiconv-1.7.zip 
123         wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip 
124         wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip
125         unzip -n -d / pkgconfig-0.11-20020310.zip
126         unzip -n -d / glib-2.0.4-20020703.zip
127         unzip -n -d / glib-dev-2.0.4-20020703.zip
128         unzip -n -d / libiconv-1.7.zip
129         unzip -n -d / libiconv-dev-1.7.zip
130         unzip -n -d / libintl-0.10.40-20020101.zip
131
132 win32setup:
133         makensis /DMILESTONE=$(VERSION) /DSOURCE_INSTALL_DIR=$(SOURCE_INSTALL_DIR) /DBUILDNUM=$(BUILDNUM) monowiz.win32.nsi
134
135 update-csproj:
136         -rm msvc/scripts/order 
137         -rm msvc/scripts/order.xml
138         -rm -rf msvc/scripts/inputs
139         -mkdir msvc/scripts/inputs
140         (cd runtime; make V=1 extra_targets=csproj-local)
141
142 package-inputs:
143         echo '<?xml version="1.0" encoding="utf-8"?>' > msvc/scripts/order.xml
144         echo '<root>' >> msvc/scripts/order.xml
145         for i in `cat msvc/scripts/order`; do \
146                 set `echo $$i | sed -e 's/:/ /' -e 's/.input//'`; \
147                 cat msvc/scripts/inputs/$$2.input | sed -e 's/\\\\/\\/g' -e 's/\\/\\\\/g' | \
148                 (echo "    <project dir=\"$$1\" library=\"$$2\">"; \
149                  read boot;   echo "      <boot>$$boot</boot>"; \
150                  read flags;  echo "      <flags>$$flags</flags>"; \
151                  read output; echo "      <output>$$output</output>"; \
152                  read built;  echo "      <built_sources>`echo $$built | sed 's/\\\/\\\\/g'`</built_sources>"; \
153                  read libou;  echo "      <library_output>$$libou</library_output>"; \
154                  read fx_ver; echo "      <fx_version>$$fx_ver</fx_version>"; \
155                  read profile; echo "      <profile>$$profile</profile>"; \
156                  read resp;   echo "      <response>$$resp</response>"; \
157                  echo "    </project>") >> msvc/scripts/order.xml; \
158         done
159         echo "</root>" >> msvc/scripts/order.xml
160
161 # Update llvm version in configure.ac to the output of $LLVM_DIR/bin/llvm-config --version
162 update-llvm-version:
163         if test "x$$LLVM_DIR" = "x"; then echo "Set the make variable LLVM_DIR to the directory containing the LLVM installation."; exit 1; fi
164         REV=`$(LLVM_DIR)/bin/llvm-config --version` && sed -e "s,expected_llvm_version=.*,expected_llvm_version=\"$$REV\"," < configure.ac > tmp && mv tmp configure.ac && echo "Version set to $$REV."
165
166
167 update-solution-files:
168         make update-csproj
169         make package-inputs
170         (cd msvc/scripts; make genproj.exe; mono genproj.exe)