This is likely a bug with this old version of macos/xcode. (sending in this email to report this issue)
This test works fine with: - default MacOS /usr/bin/make - brew make-4.4.1 - gnumake-4.2.1 compiled with xcode clang (version below) - gnumake-4.4.1 compiled with brew gcc (tried version 11) - gnumake-4.4.1 on arm64-apple-darwin22.3.0 with "Apple clang version 14.0.0 (clang-1400.0.29.202)" Fails with gnumake-4.3+ on arm64-apple-darwin21.4.0 with Apple clang version 13.1.6 (clang-1316.0.21.2.3) Fails with gnumake-4.3+ (with xcode clang version below): Built with "./configure && make" Thanks, Satish ---- balay@jpro^~ $ cat makefile CONFIGDIR = ${PWD}/testdir/config ifeq ($(wildcard ${PWD}/testdir/readme),) CONFIGDIR = ${PWD}/testdir/share/config endif all: -@echo "CONFIGDIR: ${CONFIGDIR}" balay@jpro^~ $ /usr/bin/make CONFIGDIR: /Users/balay/testdir/share/config balay@jpro^~ $ ./make-4.4.1/make Segmentation fault: 11 balay@jpro^~ $ sw_vers ProductName: Mac OS X ProductVersion: 10.15.7 BuildVersion: 19H2026 balay@jpro^~ $ clang --version Apple clang version 12.0.0 (clang-1200.0.32.29) Target: x86_64-apple-darwin19.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin balay@jpro^~ $ bash-3.2# lldb ./make-4.4.1/make (lldb) target create "./make-4.4.1/make" Current executable set to '/Users/balay/make-4.4.1/make' (x86_64). (lldb) run PETSC_DIR=$HOME/petsc Process 84468 launched: '/Users/balay/make-4.4.1/make' (x86_64) Process 84468 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) frame #0: 0x00007fff68562e52 libsystem_platform.dylib`_platform_strlen + 18 libsystem_platform.dylib`_platform_strlen: -> 0x7fff68562e52 <+18>: pcmpeqb (%rdi), %xmm0 0x7fff68562e56 <+22>: pmovmskb %xmm0, %esi 0x7fff68562e5a <+26>: andq $0xf, %rcx 0x7fff68562e5e <+30>: orq $-0x1, %rax Target 0: (make) stopped. (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) * frame #0: 0x00007fff68562e52 libsystem_platform.dylib`_platform_strlen + 18 frame #1: 0x00000001000278fd make`concat(num=0) at misc.c:216:18 frame #2: 0x000000010002e212 make`parse_file_seq(stringp=0x00007ffeefbfdf88, size=16, stopmap=1, prefix=0x0000000000000000, flags=25) at read.c:3535:11 frame #3: 0x0000000100013a09 make`string_glob(line="/petsc/config/gmakegentest.py") at function.c:365:11 frame #4: 0x0000000100011210 make`func_wildcard(o="", argv=0x00007ffeefbfe060, funcname="wildcard") at function.c:1534:14 frame #5: 0x000000010000f540 make`expand_builtin_function(o="", argc=1, argv=0x00007ffeefbfe060, entry_p=0x000000010004cf50) at function.c:2570:12 frame #6: 0x000000010000f160 make`handle_function(op=0x00007ffeefbfe238, stringp=0x00007ffeefbfe248) at function.c:2693:9 frame #7: 0x00000001000096b1 make`variable_expand_string(line="", string="$(wildcard $(PETSCCONFIGDIR)/gmakegentest.py)", length=18446744073709551615) at expand.c:282:17 frame #8: 0x0000000100009f83 make`variable_expand(line="$(wildcard $(PETSCCONFIGDIR)/gmakegentest.py)") at expand.c:441:10 frame #9: 0x00000001000309af make`conditional_line(line=")", len=4, flocp=0x00007ffeefbfe888) at read.c:1724:12 frame #10: 0x000000010002b0f7 make`eval(ebuf=0x00007ffeefbfe860, set_default=1) at read.c:785:17 frame #11: 0x000000010002a85b make`eval_makefile(filename="makefile", flags=0) at read.c:436:3 frame #12: 0x000000010002a233 make`read_all_makefiles(makefiles=0x0000000000000000) at read.c:253:11 frame #13: 0x0000000100021f90 make`main(argc=2, argv=0x00007ffeefbffba0, envp=0x00007ffeefbffbb8) at main.c:2081:18 frame #14: 0x00007fff6836ccc9 libdyld.dylib`start + 1 (lldb)