rules.make 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. # -*- makefile -*-
  2. #
  3. # This is the makefile fragment with default rules
  4. # for building things in MCS
  5. #
  6. # To customize the build, you should edit config.make.
  7. # If you need to edit this file, that's a bug; email
  8. # [email protected] about it.
  9. # Some more variables. The leading period in the sed expression prevents
  10. # thisdir = . from being changed into '..' for the toplevel directory.
  11. dots := $(shell echo $(thisdir) |sed -e 's,[^./][^/]*,..,g')
  12. topdir := $(dots)
  13. VERSION = 0.93
  14. USE_MCS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
  15. USE_MBAS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MBAS_FLAGS) $(PLATFORM_MBAS_FLAGS) $(PROFILE_MBAS_FLAGS) $(MBAS_FLAGS)
  16. USE_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
  17. CSCOMPILE = $(MCS) $(USE_MCS_FLAGS)
  18. BASCOMPILE = $(MBAS) $(USE_MBAS_FLAGS)
  19. CCOMPILE = $(CC) $(USE_CFLAGS)
  20. BOOT_COMPILE = $(BOOTSTRAP_MCS) $(USE_MCS_FLAGS)
  21. INSTALL = $(SHELL) $(topdir)/../mono/install-sh
  22. INSTALL_DATA = $(INSTALL) -c -m 644
  23. INSTALL_BIN = $(INSTALL) -c -m 755
  24. INSTALL_LIB = $(INSTALL_BIN)
  25. MKINSTALLDIRS = $(SHELL) $(topdir)/mkinstalldirs
  26. INTERNAL_MCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/mcs.exe
  27. INTERNAL_MBAS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/mbas/mbas.exe
  28. INTERNAL_GMCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/mcs/gmcs.exe
  29. INTERNAL_ILASM = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/ilasm.exe
  30. INTERNAL_RESGEN = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BOOTSTRAP_PROFILE)/resgen.exe
  31. corlib = mscorlib.dll
  32. depsdir = $(topdir)/build/deps
  33. # Make sure these propagate if set manually
  34. export PLATFORM
  35. export PROFILE
  36. export MCS
  37. export MCS_FLAGS
  38. export CC
  39. export CFLAGS
  40. export INSTALL
  41. export MKINSTALLDIRS
  42. export TEST_HARNESS
  43. export BOOTSTRAP_MCS
  44. export DESTDIR
  45. export RESGEN
  46. # Get this so the platform.make platform-check rule doesn't become the
  47. # default target
  48. .DEFAULT: all
  49. default: all
  50. # Get initial configuration. pre-config is so that the builder can
  51. # override PLATFORM or PROFILE
  52. include $(topdir)/build/config-default.make
  53. -include $(topdir)/build/pre-config.make
  54. # Default PLATFORM and PROFILE if they're not already defined.
  55. ifndef PLATFORM
  56. ifeq ($(OS),Windows_NT)
  57. PLATFORM = win32
  58. else
  59. PLATFORM = linux
  60. endif
  61. endif
  62. # Platform config
  63. include $(topdir)/build/platforms/$(PLATFORM).make
  64. ifdef PLATFORM_CORLIB
  65. corlib = $(PLATFORM_CORLIB)
  66. endif
  67. # Useful
  68. ifeq ($(PLATFORM_RUNTIME),$(RUNTIME))
  69. PLATFORM_MONO_NATIVE = yes
  70. endif
  71. # Rest of the configuration
  72. ifndef PROFILE
  73. PROFILE = default
  74. endif
  75. include $(topdir)/build/profiles/$(PROFILE).make
  76. -include $(topdir)/build/config.make
  77. ifdef OVERRIDE_TARGET_ALL
  78. all: all.override
  79. else
  80. all: do-all
  81. endif
  82. ifdef NO_INSTALL
  83. GACUTIL = :
  84. else
  85. gacutil = $(topdir)/class/lib/net_1_1_bootstrap/gacutil.exe
  86. GACUTIL = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil)
  87. endif
  88. STD_TARGETS = test run-test run-test-ondotnet clean install uninstall
  89. $(STD_TARGETS): %: do-%
  90. do-run-test:
  91. ok=:; $(MAKE) run-test-recursive || ok=false; $(MAKE) run-test-local || ok=false; $$ok
  92. do-%: %-recursive
  93. $(MAKE) $*-local
  94. # The way this is set up, any profile-specific subdirs list should
  95. # be listed _before_ including rules.make. However, the default
  96. # SUBDIRS list can come after, so don't use the eager := syntax when
  97. # using the defaults.
  98. PROFILE_SUBDIRS := $($(PROFILE)_SUBDIRS)
  99. ifndef PROFILE_SUBDIRS
  100. PROFILE_SUBDIRS = $(SUBDIRS)
  101. endif
  102. ifndef FRAMEWORK_VERSION_MAJOR
  103. FRAMEWORK_VERSION_MAJOR = $(basename $(FRAMEWORK_VERSION))
  104. endif
  105. %-recursive:
  106. @set . $$MAKEFLAGS; final_exit=:; \
  107. case $$2 in --unix) shift ;; esac; \
  108. case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \
  109. list='$(PROFILE_SUBDIRS)'; for d in $$list ; do \
  110. (cd $$d && $(MAKE) $*) || { final_exit="exit 1"; $$dk; } ; \
  111. done; \
  112. $$final_exit
  113. ifndef DIST_SUBDIRS
  114. DIST_SUBDIRS = $(SUBDIRS) $(DIST_ONLY_SUBDIRS)
  115. endif
  116. dist-recursive: dist-local
  117. @case '$(distdir)' in [\\/$$]* | ?:[\\/]* ) reldir='$(distdir)' ;; *) reldir='../$(distdir)' ;; esac ; \
  118. list='$(DIST_SUBDIRS)'; for d in $$list ; do \
  119. (cd $$d && $(MAKE) distdir=$$reldir/$$d $@) || exit 1 ; \
  120. done
  121. # The following target can be used like
  122. #
  123. # dist-local: dist-default
  124. # ... additional commands ...
  125. #
  126. # Notes:
  127. # 1. we invert the test here to not end in an error if ChangeLog doesn't exist.
  128. # 2. we error out if we try to dist a nonexistant file.
  129. # 3. we pick up Makefile, makefile, or GNUmakefile.
  130. dist-default:
  131. -mkdir -p $(distdir)
  132. test '!' -f ChangeLog || cp ChangeLog $(distdir)
  133. if test -f Makefile; then m=M; fi; \
  134. if test -f makefile; then m=m; fi; \
  135. if test -f GNUmakefile; then m=GNUm; fi; \
  136. for f in $${m}akefile $(DISTFILES) ; do \
  137. dest=`dirname $(distdir)/$$f` ; \
  138. $(MKINSTALLDIRS) $$dest && cp -p $$f $$dest || exit 1 ; \
  139. done
  140. %/.stamp:
  141. $(MKINSTALLDIRS) $(@D)
  142. touch $@
  143. # Useful
  144. withmcs:
  145. $(MAKE) MCS='$(INTERNAL_MCS)' BOOTSTRAP_MCS='$(INTERNAL_MCS)' all