The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #14424 from dra27/faster-deps-9

Compute C dependency information as a side-effect of compilation

authored by

David Allsopp and committed by
GitHub
380e454c 9703b346

+335 -271
+1 -1
.github/workflows/build-cross.yml
··· 50 50 set -x 51 51 ./configure --disable-warn-error --disable-ocamldoc \ 52 52 --disable-ocamltest --disable-stdlib-manpages \ 53 - --disable-dependency-generation --prefix="$PREFIX" || failed=$? 53 + --prefix="$PREFIX" || failed=$? 54 54 if ((failed)) ; then set +x 55 55 echo ; echo "::group::config.log content ($(wc -l config.log) lines)" 56 56 cat config.log ; echo '::endgroup::' ; exit $failed
+63 -46
Makefile
··· 1507 1507 $(DEPDIR)/runtime/%.npic.$(D): \ 1508 1508 OC_CPPFLAGS = $(OC_NATIVE_CPPFLAGS) $(ocamlrun_CPPFLAGS) 1509 1509 1510 - ## Compilation of runtime C files 1510 + ## Compilation of C files 1511 1511 1512 - # The COMPILE_C_FILE macro below receives as argument the pattern 1513 - # that corresponds to the name of the generated object file 1514 - # (without the extension, which is added by the macro) 1515 - define COMPILE_C_FILE 1512 + # There are two scenarios in which a C object may need to be rebuilt: 1513 + # 1. The C source file is newer than the object 1514 + # 2. A file #include'd by the C source file is newer than the object 1515 + # 1516 + # When the C source file is newer than the object, we do not have to care about 1517 + # which included files are newer, we just have to be sure that all the files 1518 + # which may be #include'd definitely exist. 1519 + # 1520 + # GCC and clang can both generate the precise dependency information 1521 + # needed for (2) as part of compiling the C file. We therefore use C dependency 1522 + # information lazily. 1523 + 1524 + # All C files must depend on the _presence_ of the $(runtime_BUILT_HEADERS). If 1525 + # a C file actually uses one of these headers, then the dependency will be 1526 + # recorded in the .d file (and becomes a real dependency, not an order-only 1527 + # dependency). 1528 + runtime_MISSING_BUILT_HEADERS = \ 1529 + $(filter-out $(wildcard $(runtime_BUILT_HEADERS)), $(runtime_BUILT_HEADERS)) 1530 + 1531 + # COMPILE_C_FILE generates the compilation rules for C objects 1532 + # $1 = target pattern for the generated object file (without the .$(O)) 1533 + # $2 = source pattern for the C source file (without the .c) 1534 + # $3 = optional; if non-empty suppresses the generation of dependency rules 1535 + define DO_COMPILE_C_FILE 1516 1536 ifeq "$(COMPUTE_DEPS)" "true" 1517 - ifneq "$(1)" "%" 1518 - # -MG would ensure that the dependencies are generated even if the files listed 1519 - # in $$(runtime_BUILT_HEADERS) haven't been assembled yet. However, 1520 - # this goes subtly wrong if the user has the headers installed, 1521 - # as gcc will pick up a dependency on those instead and the local 1522 - # ones will not be generated. For this reason, we don't use -MG and 1523 - # instead include $(runtime_BUILT_HEADERS) in the order only dependencies 1524 - # to ensure that they exist before dependencies are computed. 1525 - $(DEPDIR)/$(1).$(D): runtime/%.c | $(DEPDIR)/runtime $(runtime_BUILT_HEADERS) 1526 - $$(V_CCDEPS)$$(DEP_CC) $$(OC_CPPFLAGS) $$(CPPFLAGS) $$< -MT \ 1527 - 'runtime/$$*$(subst runtime/%,,$(1)).$(O)' -MF $$@ 1528 - endif # ifneq "$(1)" "%" 1529 - $(1).$(O): $(2).c 1537 + # Secondary expansion means we can use @D to depend on the directory being 1538 + # created. 1539 + $(1).$(O): $(2).c \ 1540 + $(if $(3),,| $(DEPDIR)/$$$$(@D) $(runtime_MISSING_BUILT_HEADERS)) 1530 1541 else 1531 1542 $(1).$(O): $(2).c \ 1532 1543 $(runtime_CONFIGURED_HEADERS) $(runtime_BUILT_HEADERS) \ 1533 1544 $(RUNTIME_HEADERS) 1534 1545 endif # ifeq "$(COMPUTE_DEPS)" "true" 1535 1546 $$(V_CC)$$(CC) $$(OC_CFLAGS) $$(CFLAGS) $$(OC_CPPFLAGS) $$(CPPFLAGS) \ 1536 - $$(OUTPUTOBJ)$$@ -c $$< 1547 + $$(OUTPUTOBJ)$$@ \ 1548 + $(if $(3),,$(call DEP_FLAGS,$$@,$(DEPDIR)/$$(@:.$(O)=.$(D)))) \ 1549 + -c $$< 1550 + # This is skipped if either $(COMPUTE_DEPS) is false or $(3) is non-empty 1551 + ifeq "$(COMPUTE_DEPS)$(3)" "true" 1552 + # MSVC doesn't emit usable dependency information, but if GCC is available 1553 + # then it can instead be called in order to generate the .d file. 1554 + ifneq "$(CC)" "$(DEP_CC)" 1555 + $$(V_CCDEPS)$$(DEP_CC) $(DEP_CPPFLAGS) $$(OC_CPPFLAGS) $$(CPPFLAGS) $$< \ 1556 + -MM -MT $$@ -MF $(DEPDIR)/$$(@:.$(O)=.$(D)) 1557 + endif # ifneq "$(CC)" "$(DEP_CC)" 1558 + endif # ifeq "$(COMPUTE_DEPS)$(3)" "true" 1537 1559 endef 1538 1560 1539 - $(DEPDIR)/runtime: 1561 + # The additional call expands the optional $(3) to an empty string 1562 + COMPILE_C_FILE = \ 1563 + $(call DO_COMPILE_C_FILE,$(1),$(2),$\ 1564 + $(if $(filter-out undefined,$(origin 3)),$(3))) 1565 + 1566 + .PRECIOUS: $(DEPDIR)/% 1567 + $(DEPDIR)/%: 1540 1568 $(MKDIR) $@ 1541 1569 1542 1570 runtime_OBJECT_TYPES = % %.b %.bd %.bi %.bpic ··· 1556 1584 $(foreach runtime_OBJECT_TYPE,$(subst %,,$(runtime_OBJECT_TYPES)), \ 1557 1585 $(eval \ 1558 1586 runtime/dynlink$(runtime_OBJECT_TYPE).$(O): $(ROOTDIR)/Makefile.config)) 1587 + 1588 + $(eval $(call COMPILE_C_FILE,yacc/%,yacc/%,no-deps)) 1559 1589 1560 1590 ## Compilation of runtime assembly files 1561 1591 ··· 1593 1623 1594 1624 ## Runtime dependencies 1595 1625 1596 - runtime_DEP_FILES := $(addsuffix .b, \ 1597 - $(basename $(runtime_BYTECODE_C_SOURCES) runtime/instrtrace)) 1598 - ifeq "$(NATIVE_COMPILER)" "true" 1599 - runtime_DEP_FILES += $(addsuffix .n, $(basename $(runtime_NATIVE_C_SOURCES))) 1600 - endif 1601 - runtime_DEP_FILES += $(addsuffix d, $(runtime_DEP_FILES)) \ 1602 - $(addsuffix i, $(runtime_DEP_FILES)) \ 1603 - $(addsuffix pic, $(runtime_DEP_FILES)) 1604 - runtime_DEP_FILES := $(addsuffix .$(D), $(runtime_DEP_FILES)) 1605 - 1606 - ifeq "$(COMPUTE_DEPS)" "true" 1607 - include $(addprefix $(DEPDIR)/, $(runtime_DEP_FILES)) 1608 - endif 1626 + RUNTIME_DEP_FILES := $(wildcard $(DEPDIR)/runtime/*.$(D)) 1627 + .PHONY: $(RUNTIME_DEP_FILES) 1628 + include $(RUNTIME_DEP_FILES) 1609 1629 1610 1630 .PHONY: runtime 1611 1631 runtime: stdlib/libcamlrun.$(A) ··· 1945 1965 $(eval $(call COMPILE_C_FILE,ocamltest/%.b,ocamltest/%)) 1946 1966 $(eval $(call COMPILE_C_FILE,ocamltest/%.n,ocamltest/%)) 1947 1967 1948 - ifeq "$(COMPUTE_DEPS)" "true" 1949 - include $(addprefix $(DEPDIR)/, $(ocamltest_C_FILES:.c=.$(D))) 1950 - endif 1951 - 1952 - ocamltest_DEP_FILES = $(addprefix $(DEPDIR)/, $(ocamltest_C_FILES:.c=.$(D))) 1953 - 1954 - $(ocamltest_DEP_FILES): | $(DEPDIR)/ocamltest 1955 - 1956 - $(DEPDIR)/ocamltest: 1957 - $(MKDIR) $@ 1958 - 1959 - $(ocamltest_DEP_FILES): $(DEPDIR)/ocamltest/%.$(D): ocamltest/%.c 1960 - $(V_CCDEPS)$(DEP_CC) $(OC_CPPFLAGS) $(CPPFLAGS) $< -MT '$*.$(O)' -MF $@ 1968 + ocamltest_DEPEND_FILES := $(wildcard $(DEPDIR)/ocamltest/*.$(D)) 1969 + .PHONY: $(ocamltest_DEPEND_FILES) 1970 + include $(ocamltest_DEPEND_FILES) 1961 1971 1962 1972 ocamltest/%: CAMLC = $(BEST_OCAMLC) $(STDLIBFLAGS) 1963 1973 ··· 2035 2045 2036 2046 testsuite/tools/poisonedruntime$(EXE): testsuite/tools/poisonedruntime.$(O) 2037 2047 $(V_MKEXE)$(call MKEXE_VIA_CC,$@,$^) 2048 + 2049 + $(eval $(call COMPILE_C_FILE,\ 2050 + testsuite/tools/main_in_c,testsuite/tools/main_in_c,no-deps)) 2051 + $(eval $(call COMPILE_C_FILE,\ 2052 + testsuite/tools/poisonedruntime,testsuite/tools/poisonedruntime,no-deps)) 2038 2053 2039 2054 ocamltest_BYTECODE_LINKFLAGS = -custom -g 2040 2055 ··· 2276 2291 endif 2277 2292 2278 2293 # Check that the stack limit is reasonable (Unix-only) 2294 + $(eval $(call COMPILE_C_FILE,tools/checkstack,tools/checkstack,no-deps)) 2279 2295 .PHONY: checkstack 2280 2296 ifeq "$(UNIX_OR_WIN32)" "unix" 2281 2297 checkstack: tools/checkstack$(EXE) ··· 3059 3075 lib, $(INSTALL_LIBDIR_COMPILERLIBS)) 3060 3076 endif 3061 3077 3078 + .PHONY: .depend 3062 3079 include .depend 3063 3080 3064 3081 # Include the cross-compiler recipes only when relevant
+7 -1
Makefile.build_config.in
··· 72 72 INSTALL_OCAMLNAT = @install_ocamlnat@ 73 73 74 74 # The command to generate C dependency information 75 - DEP_CC=@DEP_CC@ -MM 75 + DEP_CC=@DEP_CC@ 76 + DEP_CPPFLAGS=@DEP_CPPFLAGS@ 77 + ifeq "@compute_deps@-$(CC)" "true-$(DEP_CC)" 78 + DEP_FLAGS = $(addprefix @DEP_CC_PREFIX@,-MMD -MT $(1) -MF $(2)) 79 + else 80 + DEP_FLAGS = 81 + endif 76 82 COMPUTE_DEPS=@compute_deps@ 77 83 78 84 BUILD_PATH_LOGICAL = @srcdir_abs@
+3 -6
Makefile.common
··· 537 537 538 538 # The rule to compile C files 539 539 540 - # This rule is similar to GNU make's implicit rule, except that it is more 541 - # general (it supports both .o and .obj) 540 + # Cancel GNU Make's implicit C compilation rule 541 + %.o: %.c 542 542 543 + # These are still here as they are shared with otherlibs/ 543 544 ifeq "$(COMPUTE_DEPS)" "true" 544 545 RUNTIME_HEADERS := 545 546 REQUIRED_HEADERS := ··· 548 549 $(wildcard $(ROOTDIR)/runtime/caml/*.h) 549 550 REQUIRED_HEADERS := $(RUNTIME_HEADERS) $(wildcard *.h) 550 551 endif 551 - 552 - %.$(O): %.c $(REQUIRED_HEADERS) 553 - $(V_CC)$(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS) \ 554 - $(OUTPUTOBJ)$@ -c $< 555 552 556 553 $(DEPDIR): 557 554 $(MKDIR) $@
+185 -170
configure
··· 739 739 CC_FOR_BUILD 740 740 flexlink 741 741 ac_ct_RC 742 - CPP 743 742 ac_ct_DEP_CC 744 - DEP_CC 743 + CPP 745 744 LT_SYS_LIBRARY_PATH 746 745 OTOOL64 747 746 OTOOL ··· 951 950 encode_C_literal 952 951 SAK 953 952 SAK_BUILD 953 + DEP_CC_PREFIX 954 + DEP_CPPFLAGS 955 + DEP_CC 954 956 ocaml_cc_vendor 955 957 CC 956 958 LINEAR_MAGIC_NUMBER ··· 3463 3465 CMT_MAGIC_NUMBER=Caml1999T037 3464 3466 3465 3467 LINEAR_MAGIC_NUMBER=Caml1999L037 3468 + 3469 + 3470 + 3466 3471 3467 3472 3468 3473 ··· 14817 14822 esac 14818 14823 14819 14824 14820 - case $host in #( 14821 - sparc-sun-solaris*) : 14822 - DEP_CC="false" ;; #( 14823 - *-pc-windows) : 14824 - if test -n "$ac_tool_prefix"; then 14825 - for ac_prog in $DEP_CC gcc cc x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc 14826 - do 14827 - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. 14828 - set dummy $ac_tool_prefix$ac_prog; ac_word=$2 14829 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 14830 - printf %s "checking for $ac_word... " >&6; } 14831 - if test ${ac_cv_prog_DEP_CC+y} 14832 - then : 14833 - printf %s "(cached) " >&6 14834 - else $as_nop 14835 - if test -n "$DEP_CC"; then 14836 - ac_cv_prog_DEP_CC="$DEP_CC" # Let the user override the test. 14837 - else 14838 - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 14839 - for as_dir in $PATH 14840 - do 14841 - IFS=$as_save_IFS 14842 - case $as_dir in #((( 14843 - '') as_dir=./ ;; 14844 - */) ;; 14845 - *) as_dir=$as_dir/ ;; 14846 - esac 14847 - for ac_exec_ext in '' $ac_executable_extensions; do 14848 - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then 14849 - ac_cv_prog_DEP_CC="$ac_tool_prefix$ac_prog" 14850 - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 14851 - break 2 14852 - fi 14853 - done 14854 - done 14855 - IFS=$as_save_IFS 14856 - 14857 - fi 14858 - fi 14859 - DEP_CC=$ac_cv_prog_DEP_CC 14860 - if test -n "$DEP_CC"; then 14861 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DEP_CC" >&5 14862 - printf "%s\n" "$DEP_CC" >&6; } 14863 - else 14864 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 14865 - printf "%s\n" "no" >&6; } 14866 - fi 14867 - 14868 - 14869 - test -n "$DEP_CC" && break 14870 - done 14871 - fi 14872 - if test -z "$DEP_CC"; then 14873 - ac_ct_DEP_CC=$DEP_CC 14874 - for ac_prog in $DEP_CC gcc cc x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc 14875 - do 14876 - # Extract the first word of "$ac_prog", so it can be a program name with args. 14877 - set dummy $ac_prog; ac_word=$2 14878 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 14879 - printf %s "checking for $ac_word... " >&6; } 14880 - if test ${ac_cv_prog_ac_ct_DEP_CC+y} 14881 - then : 14882 - printf %s "(cached) " >&6 14883 - else $as_nop 14884 - if test -n "$ac_ct_DEP_CC"; then 14885 - ac_cv_prog_ac_ct_DEP_CC="$ac_ct_DEP_CC" # Let the user override the test. 14886 - else 14887 - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 14888 - for as_dir in $PATH 14889 - do 14890 - IFS=$as_save_IFS 14891 - case $as_dir in #((( 14892 - '') as_dir=./ ;; 14893 - */) ;; 14894 - *) as_dir=$as_dir/ ;; 14895 - esac 14896 - for ac_exec_ext in '' $ac_executable_extensions; do 14897 - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then 14898 - ac_cv_prog_ac_ct_DEP_CC="$ac_prog" 14899 - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 14900 - break 2 14901 - fi 14902 - done 14903 - done 14904 - IFS=$as_save_IFS 14905 - 14906 - fi 14907 - fi 14908 - ac_ct_DEP_CC=$ac_cv_prog_ac_ct_DEP_CC 14909 - if test -n "$ac_ct_DEP_CC"; then 14910 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DEP_CC" >&5 14911 - printf "%s\n" "$ac_ct_DEP_CC" >&6; } 14912 - else 14913 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 14914 - printf "%s\n" "no" >&6; } 14915 - fi 14916 - 14917 - 14918 - test -n "$ac_ct_DEP_CC" && break 14919 - done 14920 - 14921 - if test "x$ac_ct_DEP_CC" = x; then 14922 - DEP_CC="false" 14923 - else 14924 - case $cross_compiling:$ac_tool_warned in 14925 - yes:) 14926 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 14927 - printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} 14928 - ac_tool_warned=yes ;; 14929 - esac 14930 - DEP_CC=$ac_ct_DEP_CC 14931 - fi 14932 - fi 14933 - ;; #( 14934 - *) : 14935 - DEP_CC="$CC" ;; 14936 - esac 14937 - 14938 - case $enable_dependency_generation in #( 14939 - yes) : 14940 - if test "$DEP_CC" = "false" 14941 - then : 14942 - as_fn_error $? "The MSVC ports cannot generate dependency information. Install gcc (or another CC-like compiler)" "$LINENO" 5 14943 - else $as_nop 14944 - compute_deps=true 14945 - fi ;; #( 14946 - no) : 14947 - compute_deps=false ;; #( 14948 - *) : 14949 - if test -e .git 14950 - then : 14951 - if test "$DEP_CC" = "false" 14952 - then : 14953 - compute_deps=false 14954 - else $as_nop 14955 - compute_deps=true 14956 - fi 14957 - else $as_nop 14958 - compute_deps=false 14959 - fi ;; 14960 - esac 14961 - 14962 - case $target in #( 14963 - # In config/Makefile.mingw*, we had: 14964 - # TARGET=i686-w64-mingw32 and x86_64-w64-mingw32 14965 - # TOOLPREF=$(TARGET)- 14966 - # ARCMD=$(TOOLPREF)ar 14967 - # However autoconf and libtool seem to use ar 14968 - # So we let them do, at the moment 14969 - *-pc-windows) : 14970 - 14971 - mkexe_via_cc_extra_cmd=' && $(call MERGEMANIFESTEXE,$(1))' 14972 - libext=lib 14973 - AR="" 14974 - if test "$target_cpu" = "x86_64" 14975 - then : 14976 - machine="-machine:AMD64 " 14977 - else $as_nop 14978 - machine="" 14979 - fi 14980 - mklib="link -lib -nologo $machine /out:\$(1) \$(2)" 14981 - ;; #( 14982 - *) : 14983 - 14984 - mklib="rm -f \$(1) && ${AR} rc \$(1) \$(2)" 14985 - ;; 14986 - esac 14987 - 14988 14825 ## Find vendor of the C compiler 14989 14826 ac_ext=c 14990 14827 ac_cpp='$CPP $CPPFLAGS' ··· 15178 15015 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ocaml_cc_vendor" >&5 15179 15016 printf "%s\n" "$ocaml_cc_vendor" >&6; } 15180 15017 15018 + 15019 + DEP_CC_PREFIX='' 15020 + case $host in #( 15021 + sparc-sun-solaris*) : 15022 + DEP_CC="false" ;; #( 15023 + *-pc-windows) : 15024 + case $ocaml_cc_vendor in #( 15025 + msvc-*-clang-*) : 15026 + DEP_CC="$CC" 15027 + DEP_CC_PREFIX='/clang:' ;; #( 15028 + *) : 15029 + if test -n "$ac_tool_prefix"; then 15030 + for ac_prog in $DEP_CC x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc gcc cc 15031 + do 15032 + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. 15033 + set dummy $ac_tool_prefix$ac_prog; ac_word=$2 15034 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 15035 + printf %s "checking for $ac_word... " >&6; } 15036 + if test ${ac_cv_prog_DEP_CC+y} 15037 + then : 15038 + printf %s "(cached) " >&6 15039 + else $as_nop 15040 + if test -n "$DEP_CC"; then 15041 + ac_cv_prog_DEP_CC="$DEP_CC" # Let the user override the test. 15042 + else 15043 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 15044 + for as_dir in $PATH 15045 + do 15046 + IFS=$as_save_IFS 15047 + case $as_dir in #((( 15048 + '') as_dir=./ ;; 15049 + */) ;; 15050 + *) as_dir=$as_dir/ ;; 15051 + esac 15052 + for ac_exec_ext in '' $ac_executable_extensions; do 15053 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then 15054 + ac_cv_prog_DEP_CC="$ac_tool_prefix$ac_prog" 15055 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 15056 + break 2 15057 + fi 15058 + done 15059 + done 15060 + IFS=$as_save_IFS 15061 + 15062 + fi 15063 + fi 15064 + DEP_CC=$ac_cv_prog_DEP_CC 15065 + if test -n "$DEP_CC"; then 15066 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DEP_CC" >&5 15067 + printf "%s\n" "$DEP_CC" >&6; } 15068 + else 15069 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 15070 + printf "%s\n" "no" >&6; } 15071 + fi 15072 + 15073 + 15074 + test -n "$DEP_CC" && break 15075 + done 15076 + fi 15077 + if test -z "$DEP_CC"; then 15078 + ac_ct_DEP_CC=$DEP_CC 15079 + for ac_prog in $DEP_CC x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc gcc cc 15080 + do 15081 + # Extract the first word of "$ac_prog", so it can be a program name with args. 15082 + set dummy $ac_prog; ac_word=$2 15083 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 15084 + printf %s "checking for $ac_word... " >&6; } 15085 + if test ${ac_cv_prog_ac_ct_DEP_CC+y} 15086 + then : 15087 + printf %s "(cached) " >&6 15088 + else $as_nop 15089 + if test -n "$ac_ct_DEP_CC"; then 15090 + ac_cv_prog_ac_ct_DEP_CC="$ac_ct_DEP_CC" # Let the user override the test. 15091 + else 15092 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 15093 + for as_dir in $PATH 15094 + do 15095 + IFS=$as_save_IFS 15096 + case $as_dir in #((( 15097 + '') as_dir=./ ;; 15098 + */) ;; 15099 + *) as_dir=$as_dir/ ;; 15100 + esac 15101 + for ac_exec_ext in '' $ac_executable_extensions; do 15102 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then 15103 + ac_cv_prog_ac_ct_DEP_CC="$ac_prog" 15104 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 15105 + break 2 15106 + fi 15107 + done 15108 + done 15109 + IFS=$as_save_IFS 15110 + 15111 + fi 15112 + fi 15113 + ac_ct_DEP_CC=$ac_cv_prog_ac_ct_DEP_CC 15114 + if test -n "$ac_ct_DEP_CC"; then 15115 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DEP_CC" >&5 15116 + printf "%s\n" "$ac_ct_DEP_CC" >&6; } 15117 + else 15118 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 15119 + printf "%s\n" "no" >&6; } 15120 + fi 15121 + 15122 + 15123 + test -n "$ac_ct_DEP_CC" && break 15124 + done 15125 + 15126 + if test "x$ac_ct_DEP_CC" = x; then 15127 + DEP_CC="false" 15128 + else 15129 + case $cross_compiling:$ac_tool_warned in 15130 + yes:) 15131 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 15132 + printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} 15133 + ac_tool_warned=yes ;; 15134 + esac 15135 + DEP_CC=$ac_ct_DEP_CC 15136 + fi 15137 + fi 15138 + 15139 + # The C compiler may not be targetting Windows, so explicitly include 15140 + # the _WIN32 define 15141 + DEP_CPPFLAGS=-D_WIN32 ;; 15142 + esac ;; #( 15143 + *) : 15144 + DEP_CC="$CC" ;; 15145 + esac 15146 + 15147 + case $enable_dependency_generation in #( 15148 + yes) : 15149 + if test "$DEP_CC" = "false" 15150 + then : 15151 + as_fn_error $? "The MSVC ports cannot generate dependency information. Install gcc (or another CC-like compiler)" "$LINENO" 5 15152 + else $as_nop 15153 + compute_deps=true 15154 + fi ;; #( 15155 + no) : 15156 + compute_deps=false ;; #( 15157 + *) : 15158 + if test -e .git 15159 + then : 15160 + if test "$DEP_CC" = "false" 15161 + then : 15162 + compute_deps=false 15163 + else $as_nop 15164 + compute_deps=true 15165 + fi 15166 + else $as_nop 15167 + compute_deps=false 15168 + fi ;; 15169 + esac 15170 + 15171 + case $target in #( 15172 + # In config/Makefile.mingw*, we had: 15173 + # TARGET=i686-w64-mingw32 and x86_64-w64-mingw32 15174 + # TOOLPREF=$(TARGET)- 15175 + # ARCMD=$(TOOLPREF)ar 15176 + # However autoconf and libtool seem to use ar 15177 + # So we let them do, at the moment 15178 + *-pc-windows) : 15179 + 15180 + mkexe_via_cc_extra_cmd=' && $(call MERGEMANIFESTEXE,$(1))' 15181 + libext=lib 15182 + AR="" 15183 + if test "$target_cpu" = "x86_64" 15184 + then : 15185 + machine="-machine:AMD64 " 15186 + else $as_nop 15187 + machine="" 15188 + fi 15189 + mklib="link -lib -nologo $machine /out:\$(1) \$(2)" 15190 + ;; #( 15191 + *) : 15192 + 15193 + mklib="rm -f \$(1) && ${AR} rc \$(1) \$(2)" 15194 + ;; 15195 + esac 15181 15196 15182 15197 ## In cross-compilation mode, can we run executables produced? 15183 15198 # At the moment, it's required, but the fact is used in C99 function detection
+18 -7
configure.ac
··· 131 131 AC_SUBST([LINEAR_MAGIC_NUMBER], [LINEAR__MAGIC_NUMBER]) 132 132 AC_SUBST([CC]) 133 133 AC_SUBST([ocaml_cc_vendor]) 134 + AC_SUBST([DEP_CC]) 135 + AC_SUBST([DEP_CPPFLAGS]) 136 + AC_SUBST([DEP_CC_PREFIX]) 134 137 AC_SUBST([SAK_BUILD]) 135 138 AC_SUBST([SAK]) 136 139 AC_SUBST([encode_C_literal]) ··· 839 842 OCAML_WITH_NONEXECSTACK_NOTE 840 843 OCAML_ASM_SIZE_TYPE_DIRECTIVES 841 844 845 + ## Find vendor of the C compiler 846 + OCAML_CC_VENDOR 847 + 848 + DEP_CC_PREFIX='' 842 849 AS_CASE([$host], 843 850 [sparc-sun-solaris*], 844 851 [DEP_CC="false"], 845 852 [*-pc-windows], 846 - [AC_CHECK_TOOLS( 847 - [DEP_CC], 848 - [$DEP_CC gcc cc x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc], 849 - [false])], 853 + [AS_CASE([$ocaml_cc_vendor], 854 + [msvc-*-clang-*], 855 + [DEP_CC="$CC" 856 + DEP_CC_PREFIX='/clang:'], 857 + [AC_CHECK_TOOLS( 858 + [DEP_CC], 859 + [$DEP_CC x86_64-w64-mingw32-gcc i686-w64-mingw32-gcc gcc cc], 860 + [false]) 861 + # The C compiler may not be targetting Windows, so explicitly include 862 + # the _WIN32 define 863 + DEP_CPPFLAGS=-D_WIN32])], 850 864 [DEP_CC="$CC"]) 851 865 852 866 AS_CASE([$enable_dependency_generation], ··· 882 896 [ 883 897 mklib="rm -f \$(1) && ${AR} rc \$(1) \$(2)" 884 898 ]) 885 - 886 - ## Find vendor of the C compiler 887 - OCAML_CC_VENDOR 888 899 889 900 ## In cross-compilation mode, can we run executables produced? 890 901 # At the moment, it's required, but the fact is used in C99 function detection
+28 -12
otherlibs/Makefile.otherlibs.common
··· 166 166 %.cmx: %.ml 167 167 $(V_OCAMLOPT)$(CAMLOPT) -c $(COMPFLAGS) $(OPTCOMPFLAGS) $< 168 168 169 + ifeq "$(COMPUTE_DEPS)" "true" 170 + %.b.$(O): %.c $(REQUIRED_HEADERS) | $(DEPDIR) 171 + $(V_CC)$(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS) \ 172 + $(OUTPUTOBJ)$@ $(call DEP_FLAGS,$@,$(DEPDIR)/$(@:.$(O)=.$(D))) -c $< 173 + # MSVC doesn't emit usable dependency information, but if GCC is available 174 + # then it can instead be called in order to generate the .d file. 175 + ifneq "$(CC)" "$(DEP_CC)" 176 + $(V_CCDEPS)$(DEP_CC) $(DEP_CPPFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS) $< \ 177 + -MM -MT $@ -MF $(DEPDIR)/$(@:.$(O)=.$(D)) 178 + endif # ifneq "$(CC)" "$(DEP_CC)" 179 + 180 + %.n.$(O): %.c $(REQUIRED_HEADERS) | $(DEPDIR) 181 + $(V_CC)$(CC) $(OC_CFLAGS) $(CFLAGS) \ 182 + $(OC_CPPFLAGS) $(CPPFLAGS) $(OUTPUTOBJ)$@ \ 183 + $(call DEP_FLAGS,$@,$(DEPDIR)/$(@:.$(O)=.$(D))) -c $< 184 + # MSVC doesn't emit usable dependency information, but if GCC is available 185 + # then it can instead be called in order to generate the .d file. 186 + ifneq "$(CC)" "$(DEP_CC)" 187 + $(V_CCDEPS)$(DEP_CC) $(OC_CPPFLAGS) $(CPPFLAGS) $< -MM -MT $@ \ 188 + -MF $(DEPDIR)/$(@:.$(O)=.$(D)) 189 + endif # ifneq "$(CC)" "$(DEP_CC)" 190 + else 169 191 %.b.$(O): %.c $(REQUIRED_HEADERS) 170 192 $(V_CC)$(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS) \ 171 193 $(OUTPUTOBJ)$@ -c $< 172 194 173 - %.n.$(O): OC_CFLAGS += $(OC_NATIVE_CFLAGS) 174 - 175 195 %.n.$(O): %.c $(REQUIRED_HEADERS) 176 196 $(V_CC)$(CC) $(OC_CFLAGS) $(CFLAGS) \ 177 197 $(OC_CPPFLAGS) $(CPPFLAGS) $(OUTPUTOBJ)$@ -c $< 198 + endif # ifeq "$(COMPUTE_DEPS)" "true" 199 + 200 + %.n.$(O): OC_CFLAGS += $(OC_NATIVE_CFLAGS) 178 201 179 202 ifeq "$(COMPUTE_DEPS)" "true" 180 203 ifneq "$(COBJS_BYTECODE)" "" 181 - include $(addprefix $(DEPDIR)/, $(COBJS_BYTECODE:.$(O)=.$(D))) 182 - ifeq "$(NATIVE_COMPILER)" "true" 183 - include $(addprefix $(DEPDIR)/, $(COBJS_NATIVE:.$(O)=.$(D))) 204 + GENERATED_DEPEND_FILES := $(wildcard $(DEPDIR)/*.$(D)) 205 + .PHONY: $(GENERATED_DEPEND_FILES) 206 + include $(GENERATED_DEPEND_FILES) 184 207 endif 185 208 endif 186 - endif 187 - 188 - $(DEPDIR)/%.b.$(D): %.c | $(DEPDIR) 189 - $(V_CCDEPS)$(DEP_CC) $(OC_CPPFLAGS) $(CPPFLAGS) $< -MT '$*.b.$(O)' -MF $@ 190 - 191 - $(DEPDIR)/%.n.$(D): %.c | $(DEPDIR) 192 - $(V_CCDEPS)$(DEP_CC) $(OC_CPPFLAGS) $(CPPFLAGS) $< -MT '$*.n.$(O)' -MF $@
+1
otherlibs/runtime_events/Makefile
··· 29 29 depend: 30 30 $(OCAMLRUN) $(ROOTDIR)/boot/ocamlc -depend -slash *.mli *.ml > .depend 31 31 32 + .PHONY: .depend 32 33 include .depend
+1
otherlibs/str/Makefile
··· 28 28 depend: 29 29 $(OCAMLRUN) $(ROOTDIR)/boot/ocamlc -depend -slash *.mli *.ml > .depend 30 30 31 + .PHONY: .depend 31 32 include .depend
+14 -15
otherlibs/systhreads/Makefile
··· 84 84 # twice, each time with different options). 85 85 86 86 ifeq "$(COMPUTE_DEPS)" "true" 87 - st_stubs.%.$(O): st_stubs.c 87 + st_stubs.%.$(O): st_stubs.c | $(DEPDIR) 88 88 else 89 89 st_stubs.%.$(O): st_stubs.c $(RUNTIME_HEADERS) $(wildcard *.h) 90 90 endif 91 91 $(V_CC)$(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS) \ 92 - $(OUTPUTOBJ)$@ -c $< 92 + $(OUTPUTOBJ)$@ $(call DEP_FLAGS,$@,$(DEPDIR)/$(@:.$(O)=.$(D))) -c $< 93 + ifeq "$(COMPUTE_DEPS)" "true" 94 + # MSVC doesn't emit usable dependency information, but if GCC is available 95 + # then it can instead be called in order to generate the .d file. 96 + ifneq "$(CC)" "$(DEP_CC)" 97 + $(V_CCDEPS)$(DEP_CC) $(DEP_CPPFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS) $< \ 98 + -MM -MT $@ -MF $(DEPDIR)/$(@:.$(O)=.$(D)) 99 + endif # ifneq "$(CC)" "$(DEP_CC)" 100 + endif # ifeq "$(COMPUTE_DEPS)" "true" 93 101 94 102 .PHONY: partialclean 95 103 partialclean: ··· 130 138 %.cmx: %.ml 131 139 $(V_OCAMLOPT)$(CAMLOPT) -c $(COMPFLAGS) $(OPTCOMPFLAGS) $< 132 140 133 - DEP_FILES := st_stubs.b.$(D) 134 - ifeq "$(NATIVE_COMPILER)" "true" 135 - DEP_FILES += st_stubs.n.$(D) 136 - endif 137 - 138 141 ifeq "$(COMPUTE_DEPS)" "true" 139 - include $(addprefix $(DEPDIR)/, $(DEP_FILES)) 142 + GENERATED_DEPEND_FILES := $(wildcard $(DEPDIR)/*.$(D)) 143 + .PHONY: $(GENERATED_DEPEND_FILES) 144 + include $(GENERATED_DEPEND_FILES) 140 145 endif 141 146 142 147 %.b.$(D): OC_CPPFLAGS = $(OC_BYTECODE_CPPFLAGS) 143 148 %.n.$(O): OC_CPPFLAGS = $(OC_NATIVE_CPPFLAGS) 144 149 %.n.$(D): OC_CPPFLAGS = $(OC_NATIVE_CPPFLAGS) 145 150 146 - define GEN_RULE 147 - $(DEPDIR)/%.$(1).$(D): %.c | $(DEPDIR) 148 - $$(V_CCDEPS)$$(DEP_CC) $$(OC_CPPFLAGS) $$(CPPFLAGS) $$< -MT '$$*.$(1).$(O)' -MF $$@ 149 - endef 150 - 151 - $(foreach object_type, b n, $(eval $(call GEN_RULE,$(object_type)))) 152 - 153 151 .PHONY: depend 154 152 depend: 155 153 $(V_GEN)$(OCAMLRUN) $(ROOTDIR)/boot/ocamlc -depend -slash *.mli *.ml > .depend 156 154 155 + .PHONY: .depend 157 156 include .depend
+1
otherlibs/unix/Makefile
··· 84 84 depend: 85 85 $(OCAMLDEP_CMD) *.mli *.ml > .depend 86 86 87 + .PHONY: .depend 87 88 include .depend
+5
stdlib/Makefile
··· 22 22 23 23 include $(ROOTDIR)/Makefile.common 24 24 25 + %.$(O): %.c $(REQUIRED_HEADERS) 26 + $(V_CC)$(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_CPPFLAGS) $(CPPFLAGS) \ 27 + $(OUTPUTOBJ)$@ -c $< 28 + 25 29 # There are three ways the Standard Library is compiled in bytecode: 26 30 # 1. During coldstart 27 31 # - using ../boot/ocamlc which runs on ../boot/ocamlrun ··· 184 188 clean:: 185 189 rm -f *.cm* *.o *.obj *.a *.lib *.odoc 186 190 191 + .PHONY: .depend 187 192 include .depend 188 193 189 194 STDLIB_NAMESPACE_MODULES = $(subst $(SPACE),|,$(STDLIB_PREFIXED_MODULES))
+1 -3
tools/ci/actions/runner.sh
··· 61 61 --enable-flambda-invariants \ 62 62 --enable-ocamltest \ 63 63 --enable-native-toplevel \ 64 - --disable-dependency-generation \ 65 64 -C $CONFIG_ARG 66 65 } 67 66 ··· 300 299 local failed 301 300 trap ReportBuildStatus ERR 302 301 303 - call-configure --disable-dependency-generation \ 304 - --disable-debug-runtime \ 302 + call-configure --disable-debug-runtime \ 305 303 --disable-instrumented-runtime \ 306 304 --enable-ocamltest \ 307 305
+6 -8
tools/ci/appveyor/appveyor_build.sh
··· 77 77 78 78 case "$1" in 79 79 cygwin*) 80 - args+=('--disable-dependency-generation' '--enable-native-toplevel');; 80 + args+=('--enable-native-toplevel');; 81 81 mingw32) 82 - args+=('--host=i686-w64-mingw32' '--disable-dependency-generation');; 82 + args+=('--host=i686-w64-mingw32');; 83 83 mingw64) 84 - args+=('--host=x86_64-w64-mingw32' '--disable-dependency-generation' \ 85 - '--disable-stdlib-manpages' '--enable-native-toplevel');; 84 + args+=('--host=x86_64-w64-mingw32' '--disable-stdlib-manpages' \ 85 + '--enable-native-toplevel');; 86 86 msvc32) 87 - args+=('--host=i686-pc-windows' '--disable-dependency-generation');; 87 + args+=('--host=i686-pc-windows');; 88 88 msvc64) 89 - # Explicitly test dependency generation on msvc64 90 - args+=('--host=x86_64-pc-windows' '--enable-dependency-generation' \ 91 - '--enable-native-toplevel');; 89 + args+=('--host=x86_64-pc-windows' '--enable-native-toplevel');; 92 90 esac 93 91 if [[ $RELOCATABLE = 'true' ]]; then 94 92 args+=('--with-relative-libdir' \
-1
tools/ci/inria/light
··· 83 83 --disable-shared \ 84 84 --disable-debug-runtime \ 85 85 --disable-instrumented-runtime \ 86 - --disable-dependency-generation \ 87 86 --disable-ocamldoc \ 88 87 --disable-stdlib-manpages 89 88
+1 -1
tools/ci/inria/step-by-step-build/script
··· 23 23 # Make sure the repository is clean 24 24 git clean -q -f -d -x 25 25 26 - ./configure --prefix "$instdir" --disable-dependency-generation 26 + ./configure --prefix "$instdir" 27 27 make $jobs world 28 28 make $jobs opt 29 29 make $jobs opt.opt