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