Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / Makefile.am
1 ACLOCAL_AMFLAGS = -I m4
2
3 AM_CFLAGS = $(WERROR_CFLAGS)
4
5 MONOTOUCH_SUBDIRS = $(libgc_dir) mono
6
7 # Some tools might not build when cross-compiling
8 if CROSS_COMPILING
9 tools_dir =
10 else
11 tools_dir = tools
12 endif
13
14 SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
15 # Keep in sync with SUBDIRS
16 DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
17
18 all: update_submodules
19
20 SUBMODULE_ERROR='Could not recursively update all git submodules. You may experience compilation problems if some submodules are out of date'
21 update_submodules:
22         @$(srcdir)/scripts/update_submodules.sh
23
24 .PHONY: update_submodules
25
26 EXTRA_DIST= \
27         README.md               \
28         LICENSE                 \
29         autogen.sh              \
30         mkinstalldirs           \
31         mono-uninstalled.pc.in  \
32         winconfig.h             \
33         code_of_conduct.md      \
34         external                \
35         mcs/class/referencesource
36
37 DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
38
39 # Distribute the 'mcs' tree too
40 GIT_DIR ?= $(srcdir)/.git
41 dist-hook:
42         test -d $(distdir)/mcs || mkdir $(distdir)/mcs
43         d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) distdir=$$d dist-recursive
44         rm -rf `find $(top_distdir)/external -path '*\.git'`
45         rm -f `find $(top_distdir)/external -path '*\.exe' -not -path '*/roslyn-binaries/*'`
46         rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*' -not -path '*/roslyn-binaries/*'`
47
48 pkgconfigdir = $(libdir)/pkgconfig
49 noinst_DATA = mono-uninstalled.pc
50 DISTCLEANFILES= mono-uninstalled.pc
51
52 # building with monolite
53 .PHONY: get-monolite-latest 
54 get-monolite-latest:
55         $(MAKE) -C $(mcs_topdir)/class get-monolite-latest
56
57 if BITCODE
58 BITCODE_CHECK=yes
59 endif
60
61 .PHONY: check-ci
62 check-ci:
63         MONO_LLVMONLY=$(BITCODE_CHECK) $(srcdir)/scripts/ci/run-test-$(TEST_PROFILE).sh
64
65 .PHONY: validate do-build-mono-mcs mcs-do-clean mcs-do-tests
66 validate: do-build-mono-mcs
67         $(MAKE) mcs-do-tests
68 do-build-mono-mcs: mcs-do-clean
69         $(MAKE) all
70 mcs-do-clean:
71         cd runtime && $(MAKE) clean-local
72         cd mono/tests && $(MAKE) clean
73 mcs-do-tests:
74         cd runtime && $(MAKE) check-local
75         cd mono/tests && $(MAKE) check
76
77 .PHONY: compiler-tests mcs-do-compiler-tests
78 compiler-tests:
79         $(MAKE) test_select='TEST_SUBDIRS="tests errors"' validate
80 mcs-do-compiler-tests:
81         $(MAKE) test_select='TEST_SUBDIRS="tests errors"' mcs-do-tests
82
83 .PHONY: bootstrap-world
84 bootstrap-world: compiler-tests
85         $(MAKE) install
86
87 if INSTALL_MONOTOUCH
88 monotouch-do-build: config.h
89         @list='$(MONOTOUCH_SUBDIRS)'; for subdir in $$list; do \
90           case "x$$subdir" in \
91                 xmono ) target="monotouch-do-build";; \
92                 * ) target="all";; \
93           esac; \
94           echo "Making $$target in $$subdir"; \
95           (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
96         done;
97         (cd runtime && $(MAKE) $(AM_MAKEFLAGS) monotouch-do-build)
98
99 monotouch-do-clean:
100         @list='$(MONOTOUCH_SUBDIRS)'; for subdir in $$list; do \
101           case "x$$subdir" in \
102                 xmono ) target="monotouch-do-clean";; \
103                 * ) target="clean";; \
104           esac; \
105           echo "Making $$target in $$subdir"; \
106           (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \
107         done;
108         (cd runtime && $(MAKE) $(AM_MAKEFLAGS) monotouch-do-clean)
109
110 endif
111
112 update-csproj:
113         -rm msvc/scripts/order 
114         -rm msvc/scripts/order.xml
115         -rm -rf msvc/scripts/inputs
116         -mkdir msvc/scripts/inputs
117         (cd runtime; make V=1 extra_targets=csproj-local)
118
119 package-inputs:
120         echo '<?xml version="1.0" encoding="utf-8"?>' > msvc/scripts/order.xml
121         echo '<root>' >> msvc/scripts/order.xml
122         for i in `cat msvc/scripts/order`; do \
123                 set `echo $$i | sed -e 's/:/ /' -e 's/.input//'`; \
124                 cat msvc/scripts/inputs/$$2.input | sed -e 's/\\\\/\\/g' -e 's/\\/\\\\/g' | \
125                 (echo "    <project dir=\"$$1\" library=\"$$2\">"; \
126                  read boot;   echo "      <boot>$$boot</boot>"; \
127                  read flags;  echo "      <flags>$$flags</flags>"; \
128                  read output; echo "      <output>$$output</output>"; \
129                  read built;  echo "      <built_sources>`echo $$built | sed 's/\\\/\\\\/g'`</built_sources>"; \
130                  read libou;  echo "      <library_output>$$libou</library_output>"; \
131                  read fx_ver; echo "      <fx_version>$$fx_ver</fx_version>"; \
132                  read profile; echo "      <profile>$$profile</profile>"; \
133                  read resxt;  echo "      <resources>$$resxt</resources>"; \
134                  read resp;   echo "      <response>$$resp</response>"; \
135                  echo "    </project>") >> msvc/scripts/order.xml; \
136         done
137         echo "</root>" >> msvc/scripts/order.xml
138
139 # Update llvm version in configure.ac to the output of $LLVM_DIR/bin/llvm-config --version
140 update-llvm-version:
141         if test "x$$LLVM_DIR" = "x"; then echo "Set the make variable LLVM_DIR to the directory containing the LLVM installation."; exit 1; fi
142         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."
143
144
145 update-solution-files:
146         make update-csproj
147         make package-inputs
148         (cd msvc/scripts; make genproj.exe; mono genproj.exe $(GENPROJ_ARGS))
149
150 update-solution-files-with-tests:
151         make "GENPROJ_ARGS=2012 true true" update-solution-files